package de.thedevstack.conversationsplus; import android.graphics.Bitmap; import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; public final class Config { private static final int UNENCRYPTED = 1; private static final int OPENPGP = 2; private static final int OTR = 4; private static final int OMEMO = 8; private static final int ENCRYPTION_MASK = UNENCRYPTED | OPENPGP | OTR | OMEMO; public static boolean supportUnencrypted() { return (ENCRYPTION_MASK & UNENCRYPTED) != 0; } public static boolean supportOpenPgp() { return (ENCRYPTION_MASK & OPENPGP) != 0; } public static boolean supportOtr() { return (ENCRYPTION_MASK & OTR) != 0; } public static boolean supportOmemo() { return ConversationsPlusPreferences.omemoEnabled(); } public static boolean multipleEncryptionChoices() { return (ENCRYPTION_MASK & (ENCRYPTION_MASK - 1)) != 0; } public static final String LOGTAG = BuildConfig.LOGTAG; public static final String DOMAIN_LOCK = BuildConfig.LOCKED_IN_DOMAIN; //only allow account creation for this domain public static final String CONFERENCE_DOMAIN_LOCK = BuildConfig.LOCKED_IN_DOMAIN_CONFERENCES; //only allow conference creation for this domain public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = BuildConfig.CONTACTS_CONFERENCES_LOCKED_TO_DOMAIN; //only add contacts and conferences for own domains public static final boolean LOCK_SETTINGS = BuildConfig.ACCOUNT_SETTINGS_LOCKED; //set to true to disallow account and settings editing public static final boolean DISALLOW_REGISTRATION_IN_UI = BuildConfig.DISALLOW_REGISTRATION_IN_UI; //hide the register checkbox public static final boolean ALLOW_NON_TLS_CONNECTIONS = BuildConfig.ALLOW_NON_TLS_CONNECTIONS; //very dangerous. you should have a good reason to set this to true public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = BuildConfig.HIDE_MESSAGE_TEXT_IN_NOTIFICATION; public static final boolean SHOW_CONNECTED_ACCOUNTS = BuildConfig.SHOW_CONNECTED_ACCOUNTS_IN_FOREGROUND_NOTIFICATION; //show number of connected accounts in foreground notification public static final int PING_MAX_INTERVAL = BuildConfig.PING_MAX_INTERVAL; public static final int PING_MIN_INTERVAL = BuildConfig.PING_MIN_INTERVAL; public static final int PING_TIMEOUT = BuildConfig.PING_TIMEOUT; public static final int SOCKET_TIMEOUT = BuildConfig.SOCKET_TIMEOUT; public static final int CONNECT_TIMEOUT = BuildConfig.CONNECT_TIMEOUT; public static final int CONNECT_DISCO_TIMEOUT = BuildConfig.CONNECT_DISCO_TIMEOUT; public static final int CARBON_GRACE_PERIOD = BuildConfig.CARBON_GRACE_PERIOD; public static final int MINI_GRACE_PERIOD = BuildConfig.MINI_GRACE_PERIOD; public static final boolean CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND = BuildConfig.CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND; public static final int AVATAR_SIZE = BuildConfig.AVATAR_SIZE; public static final Bitmap.CompressFormat AVATAR_FORMAT = BuildConfig.AVATAR_FORMAT; public static final int PAGE_SIZE = BuildConfig.PAGE_SIZE; public static final int MAX_NUM_PAGES = BuildConfig.MAX_NUM_PAGES; public static final int REFRESH_UI_INTERVAL = BuildConfig.REFRESH_UI_INTERVAL; public static final boolean DISABLE_PROXY_LOOKUP = BuildConfig.DISABLE_PROXY_LOOKUP; //useful to debug ibb public static final boolean DISABLE_HTTP_UPLOAD = BuildConfig.DISABLE_HTTP_UPLOAD; public static final boolean DISABLE_STRING_PREP = BuildConfig.DISABLE_STRING_PREP; // setting to true might increase startup performance public static final boolean EXTENDED_SM_LOGGING = BuildConfig.EXTENDED_SM_LOGGING; // log stanza counts public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = BuildConfig.RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE; //setting to true might increase power consumption public static final boolean ENCRYPT_ON_HTTP_UPLOADED = BuildConfig.ENCRYPT_ON_HTTP_UPLOADED; public static final boolean REPORT_WRONG_FILESIZE_IN_OTR_JINGLE = BuildConfig.REPORT_WRONG_FILESIZE_IN_OTR_JINGLE; public static final boolean SHOW_REGENERATE_AXOLOTL_KEYS_BUTTON = BuildConfig.SHOW_REGENERATE_AXOLOTL_KEYS_BUTTON; public static final boolean X509_VERIFICATION = BuildConfig.X509_VERIFICATION_OF_OMEMO_KEYS; //use x509 certificates to verify OMEMO keys public static final boolean IGNORE_ID_REWRITE_IN_MUC = BuildConfig.IGNORE_ID_REWRITE_IN_MUC; public static final boolean REQUEST_DISCO = BuildConfig.REQUEST_DISCO; public static final long MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000; public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY / 2; public static final int MAM_MAX_MESSAGES = BuildConfig.MAM_MAX_MESSAGES; public static final ChatState DEFAULT_CHATSTATE = ChatState.ACTIVE; public static final int TYPING_TIMEOUT = BuildConfig.TYPING_TIMEOUT; public static final String ENABLED_CIPHERS[] = { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA384", "TLS_DHE_RSA_WITH_AES_256_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_DHE_RSA_WITH_CAMELLIA_256_SHA", // Fallback. "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_128_GCM_SHA384", "TLS_RSA_WITH_AES_256_GCM_SHA256", "TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_RSA_WITH_AES_128_CBC_SHA384", "TLS_RSA_WITH_AES_256_CBC_SHA256", "TLS_RSA_WITH_AES_256_CBC_SHA384", "TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_256_CBC_SHA", }; public static final String WEAK_CIPHER_PATTERNS[] = { "_NULL_", "_EXPORT_", "_anon_", "_RC4_", "_DES_", "_MD5", }; private Config() { } }