From b160d1b1e91bfc44d100a731af01a8a66f2e4255 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Thu, 18 May 2017 02:39:27 +0200 Subject: [PATCH] Add option to enable E2E-Encryption (for now, it is disabled by default). --- .../java/com/b44t/ui/SettingsPrivacyActivity.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MessengerProj/src/main/java/com/b44t/ui/SettingsPrivacyActivity.java b/MessengerProj/src/main/java/com/b44t/ui/SettingsPrivacyActivity.java index 3ab440084..fcff41c58 100644 --- a/MessengerProj/src/main/java/com/b44t/ui/SettingsPrivacyActivity.java +++ b/MessengerProj/src/main/java/com/b44t/ui/SettingsPrivacyActivity.java @@ -57,6 +57,8 @@ public class SettingsPrivacyActivity extends BaseFragment { private int manageKeysRow; private int rowCount; + public final int MR_E2EE_DEFAULT_ENABLED = 0; + private final int TYPE_TEXTSETTING = 0; private final int TYPE_TEXT_INFO = 1; private final int TYPE_CHECK_CELL = 2; @@ -117,7 +119,16 @@ public class SettingsPrivacyActivity extends BaseFragment { } else if(i==e2eEncryptionRow ) { - Toast.makeText(getParentActivity(), context.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show(); + int oldval = MrMailbox.getConfigInt("e2ee_enabled", MR_E2EE_DEFAULT_ENABLED); + if( oldval == 1 ) { + MrMailbox.setConfig("e2ee_enabled", "0"); + } + else { + MrMailbox.setConfig("e2ee_enabled", "1"); + } + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(oldval == 0); + } } else if(i==manageKeysRow ) { @@ -214,7 +225,7 @@ public class SettingsPrivacyActivity extends BaseFragment { TextCheckCell textCell = (TextCheckCell) view; if( i == e2eEncryptionRow ) { textCell.setTextAndCheck(mContext.getString(R.string.E2EEncryption), - MrMailbox.getConfigInt("e2e_encrypt", 0)!=0, true); + MrMailbox.getConfigInt("e2ee_enabled", MR_E2EE_DEFAULT_ENABLED)!=0, true); } else if( i == readReceiptsRow ) { textCell.setTextAndCheck(mContext.getString(R.string.SendNRcvReadReceipts),