aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-11-25 20:39:23 +0100
committerChristian Schneppe <christian@pix-art.de>2017-11-25 20:40:28 +0100
commitda360fa89c81bdd64deb102027c98a22ae2b47ae (patch)
tree8bf9a016817b59de7a9b00e6a6e63551dd2ea83b /src/main
parent5efdeb9de7bb38115b6082ba803c16c25f8472f4 (diff)
make unencrypted chat warning configurable via settings
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java15
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java1
-rw-r--r--src/main/res/values/defaults.xml2
-rw-r--r--src/main/res/values/strings.xml2
-rw-r--r--src/main/res/xml/preferences.xml5
6 files changed, 24 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 55c2a6008..bc3f6e0bf 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3456,6 +3456,10 @@ public class XmppConnectionService extends Service {
return getBooleanPreference("show_connection_options", R.bool.show_connection_options);
}
+ public boolean warnUnecryptedChat() {
+ return getBooleanPreference(SettingsActivity.WARN_UNENCRYPTED_CHAT, R.bool.warn_unencrypted_chat);
+ }
+
public boolean broadcastLastActivity() {
return getBooleanPreference(SettingsActivity.BROADCAST_LAST_ACTIVITY, R.bool.last_activity);
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index a0376e727..a8f8cf1dc 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -312,10 +312,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
};
- private OnClickListener mOK = new OnClickListener() {
+ private OnClickListener mHideUnencryptionHint = new OnClickListener() {
@Override
public void onClick(View v) {
- if (conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)) {
+ if (Config.supportOmemo() && conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)) {
conversation.setNextEncryption(Message.ENCRYPTION_AXOLOTL);
activity.refreshUi();
}
@@ -1107,9 +1107,14 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener, this.mLongPressBlockListener);
} else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
showSnackbar(R.string.contact_asks_for_presence_subscription, R.string.allow, this.mAllowPresenceSubscription, this.mLongPressBlockListener);
- } else if (conversation.getNextEncryption() == Message.ENCRYPTION_NONE
- && (mode == Conversation.MODE_SINGLE || (mode == Conversation.MODE_MULTI && conversation.getMucOptions().membersOnly() && conversation.getMucOptions().nonanonymous()))) {
- showSnackbar(R.string.conversation_unencrypted_hint, R.string.ok, mOK , null);
+ } else if (activity.xmppConnectionService.warnUnecryptedChat() && (conversation.getNextEncryption() == Message.ENCRYPTION_NONE
+ && ((mode == Conversation.MODE_SINGLE)
+ && ((Config.supportOmemo() && conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation))
+ || (Config.supportOpenPgp() && account.isPgpDecryptionServiceConnected()) || Config.supportOtr()))
+ || ((mode == Conversation.MODE_MULTI && conversation.getMucOptions().membersOnly() && conversation.getMucOptions().nonanonymous())
+ && (Config.supportOmemo() && conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)
+ || (Config.supportOpenPgp() && account.isPgpDecryptionServiceConnected()))))) {
+ showSnackbar(R.string.conversation_unencrypted_hint, R.string.ok, mHideUnencryptionHint, null);
} else if (mode == Conversation.MODE_MULTI
&& !conversation.getMucOptions().online()
&& account.getStatus() == Account.State.ONLINE) {
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index adf8ab03f..040149a31 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -43,6 +43,7 @@ public class SettingsActivity extends XmppActivity implements
public static final String BLIND_TRUST_BEFORE_VERIFICATION = "btbv";
public static final String AUTOMATIC_MESSAGE_DELETION = "automatic_message_deletion";
public static final String BROADCAST_LAST_ACTIVITY = "last_activity";
+ public static final String WARN_UNENCRYPTED_CHAT = "warn_unencrypted_chat";
public static final String THEME = "theme";
public static final String SHOW_DYNAMIC_TAGS = "show_dynamic_tags";
public static final String SHOW_FOREGROUND_SERVICE = "show_foreground_service";
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index 0f62c59c2..15a25054a 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -101,4 +101,6 @@
<bool name="plain_text_logs">false</bool>
<bool name="validate_hostname">false</bool>
<bool name="show_foreground_service">true</bool>
+ <bool name="warn_unencrypted_chat">true</bool>
</resources>
+
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 0d0695cf8..e8f72f3ca 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -742,4 +742,6 @@
<string name="pref_return_to_previous">Quick Sharing</string>
<string name="pref_return_to_previous_summary">Immediately return to previous activity instead of opening the conversation after sharing something</string>
<string name="conversation_unencrypted_hint">This chat is unencrypted, for security reasons you should activate message encryption by using the lock icon. The preferable encryption is OMEMO.</string>
+ <string name="pref_warn_unencrypted_chat">Warn if chat is unencrypted</string>
+ <string name="pref_warn_unencrypted_chat_summary">If message encryption is available, you should use it. If you don\'t use message encryption, show a warning message inside the chat.</string>
</resources>
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index 0c7552323..70ce4e76c 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -221,6 +221,11 @@
android:title="@string/pref_broadcast_last_activity"
android:summary="@string/pref_broadcast_last_activity_summary" />
<CheckBoxPreference
+ android:defaultValue="@bool/warn_unencrypted_chat"
+ android:key="warn_unencrypted_chat"
+ android:title="@string/pref_warn_unencrypted_chat"
+ android:summary="@string/pref_warn_unencrypted_chat_summary"/>
+ <CheckBoxPreference
android:defaultValue="@bool/send_crashreport"
android:key="crashreport"
android:summary="@string/pref_send_crash_summary"