diff --git a/Signal/src/Storyboard/Main.storyboard b/Signal/src/Storyboard/Main.storyboard index cf072a635..7c24dbcc5 100644 --- a/Signal/src/Storyboard/Main.storyboard +++ b/Signal/src/Storyboard/Main.storyboard @@ -788,7 +788,7 @@ - + @@ -997,29 +997,12 @@ - - - - - - - - - - - - + @@ -1069,7 +1052,6 @@ - diff --git a/Signal/src/ViewControllers/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/PrivacySettingsTableViewController.m index 442cbb0be..525659bd0 100644 --- a/Signal/src/ViewControllers/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/PrivacySettingsTableViewController.m @@ -3,16 +3,17 @@ // #import "PrivacySettingsTableViewController.h" - +#import "BlockListViewController.h" #import "Environment.h" #import "PropertyListPreferences.h" -#import "UIUtil.h" #import "Signal-Swift.h" +#import "UIUtil.h" #import <25519/Curve25519.h> NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { + PrivacySettingsTableViewControllerSectionIndexBlockList, PrivacySettingsTableViewControllerSectionIndexScreenSecurity, PrivacySettingsTableViewControllerSectionIndexCalling, PrivacySettingsTableViewControllerSectionIndexCallKit, @@ -23,6 +24,8 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { @interface PrivacySettingsTableViewController () +@property (nonatomic) UITableViewCell *blocklistCell; + @property (nonatomic) UITableViewCell *enableCallKitCell; @property (nonatomic) UISwitch *enableCallKitSwitch; @@ -60,6 +63,12 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { self.title = NSLocalizedString(@"SETTINGS_PRIVACY_TITLE", @""); + // Block List + self.blocklistCell = [UITableViewCell new]; + self.blocklistCell.textLabel.text + = NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE", @"Label for the block list section of the settings view"); + self.blocklistCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + // CallKit opt-out self.enableCallKitCell = [UITableViewCell new]; self.enableCallKitCell.textLabel.text = NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_TITLE", @"Short table cell label"); @@ -127,6 +136,8 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { switch (section) { + case PrivacySettingsTableViewControllerSectionIndexBlockList: + return 1; case PrivacySettingsTableViewControllerSectionIndexScreenSecurity: return 1; case PrivacySettingsTableViewControllerSectionIndexCalling: @@ -167,6 +178,8 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.section) { + case PrivacySettingsTableViewControllerSectionIndexBlockList: + return self.blocklistCell; case PrivacySettingsTableViewControllerSectionIndexScreenSecurity: return self.enableScreenSecurityCell; case PrivacySettingsTableViewControllerSectionIndexCalling: @@ -209,6 +222,13 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { [tableView deselectRowAtIndexPath:indexPath animated:YES]; switch (indexPath.section) { + case PrivacySettingsTableViewControllerSectionIndexBlockList: { + BlockListViewController *vc = [[BlockListViewController alloc] init]; + NSAssert(self.navigationController != nil, @"Navigation controller must not be nil"); + NSAssert(vc != nil, @"About View Controller must not be nil"); + [self.navigationController pushViewController:vc animated:YES]; + break; + } case PrivacySettingsTableViewControllerSectionIndexHistoryLog: { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION", @"Alert message before user confirms clearing history") diff --git a/Signal/src/ViewControllers/SettingsTableViewController.h b/Signal/src/ViewControllers/SettingsTableViewController.h index b5cc92b14..e7bc2e0ec 100644 --- a/Signal/src/ViewControllers/SettingsTableViewController.h +++ b/Signal/src/ViewControllers/SettingsTableViewController.h @@ -15,7 +15,6 @@ @property (strong, nonatomic) IBOutlet UILabel *linkedDevicesLabel; @property (strong, nonatomic) IBOutlet UILabel *advancedLabel; @property (strong, nonatomic) IBOutlet UILabel *aboutLabel; -@property (strong, nonatomic) IBOutlet UILabel *blockListLabel; @property (strong, nonatomic) IBOutlet UILabel *inviteLabel; @property (strong, nonatomic) IBOutlet UIButton *destroyAccountButton; diff --git a/Signal/src/ViewControllers/SettingsTableViewController.m b/Signal/src/ViewControllers/SettingsTableViewController.m index a182bc032..254b66a50 100644 --- a/Signal/src/ViewControllers/SettingsTableViewController.m +++ b/Signal/src/ViewControllers/SettingsTableViewController.m @@ -15,7 +15,6 @@ #import "PrivacySettingsTableViewController.h" #import "PushManager.h" #import "Signal-Swift.h" -#import "BlockListViewController.h" #define kProfileCellHeight 87.0f #define kStandardCellHeight 44.0f @@ -23,16 +22,12 @@ #define kNumberOfSections 4 #define kRegisteredNumberRow 0 - -typedef enum { - kInviteRow = 0, - kPrivacyRow = 1, - kNotificationRow = 2, - kLinkedDevices = 3, // we don't actually use this, instead we segue via Interface Builder - kAdvancedRow = 4, - kAboutRow = 5, - kBlockListRow = 6, -} kGeneralSectionRows; +#define kInviteRow 0 +#define kPrivacyRow 1 +#define kNotificationRow 2 +#define kLinkedDevices 3 // we don't actually use this, instead we segue via Interface Builder +#define kAdvancedRow 4 +#define kAboutRow 5 #define kNetworkRow 0 #define kUnregisterRow 0 @@ -40,7 +35,7 @@ typedef enum { typedef enum { kRegisteredRows = 1, kNetworkStatusRows = 1, - kGeneralRows = 7, + kGeneralRows = 6, kUnregisterRows = 1, } kRowsForSection; @@ -107,8 +102,6 @@ typedef enum { self.linkedDevicesLabel.text = NSLocalizedString(@"LINKED_DEVICES_TITLE", @"Menu item and navbar title for the device manager"); self.inviteLabel.text = NSLocalizedString(@"SETTINGS_INVITE_TITLE", @"Settings table view cell label"); - self.blockListLabel.text - = NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE", @"Label for the block list section of the settings view"); [self.destroyAccountButton setTitle:NSLocalizedString(@"SETTINGS_DELETE_ACCOUNT_BUTTON", @"") forState:UIControlStateNormal]; @@ -149,6 +142,7 @@ typedef enum { } } + - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; @@ -192,13 +186,6 @@ typedef enum { [self.navigationController pushViewController:vc animated:YES]; break; } - case kBlockListRow: { - BlockListViewController *vc = [[BlockListViewController alloc] init]; - NSAssert(self.navigationController != nil, @"Navigation controller must not be nil"); - NSAssert(vc != nil, @"About View Controller must not be nil"); - [self.navigationController pushViewController:vc animated:YES]; - break; - } default: DDLogError(@"%@ Unhandled row selected at index path: %@", self.tag, indexPath); break; diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 454632654..103edf7ef 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -824,7 +824,7 @@ "SETTINGS_BLOCK_LIST_HEADER_TITLE" = "Blocked Phone Numbers"; /* Label for the block list row of the settings view */ -"SETTINGS_BLOCK_LIST_TITLE" = "Block List"; +"SETTINGS_BLOCK_LIST_TITLE" = "Blocked"; /* User settings section footer, a detailed explanation */ "SETTINGS_BLOCK_ON_IDENITY_CHANGE_DETAIL" = "Requires your approval before communicating with someone who has a new safety number, commonly from a reinstall of Signal.";