diff options
-rw-r--r-- | build.gradle | 1 | ||||
-rw-r--r-- | configuration.gradle | 51 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/Config.java | 86 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Conversation.java | 12 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/NotificationService.java | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 1 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/Xmlns.java | 2 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/xml/preferences.xml | 7 |
10 files changed, 94 insertions, 80 deletions
diff --git a/build.gradle b/build.gradle index 7f2ecaf8..978ed2f2 100644 --- a/build.gradle +++ b/build.gradle @@ -73,6 +73,7 @@ android { versionCode 140 versionName "1.11.7" archivesBaseName += "-$versionName" + apply from: 'configuration.gradle' } dexOptions { diff --git a/configuration.gradle b/configuration.gradle new file mode 100644 index 00000000..fbb02b6e --- /dev/null +++ b/configuration.gradle @@ -0,0 +1,51 @@ + +apply plugin: 'com.android.application' + + +android { + + productFlavors { + free { + buildConfigField 'String', 'LOGTAG', '"conversationsplus"' // JUST AS EXAMPLE + } + } + + defaultConfig { + buildConfigField 'String', 'LOGTAG', '"conversationsplus"' + buildConfigField 'String', 'LOCKED_IN_DOMAIN', 'null' // only allow account creation for this domain + buildConfigField 'String', 'LOCKED_IN_DOMAIN_CONFERENCES', 'null' // only allow conference creation for this domain + buildConfigField 'boolean', 'CONTACTS_CONFERENCES_LOCKED_TO_DOMAIN', 'false' // only add contacts and conferences for own domains + buildConfigField 'boolean', 'ACCOUNT_SETTINGS_LOCKED', 'false' // set to true to disallow account and settings editing + buildConfigField 'boolean', 'DISALLOW_REGISTRATION_IN_UI', 'false' // hide the register checkbox + buildConfigField 'boolean', 'ALLOW_NON_TLS_CONNECTIONS', 'false' // very dangerous. you should have a good reason to set this to true + buildConfigField 'boolean', 'HIDE_MESSAGE_TEXT_IN_NOTIFICATION', 'false' // + buildConfigField 'boolean', 'SHOW_CONNECTED_ACCOUNTS_IN_FOREGROUND_NOTIFICATION', 'false' // show number of connected accounts in foreground notification + buildConfigField 'int', 'PING_MAX_INTERVAL', '300' // maximum ping interval in seconds + buildConfigField 'int', 'PING_MIN_INTERVAL', '30' // minimum ping interval in seconds + buildConfigField 'int', 'PING_TIMEOUT', '15' // ping timeout in seconds + buildConfigField 'int', 'SOCKET_TIMEOUT', '15' // socket timeout in seconds + buildConfigField 'int', 'CONNECT_TIMEOUT', '90' // connect timeout in seconds + buildConfigField 'int', 'CONNECT_DISCO_TIMEOUT', '20' // disco timeout while connecting in seconds + buildConfigField 'int', 'CARBON_GRACE_PERIOD', '90' // carbon grace period in seconds + buildConfigField 'int', 'MINI_GRACE_PERIOD', '750' // whatever ??? + buildConfigField 'boolean', 'CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND', 'false' // + buildConfigField 'int', 'AVATAR_SIZE', '192' // height and width of an avatar + buildConfigField 'int', 'PAGE_SIZE', '50' // maximum messages per page + buildConfigField 'int', 'MAX_NUM_PAGES', '3' // maximum pages + buildConfigField 'int', 'REFRESH_UI_INTERVAL', '500' // Refresh UI interval in milliseonds + buildConfigField 'android.graphics.Bitmap.CompressFormat', 'AVATAR_FORMAT', 'android.graphics.Bitmap.CompressFormat.PNG' // Format of an avatar + buildConfigField 'boolean', 'DISABLE_PROXY_LOOKUP', 'false' // disables proxy lookup for JingleConnections - useful to debug ibb + buildConfigField 'boolean', 'DISABLE_HTTP_UPLOAD', 'false' // + buildConfigField 'boolean', 'DISABLE_STRING_PREP', 'false' // setting to true might increase startup performance + buildConfigField 'boolean', 'EXTENDED_SM_LOGGING', 'false' // log stanza counts + buildConfigField 'boolean', 'RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE', 'true' // setting to true might increase power consumption + buildConfigField 'boolean', 'ENCRYPT_ON_HTTP_UPLOADED', 'false' // + buildConfigField 'boolean', 'REPORT_WRONG_FILESIZE_IN_OTR_JINGLE', 'true' // + buildConfigField 'boolean', 'SHOW_REGENERATE_AXOLOTL_KEYS_BUTTON', 'false' // + buildConfigField 'boolean', 'X509_VERIFICATION_OF_OMEMO_KEYS', 'false' // use x509 certificates to verify OMEMO keys + buildConfigField 'boolean', 'IGNORE_ID_REWRITE_IN_MUC', 'true' // + buildConfigField 'boolean', 'REQUEST_DISCO', 'true' // + buildConfigField 'int', 'MAM_MAX_MESSAGES', '500' // maximum number of messages to load via MAM + buildConfigField 'int', 'TYPING_TIMEOUT', '8' // Typing timeout in seconds + } +}
\ No newline at end of file diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 4d5e3d62..a9297c81 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -35,76 +35,62 @@ public final class Config { return (ENCRYPTION_MASK & (ENCRYPTION_MASK - 1)) != 0; } - public static final String LOGTAG = "conversations"; + 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 String DOMAIN_LOCK = null; //only allow account creation for this domain - public static final String CONFERENCE_DOMAIN_LOCK = null; //only allow conference creation for this domain - public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = false; //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 LOCK_SETTINGS = false; //set to true to disallow account and settings editing - public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //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 boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true - public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; - public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification - public static final boolean SHOW_DISABLE_FOREGROUND = true; //if set to true the foreground notification has a button to disable it + 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 LEGACY_NAMESPACE_HTTP_UPLOAD = false; + public static final boolean CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND = BuildConfig.CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND; - public static final int PING_MAX_INTERVAL = 300; - public static final int PING_MIN_INTERVAL = 30; - public static final int PING_TIMEOUT = 15; - public static final int SOCKET_TIMEOUT = 15; - public static final int CONNECT_TIMEOUT = 90; - public static final int CONNECT_DISCO_TIMEOUT = 20; - public static final int CARBON_GRACE_PERIOD = 90; - public static final int MINI_GRACE_PERIOD = 750; + public static final int AVATAR_SIZE = BuildConfig.AVATAR_SIZE; + public static final Bitmap.CompressFormat AVATAR_FORMAT = BuildConfig.AVATAR_FORMAT; - public static final boolean CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND = false; + public static final int PAGE_SIZE = BuildConfig.PAGE_SIZE; + public static final int MAX_NUM_PAGES = BuildConfig.MAX_NUM_PAGES; - public static final int AVATAR_SIZE = 192; - public static final Bitmap.CompressFormat AVATAR_FORMAT = Bitmap.CompressFormat.PNG; + public static final int REFRESH_UI_INTERVAL = BuildConfig.REFRESH_UI_INTERVAL; - public static final int IMAGE_SIZE = 1920; - public static final Bitmap.CompressFormat IMAGE_FORMAT = Bitmap.CompressFormat.JPEG; - public static final int IMAGE_QUALITY = 75; - public static final int IMAGE_MAX_SIZE = 524288; //512KiB + 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 int MESSAGE_MERGE_WINDOW = 20; + public static final boolean ENCRYPT_ON_HTTP_UPLOADED = BuildConfig.ENCRYPT_ON_HTTP_UPLOADED; - public static final boolean UTF8_EMOTICONS = false; + public static final boolean REPORT_WRONG_FILESIZE_IN_OTR_JINGLE = BuildConfig.REPORT_WRONG_FILESIZE_IN_OTR_JINGLE; - public static final int PAGE_SIZE = 50; - public static final int MAX_NUM_PAGES = 3; + public static final boolean SHOW_REGENERATE_AXOLOTL_KEYS_BUTTON = BuildConfig.SHOW_REGENERATE_AXOLOTL_KEYS_BUTTON; - public static final int PROGRESS_UI_UPDATE_INTERVAL = 750; - public static final int REFRESH_UI_INTERVAL = 500; + public static final boolean X509_VERIFICATION = BuildConfig.X509_VERIFICATION_OF_OMEMO_KEYS; //use x509 certificates to verify OMEMO keys - public static final boolean DISABLE_PROXY_LOOKUP = false; //useful to debug ibb - public static final boolean DISABLE_HTTP_UPLOAD = false; - public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance - public static final boolean EXTENDED_SM_LOGGING = false; // log stanza counts - public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption + public static final boolean IGNORE_ID_REWRITE_IN_MUC = BuildConfig.IGNORE_ID_REWRITE_IN_MUC; - public static final boolean ENCRYPT_ON_HTTP_UPLOADED = false; - - public static final boolean REPORT_WRONG_FILESIZE_IN_OTR_JINGLE = true; - - public static final boolean SHOW_REGENERATE_AXOLOTL_KEYS_BUTTON = false; - - public static final boolean X509_VERIFICATION = false; //use x509 certificates to verify OMEMO keys - - public static final boolean IGNORE_ID_REWRITE_IN_MUC = true; - - public static final boolean REQUEST_DISCO = true; + 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 = 500; + 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 = 8; + public static final int TYPING_TIMEOUT = BuildConfig.TYPING_TIMEOUT; public static final String ENABLED_CIPHERS[] = { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index ab0e4966..5046797f 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -318,18 +318,6 @@ public class Conversation extends AbstractEntity implements Blockable { setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets); } - public void setCorrectingMessage(Message correctingMessage) { - this.correctingMessage = correctingMessage; - } - - public Message getCorrectingMessage() { - return this.correctingMessage; - } - - public boolean withSelf() { - return getContact().isSelf(); - } - public interface OnMessageFound { void onMessageFound(final Message message); } diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 5ae7e9f1..12c11dd0 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -522,11 +522,9 @@ public class NotificationService { cancelIcon = R.drawable.ic_action_cancel; } mBuilder.setSmallIcon(R.drawable.ic_link_white_24dp); - if (Config.SHOW_DISABLE_FOREGROUND) { - mBuilder.addAction(cancelIcon, - mXmppConnectionService.getString(R.string.disable_foreground_service), - createDisableForeground()); - } + mBuilder.addAction(cancelIcon, + mXmppConnectionService.getString(R.string.disable_foreground_service), + createDisableForeground()); return mBuilder.build(); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 74c0e314..75467132 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -422,7 +422,6 @@ public class ConversationActivity extends XmppActivity menuInviteContact.setVisible(getSelectedConversation().getMucOptions().canInvite()); menuSecure.setVisible((Config.supportOpenPgp() || Config.supportOmemo()) && Config.multipleEncryptionChoices()); //only if pgp is supported we have a choice } else { - menuContactDetails.setVisible(!this.getSelectedConversation().withSelf()); menuMucDetails.setVisible(false); menuSecure.setVisible(Config.multipleEncryptionChoices()); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index d436e60d..6d911629 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -472,9 +472,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa highlightInConference(user); } } else { - if (!message.getContact().isSelf()) { - activity.switchToContactDetails(message.getContact(), message.getFingerprint()); - } + activity.switchToContactDetails(message.getContact(), message.getFingerprint()); } } else { Account account = message.getConversation().getAccount(); diff --git a/src/main/java/eu/siacs/conversations/utils/Xmlns.java b/src/main/java/eu/siacs/conversations/utils/Xmlns.java index a19ec791..ad30b3e6 100644 --- a/src/main/java/eu/siacs/conversations/utils/Xmlns.java +++ b/src/main/java/eu/siacs/conversations/utils/Xmlns.java @@ -7,5 +7,5 @@ public final class Xmlns { public static final String ROSTER = "jabber:iq:roster"; public static final String REGISTER = "jabber:iq:register"; public static final String BYTE_STREAMS = "http://jabber.org/protocol/bytestreams"; - public static final String HTTP_UPLOAD = Config.LEGACY_NAMESPACE_HTTP_UPLOAD ? "eu:siacs:conversations:http:upload" : "urn:xmpp:http:upload"; + public static final String HTTP_UPLOAD = "urn:xmpp:http:upload"; } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 63f76a59..6430b6f9 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -296,8 +296,6 @@ <string name="pref_security_settings">Security</string> <string name="pref_force_encryption">Force end-to-end encryption</string> <string name="pref_force_encryption_summary">Always send messages encrypted (except for conferences)</string> - <string name="pref_allow_message_correction">Allow message correction</string> - <string name="pref_allow_message_correction_summary">Allow your contacts to retroactively edit their messages</string> <string name="pref_dont_save_encrypted">Don’t save encrypted messages</string> <string name="pref_dont_save_encrypted_summary">Warning: This could lead to message loss</string> <string name="pref_expert_options">Expert settings</string> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 90ac3c0b..e4ee8df2 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -199,11 +199,6 @@ android:key="remove_trusted_certificates" android:summary="@string/pref_remove_trusted_certificates_summary" android:title="@string/pref_remove_trusted_certificates_title"/> - <CheckBoxPreference - android:defaultValue="false" - android:key="allow_message_correction" - android:title="@string/pref_allow_message_correction" - android:summary="@string/pref_allow_message_correction_summary"/> </PreferenceCategory> <PreferenceCategory android:key="connection_options" @@ -244,7 +239,7 @@ android:title="@string/pref_treat_vibrate_as_silent" android:summary="@string/pref_treat_vibrate_as_silent_summary"/> </PreferenceCategory> - <PreferenceCategory android:title="@string/pref_expert_options_other"> + <PreferenceCategory android:key="other_expert_settings" android:title="@string/pref_expert_options_other"> <CheckBoxPreference android:key="autojoin" android:defaultValue="true" |