Warn explicitly that your addressbook's emails are uploaded for discovering matrix IDs if you enable that permission (#602)

* Settings: Add "LOCAL CONTACTS" > "Use emails to discover users" toggle button

Related to #551

* Users discovery: Warn explicitly that your addressbook's emails are uploaded for discovering matrix IDs if you enable that permission #551.

* FR keyboard typo
This commit is contained in:
manuroe
2016-09-12 09:46:23 +02:00
committed by GitHub
parent 45f52d3422
commit d571de0b73
4 changed files with 78 additions and 14 deletions
+49 -7
View File
@@ -31,10 +31,11 @@
#define SETTINGS_SECTION_USER_SETTINGS_INDEX 1
#define SETTINGS_SECTION_NOTIFICATIONS_SETTINGS_INDEX 2
#define SETTINGS_SECTION_IGNORED_USERS_INDEX 3
#define SETTINGS_SECTION_ADVANCED_INDEX 4
#define SETTINGS_SECTION_OTHER_INDEX 5
#define SETTINGS_SECTION_LABS_INDEX 6
#define SETTINGS_SECTION_COUNT 6 // Not 7 because the LABS section is currently hidden
#define SETTINGS_SECTION_CONTACTS_INDEX 4
#define SETTINGS_SECTION_ADVANCED_INDEX 5
#define SETTINGS_SECTION_OTHER_INDEX 6
#define SETTINGS_SECTION_LABS_INDEX 7
#define SETTINGS_SECTION_COUNT 7 // Not 8 because the LABS section is currently hidden
#define NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX 0
#define NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX 1
@@ -46,6 +47,9 @@
//#define NOTIFICATION_SETTINGS_CALL_INVITATION_INDEX 6
#define NOTIFICATION_SETTINGS_COUNT 2
#define CONTACTS_SETTINGS_ENABLE_LOCAL_CONTACTS_SYNC 0
#define CONTACTS_SETTINGS_COUNT 1
#define OTHER_VERSION_INDEX 0
#define OTHER_TERM_CONDITIONS_INDEX 1
#define OTHER_PRIVACY_INDEX 2
@@ -570,6 +574,10 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
count = 0;
}
}
else if (section == SETTINGS_SECTION_CONTACTS_INDEX)
{
count = CONTACTS_SETTINGS_COUNT;
}
else if (section == SETTINGS_SECTION_ADVANCED_INDEX)
{
count = 1;
@@ -830,9 +838,6 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
}
else if (section == SETTINGS_SECTION_NOTIFICATIONS_SETTINGS_INDEX)
{
// MXPushRule *rule;
if (row == NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* enableAllCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
@@ -876,6 +881,20 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
cell = privacyPolicyCell;
}
else if (section == SETTINGS_SECTION_CONTACTS_INDEX)
{
if (row == CONTACTS_SETTINGS_ENABLE_LOCAL_CONTACTS_SYNC)
{
MXKTableViewCellWithLabelAndSwitch* enableAllCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
enableAllCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_contacts_discover_matrix_users_with_local_emails", @"Vector", nil);
enableAllCell.mxkSwitch.on = [MXKAppSettings standardAppSettings].syncLocalContacts;
[enableAllCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[enableAllCell.mxkSwitch addTarget:self action:@selector(toggleLocalContactsSync:) forControlEvents:UIControlEventTouchUpInside];
cell = enableAllCell;
}
}
else if (section == SETTINGS_SECTION_ADVANCED_INDEX)
{
MXKTableViewCell *configCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCell defaultReuseIdentifier]];
@@ -1035,6 +1054,10 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
// Hide this section
return nil;
}
else if (section == SETTINGS_SECTION_CONTACTS_INDEX)
{
return NSLocalizedStringFromTable(@"settings_contacts", @"Vector", nil);
}
else if (section == SETTINGS_SECTION_ADVANCED_INDEX)
{
return NSLocalizedStringFromTable(@"settings_advanced", @"Vector", nil);
@@ -1278,6 +1301,25 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
}
}
- (void)toggleLocalContactsSync:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
if (switchButton.on)
{
[MXKContactManager requestUserConfirmationForLocalContactsSyncInViewController:self completionHandler:^(BOOL granted) {
[MXKAppSettings standardAppSettings].syncLocalContacts = granted;
switchButton.on = granted;
}];
}
else
{
[MXKAppSettings standardAppSettings].syncLocalContacts = NO;
switchButton.on = NO;
}
}
- (void)toggleSendCrashReport:(id)sender
{
BOOL enable = [[NSUserDefaults standardUserDefaults] boolForKey:@"enableCrashReport"];