Add E2EE options.

This commit is contained in:
B. Petersen
2017-01-21 14:36:47 +01:00
parent df75d2917f
commit 5485db8509
4 changed files with 28 additions and 18 deletions
@@ -60,6 +60,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
private int securitySectionRow;
private int passcodeRow;
private int secretDetailRow;
private int manageKeysRow;
private int rowCount;
private final int TYPE_TEXTSETTING = 0;
@@ -81,6 +82,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
blockedRow = rowCount++;
passcodeRow = rowCount++;
showUnknownSendersRow = rowCount++;
manageKeysRow = rowCount++;
securitySectionRow = -1;
secretDetailRow = rowCount++;
@@ -138,6 +140,10 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
{
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
}
else if(i==manageKeysRow )
{
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();
@@ -290,6 +296,9 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
String val = UserConfig.passcodeHash.length() > 0? LocaleController.getString("Enabled", R.string.Enabled) : LocaleController.getString("Disabled", R.string.Disabled);
textCell.setTextAndValue(LocaleController.getString("Passcode", R.string.Passcode), val, true);
}
else if( i==manageKeysRow ) {
textCell.setText(LocaleController.getString("E2EManagePrivateKeys", R.string.E2EManagePrivateKeys), true);
}
} else if (type == TYPE_TEXT_INFO) {
if (view == null) {
view = new TextInfoPrivacyCell(mContext);
@@ -324,7 +333,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
}
else if( i==showUnknownSendersRow) {
textCell.setTextAndCheck(LocaleController.getString("DeaddropInChatlist", R.string.DeaddropInChatlist),
MrMailbox.getConfigInt("show_deaddrop", 0)!=0, false);
MrMailbox.getConfigInt("show_deaddrop", 0)!=0, true);
}
}
return view;
@@ -136,6 +136,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
private int settingsNotificationsRow = -1;
private int changeNameRow = -1;
private int startChatRow = -1;
private int compareKeysRow = -1;
private int addMemberRow = -1;
private int emptyRowChat = -1;
@@ -387,6 +388,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
presentFragment(new ContactAddActivity(args));
}
else if(position==compareKeysRow)
{
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
}
else if(position==startChatRow)
{
int belonging_chat_id = MrMailbox.getChatIdByContactId(user_id);
@@ -455,10 +460,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
}
}
else
{
processOnClickOrPress(position);
}
}
});
@@ -495,9 +496,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
return true;
} else
}
else
{
return processOnClickOrPress(position);
return false;
}
}
});
@@ -623,16 +625,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return fragmentView;
}
private boolean processOnClickOrPress(final int position) {
if (position == changeNameRow) {
return true;
}
else if (position == startChatRow) {
return true;
}
return false;
}
@Override
public void saveSelfArgs(Bundle args) {
if (chat_id != 0) {
@@ -1112,6 +1104,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
if (user_id != 0) {
compareKeysRow = rowCount++;
startChatRow = rowCount++;
} else if (chat_id != 0 && chat_id!=MrChat.MR_CHAT_ID_DEADDROP ) {
addMemberRow = rowCount++;
@@ -1325,6 +1318,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
textCell.setTextColor(0xff212121);
if (i == changeNameRow) {
textCell.setText(LocaleController.getString("EditName", R.string.EditName));
} else if (i == compareKeysRow) {
textCell.setText(LocaleController.getString("E2ECompareKeys", R.string.E2ECompareKeys));
} else if (i == startChatRow) {
textCell.setText(LocaleController.getString("NewChat", R.string.NewChat));
} else if (i == settingsNotificationsRow) {
@@ -1351,10 +1346,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (user_id != 0) {
enabled = i == settingsNotificationsRow
|| i == changeNameRow
|| i == compareKeysRow
|| i == startChatRow;
} else if (chat_id != 0) {
enabled = i == settingsNotificationsRow
|| i == changeNameRow
|| i== compareKeysRow
|| i == addMemberRow
|| (i >= firstMemberRow && i <= lastMemberRow);
}
@@ -1381,7 +1378,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return typeEmpty;
} else if (i == sectionRow || i == userSectionRow) {
return typeDivider;
} else if ( i == changeNameRow || i==startChatRow || i == settingsNotificationsRow || i == addMemberRow) {
} else if ( i == changeNameRow || i==compareKeysRow || i==startChatRow || i == settingsNotificationsRow || i == addMemberRow) {
return typeTextCell;
} else if (i >= firstMemberRow && i <= lastMemberRow) {
return typeContactCell;