Combine callkit sections

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent b371e627c4
commit 6aa6f4895b

@ -16,8 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) {
PrivacySettingsTableViewControllerSectionIndexScreenSecurity, PrivacySettingsTableViewControllerSectionIndexScreenSecurity,
PrivacySettingsTableViewControllerSectionIndexCalling, PrivacySettingsTableViewControllerSectionIndexCalling,
PrivacySettingsTableViewControllerSectionIndexCallKitEnabled, PrivacySettingsTableViewControllerSectionIndexCallKit,
PrivacySettingsTableViewControllerSectionIndexCallKitPrivacy,
PrivacySettingsTableViewControllerSectionIndexHistoryLog, PrivacySettingsTableViewControllerSectionIndexHistoryLog,
PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange, PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange,
PrivacySettingsTableViewControllerSectionIndex_Count // meta section to track how many sections PrivacySettingsTableViewControllerSectionIndex_Count // meta section to track how many sections
@ -135,10 +134,11 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) {
return 1; return 1;
case PrivacySettingsTableViewControllerSectionIndexCalling: case PrivacySettingsTableViewControllerSectionIndexCalling:
return 1; return 1;
case PrivacySettingsTableViewControllerSectionIndexCallKitEnabled: case PrivacySettingsTableViewControllerSectionIndexCallKit:
return [UIDevice currentDevice].supportsCallKit ? 1 : 0; if (![UIDevice currentDevice].supportsCallKit) {
case PrivacySettingsTableViewControllerSectionIndexCallKitPrivacy: return 0;
return ([UIDevice currentDevice].supportsCallKit && [[Environment getCurrent].preferences isCallKitEnabled]) ? 1 : 0; }
return [Environment getCurrent].preferences.isCallKitEnabled ? 2 : 1;
case PrivacySettingsTableViewControllerSectionIndexHistoryLog: case PrivacySettingsTableViewControllerSectionIndexHistoryLog:
return 1; return 1;
case PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange: case PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange:
@ -156,15 +156,10 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) {
case PrivacySettingsTableViewControllerSectionIndexCalling: case PrivacySettingsTableViewControllerSectionIndexCalling:
return NSLocalizedString(@"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE_DETAIL", return NSLocalizedString(@"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE_DETAIL",
@"User settings section footer, a detailed explanation"); @"User settings section footer, a detailed explanation");
case PrivacySettingsTableViewControllerSectionIndexCallKitEnabled: case PrivacySettingsTableViewControllerSectionIndexCallKit:
return ([UIDevice currentDevice].supportsCallKit return ([UIDevice currentDevice].supportsCallKit
? NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_DESCRIPTION", @"Settings table section footer.") ? NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_DESCRIPTION", @"Settings table section footer.")
: nil); : nil);
case PrivacySettingsTableViewControllerSectionIndexCallKitPrivacy:
return (([UIDevice currentDevice].supportsCallKit && [[Environment getCurrent].preferences isCallKitEnabled])
? NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_PRIVACY_DESCRIPTION",
@"Explanation of the 'CallKit Privacy` preference.")
: nil);
case PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange: case PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange:
return NSLocalizedString( return NSLocalizedString(
@"SETTINGS_BLOCK_ON_IDENITY_CHANGE_DETAIL", @"User settings section footer, a detailed explanation"); @"SETTINGS_BLOCK_ON_IDENITY_CHANGE_DETAIL", @"User settings section footer, a detailed explanation");
@ -179,10 +174,13 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) {
return self.enableScreenSecurityCell; return self.enableScreenSecurityCell;
case PrivacySettingsTableViewControllerSectionIndexCalling: case PrivacySettingsTableViewControllerSectionIndexCalling:
return self.callsHideIPAddressCell; return self.callsHideIPAddressCell;
case PrivacySettingsTableViewControllerSectionIndexCallKitEnabled: case PrivacySettingsTableViewControllerSectionIndexCallKit:
return self.enableCallKitCell; switch (indexPath.row) {
case PrivacySettingsTableViewControllerSectionIndexCallKitPrivacy: case 0:
return self.enableCallKitPrivacyCell; return self.enableCallKitCell;
case 1:
return self.enableCallKitPrivacyCell;
}
case PrivacySettingsTableViewControllerSectionIndexHistoryLog: case PrivacySettingsTableViewControllerSectionIndexHistoryLog:
return self.clearHistoryLogCell; return self.clearHistoryLogCell;
case PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange: case PrivacySettingsTableViewControllerSectionIndexBlockOnIdentityChange:
@ -265,6 +263,7 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) {
- (void)didToggleEnableCallKitSwitch:(UISwitch *)sender { - (void)didToggleEnableCallKitSwitch:(UISwitch *)sender {
DDLogInfo(@"%@ user toggled call kit preference: %@", self.tag, (sender.isOn ? @"ON" : @"OFF")); DDLogInfo(@"%@ user toggled call kit preference: %@", self.tag, (sender.isOn ? @"ON" : @"OFF"));
[[Environment getCurrent].preferences setIsCallKitEnabled:sender.isOn]; [[Environment getCurrent].preferences setIsCallKitEnabled:sender.isOn];
// rebuild callUIAdapter since CallKit vs not changed.
[[Environment getCurrent].callService createCallUIAdapter]; [[Environment getCurrent].callService createCallUIAdapter];
[self.tableView reloadData]; [self.tableView reloadData];
} }

@ -833,7 +833,7 @@
"SETTINGS_NOTIFICATIONS" = "Notifications"; "SETTINGS_NOTIFICATIONS" = "Notifications";
/* Label for 'CallKit privacy' preference */ /* Label for 'CallKit privacy' preference */
"SETTINGS_PRIVACY_CALLKIT_PRIVACY_TITLE" = "Show Names & Numbers"; "SETTINGS_PRIVACY_CALLKIT_PRIVACY_TITLE" = "Show Name & Number";
/* Short table cell label */ /* Short table cell label */
"SETTINGS_PRIVACY_CALLKIT_TITLE" = "iOS Call Integration"; "SETTINGS_PRIVACY_CALLKIT_TITLE" = "iOS Call Integration";
@ -851,7 +851,7 @@
"SETTINGS_SCREEN_SECURITY_DETAIL" = "Prevent Signal previews from appearing in the app switcher."; "SETTINGS_SCREEN_SECURITY_DETAIL" = "Prevent Signal previews from appearing in the app switcher.";
/* Settings table section footer. */ /* Settings table section footer. */
"SETTINGS_SECTION_CALL_KIT_DESCRIPTION" = "Show Signal calls on your lock screen and in the system's call history. If iCloud is enabled, call history will be shared with Apple."; "SETTINGS_SECTION_CALL_KIT_DESCRIPTION" = "iOS Call Integration shows Signal calls on your lock screen and in the system's call history. If iCloud is enabled, call history will be shared with Apple. You may optionally show your contact's name and number.";
/* Explanation of the 'CallKit Privacy` preference. */ /* Explanation of the 'CallKit Privacy` preference. */
"SETTINGS_SECTION_CALL_KIT_PRIVACY_DESCRIPTION" = "If you show the names and phone numbers of incoming callers in CallKit, this information will appear in your phone's call history and will be synced to your iCloud account."; "SETTINGS_SECTION_CALL_KIT_PRIVACY_DESCRIPTION" = "If you show the names and phone numbers of incoming callers in CallKit, this information will appear in your phone's call history and will be synced to your iCloud account.";

Loading…
Cancel
Save