From e58de07af7d12f382f3fcff34f1921769ca3b519 Mon Sep 17 00:00:00 2001 From: Thomas Guillet Date: Thu, 1 Dec 2016 19:27:34 +0100 Subject: [PATCH] Prevent going to the "Background Notifications" when tapping "Notification Sounds" --- .../NotificationSettingsViewController.m | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Signal/src/view controllers/NotificationSettingsViewController.m b/Signal/src/view controllers/NotificationSettingsViewController.m index 3a7b83457..d96ff3727 100644 --- a/Signal/src/view controllers/NotificationSettingsViewController.m +++ b/Signal/src/view controllers/NotificationSettingsViewController.m @@ -12,6 +12,8 @@ #import "NotificationSettingsOptionsViewController.h" #import "PropertyListPreferences.h" +#define kNotificationOptionSection 0 + @interface NotificationSettingsViewController () @property NSArray *notificationsSections; @@ -62,7 +64,7 @@ } PropertyListPreferences *prefs = Environment.preferences; - if (indexPath.section == 0) { + if (indexPath.section == kNotificationOptionSection) { NotificationType notifType = [prefs notificationPreviewType]; NSString *detailString = [prefs nameForNotificationPreviewType:notifType]; @@ -90,10 +92,26 @@ [Environment.preferences setSoundInForeground:sender.on]; } +- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath { + switch (indexPath.section) { + case kNotificationOptionSection: { + return indexPath; + } + default: { + return nil; + } + } +} + - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NotificationSettingsOptionsViewController *vc = - [[NotificationSettingsOptionsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.navigationController pushViewController:vc animated:YES]; + switch (indexPath.section) { + case kNotificationOptionSection: { + NotificationSettingsOptionsViewController *vc = + [[NotificationSettingsOptionsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + } } - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {