Add new option to notification settings

This commit is contained in:
Denis Morozov
2017-08-23 12:53:32 +03:00
parent a369933d2b
commit fd10536934
2 changed files with 20 additions and 0 deletions
@@ -58,6 +58,7 @@ enum
enum
{
NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX = 0,
NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT,
NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX,
NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX,
NOTIFICATION_SETTINGS_PIN_UNREAD_INDEX,
@@ -1564,6 +1565,18 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
cell = labelAndSwitchCell;
}
else if (row == NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_show_decrypted_content", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = account.showDecryptedContentInNotifications;
labelAndSwitchCell.mxkSwitch.enabled = account.pushNotificationServiceIsActive;
[labelAndSwitchCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventValueChanged];
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleShowDecodedContent:) forControlEvents:UIControlEventValueChanged];
cell = labelAndSwitchCell;
}
else if (row == NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX)
{
MXKTableViewCell *globalInfoCell = [self getDefaultTableViewCell:tableView];
@@ -2509,6 +2522,12 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
}
}
- (void)toggleShowDecodedContent:(id)sender
{
MXKAccount* account = [MXKAccountManager sharedManager].activeAccounts.firstObject;
account.showDecryptedContentInNotifications = !account.showDecryptedContentInNotifications;
}
- (void)toggleLocalContactsSync:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;