Add options for e2e-encryption and for read receipts.

This commit is contained in:
B. Petersen
2017-01-19 18:16:21 +01:00
parent 0478ea5162
commit df75d2917f
3 changed files with 33 additions and 7 deletions
@@ -30,6 +30,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.Toast;
import com.b44t.messenger.ApplicationLoader;
import com.b44t.messenger.LocaleController;
@@ -52,6 +53,8 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
private ListAdapter listAdapter;
private int privacySectionRow;
private int e2eEncryptionRow;
private int readReceiptsRow;
private int blockedRow;
private int showUnknownSendersRow;
private int securitySectionRow;
@@ -73,9 +76,11 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
rowCount = 0;
privacySectionRow = -1;
e2eEncryptionRow = rowCount++;
readReceiptsRow = rowCount++;
blockedRow = rowCount++;
showUnknownSendersRow = rowCount++;
passcodeRow = rowCount++;
showUnknownSendersRow = rowCount++;
securitySectionRow = -1;
secretDetailRow = rowCount++;
@@ -128,7 +133,16 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
} else {
presentFragment(new PasscodeActivity(0));
}
} else if( i==showUnknownSendersRow) {
}
else if(i==e2eEncryptionRow )
{
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
}
else if(i==readReceiptsRow )
{
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
}
else if( i==showUnknownSendersRow) {
int oldval = MrMailbox.getConfigInt("show_deaddrop", 0);
if( oldval == 1 ) {
MrMailbox.setConfig("show_deaddrop", "0");
@@ -236,8 +250,8 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
@Override
public boolean isEnabled(int i) {
return (i == passcodeRow) || (i == blockedRow) ||
(i == showUnknownSendersRow);
int type = getItemViewType(i);
return type!=TYPE_HEADER && type!=TYPE_TEXT_INFO;
}
@Override
@@ -300,9 +314,17 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
view.setBackgroundColor(0xffffffff);
}
TextCheckCell textCell = (TextCheckCell) view;
if( i==showUnknownSendersRow) {
if( i == e2eEncryptionRow ) {
textCell.setTextAndCheck(LocaleController.getString("E2EEncryption", R.string.E2EEncryption),
MrMailbox.getConfigInt("e2e_encrypt", 1)!=0, true);
}
else if( i == readReceiptsRow ) {
textCell.setTextAndCheck(LocaleController.getString("SendNRcvReadReceipts", R.string.SendNRcvReadReceipts),
MrMailbox.getConfigInt("read_receipts", 1)!=0, true);
}
else if( i==showUnknownSendersRow) {
textCell.setTextAndCheck(LocaleController.getString("DeaddropInChatlist", R.string.DeaddropInChatlist),
MrMailbox.getConfigInt("show_deaddrop", 0)!=0, true);
MrMailbox.getConfigInt("show_deaddrop", 0)!=0, false);
}
}
return view;
@@ -314,7 +336,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
return TYPE_TEXT_INFO;
} else if (i == securitySectionRow || i == privacySectionRow ) {
return TYPE_HEADER;
} else if (i==showUnknownSendersRow) {
} else if (i==showUnknownSendersRow || i==e2eEncryptionRow || i==readReceiptsRow ) {
return TYPE_CHECK_CELL;
}
return TYPE_TEXTSETTING;
@@ -544,4 +544,6 @@
<string name="ErrSelfNotInGroup">Sie müssen ein Gruppenmitglied sein, um diese Aktion ausführen zu können.</string>
<string name="MsgGroupLeft">Gruppe verlassen.</string>
<string name="NoMessagesHint">Nachricht an <![CDATA[<b>]]>%1$s<![CDATA[</b>]]> senden:\n\n• <![CDATA[<b>]]>%2$s<![CDATA[</b>]]> muss hierzu Delta Chat nicht installiert haben.\n\n• Die Zustellung der ersten Nachricht kann einen Moment dauern.</string>
<string name="E2EEncryption">Ende-zu-Ende-Verschlüsselung</string>
<string name="SendNRcvReadReceipts">Lesebestätigungen empfangen/senden</string>
</resources>
@@ -544,4 +544,6 @@
<string name="ErrSelfNotInGroup">You must be a member of the group to perform this action.</string>
<string name="MsgGroupLeft">Group left.</string>
<string name="NoMessagesHint">Send message to <![CDATA[<b>]]>%1$s<![CDATA[</b>]]>:\n\n• It is okay if <![CDATA[<b>]]>%2$s<![CDATA[</b>]]> does not use Delta Chat.\n\n• Delivering the first message may take a moment.</string>
<string name="SendNRcvReadReceipts">Receive and send read receipts</string>
<string name="E2EEncryption">End-to-end-encryption</string>
</resources>