aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
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/java/de/pixart
parent5efdeb9de7bb38115b6082ba803c16c25f8472f4 (diff)
make unencrypted chat warning configurable via settings
Diffstat (limited to 'src/main/java/de/pixart')
-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
3 files changed, 15 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";