@ -18,12 +18,12 @@ NS_ASSUME_NONNULL_BEGIN
@ interface AdvancedSettingsTableViewController ( )
@ property ( nonatomic ) UITableViewCell * enableCallKit Cell;
@ property ( nonatomic ) UITableViewCell * enableCallKit Privacy Cell;
@ property ( nonatomic ) UITableViewCell * enableLogCell ;
@ property ( nonatomic ) UITableViewCell * submitLogCell ;
@ property ( nonatomic ) UITableViewCell * registerPushCell ;
@ property ( nonatomic ) UISwitch * enableCallKit Switch;
@ property ( nonatomic ) UISwitch * enableCallKit Privacy Switch;
@ property ( nonatomic ) UISwitch * enableLogSwitch ;
@ property ( nonatomic , readonly ) BOOL supportsCallKit ;
@ -58,14 +58,14 @@ typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
[ self useOWSBackButton ] ;
/ / CallKit opt - out
self . enableCallKit Cell = [ UITableViewCell new ] ;
self . enableCallKit Cell. textLabel . text = NSLocalizedString ( @ "SETTINGS_ADVANCED_CALLKIT_ TITLE", @ "Short table cell label ") ;
self . enableCallKit Switch = [ UISwitch new ] ;
[ self . enableCallKit Switch setOn : [ [ Environment getCurrent ] . preferences isCallKit Enabled] ] ;
[ self . enableCallKit Switch addTarget : self
action : @ selector ( didToggleEnableCallKit Switch: )
forControlEvents : UIControlEventTouchUpInside ] ;
self . enableCallKit Cell. accessoryView = self . enableCallKit Switch;
self . enableCallKit Privacy Cell = [ UITableViewCell new ] ;
self . enableCallKit Privacy Cell. textLabel . text = NSLocalizedString ( @ "SETTINGS_ADVANCED_CALLKIT_ PRIVACY_TITLE", @ "Label for ' CallKit privacy' preference ") ;
self . enableCallKit Privacy Switch = [ UISwitch new ] ;
[ self . enableCallKit Privacy Switch setOn : ! [ [ Environment getCurrent ] . preferences isCallKit Privacy Enabled] ] ;
[ self . enableCallKit Privacy Switch addTarget : self
action : @ selector ( didToggleEnableCallKit Privacy Switch: )
forControlEvents : UIControlEventTouchUpInside ] ;
self . enableCallKit Privacy Cell. accessoryView = self . enableCallKit Privacy Switch;
/ / Enable Log
self . enableLogCell = [ [ UITableViewCell alloc ] init ] ;
@ -99,7 +99,7 @@ typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
case AdvancedSettingsTableViewControllerSectionLogging :
return self . enableLogSwitch . isOn ? 2 : 1 ;
case AdvancedSettingsTableViewControllerSectionCalling :
return self . supportsCallKit ? 2 : 1 ;
return self . supportsCallKit ? 1 : 0 ;
case AdvancedSettingsTableViewControllerSectionPushNotifications :
return 1 ;
default :
@ -128,7 +128,7 @@ typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
switch ( settingsSection ) {
case AdvancedSettingsTableViewControllerSectionCalling :
if ( [ self supportsCallKit ] ) {
return NSLocalizedString ( @ "SETTINGS_SECTION_CALL_KIT_ DESCRIPTION", @ "Settings table section footer . ") ;
return NSLocalizedString ( @ "SETTINGS_SECTION_CALL_KIT_ PRIVACY_DESCRIPTION", @ "Explanation of the ' C a l l K i t P r i v a c y ` p r e f e r e n c e . " ) ;
}
default :
return nil ;
@ -151,7 +151,7 @@ typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
switch ( indexPath . row ) {
case 0 :
OWSAssert ( self . supportsCallKit ) ;
return self . enableCallKit Cell;
return self . enableCallKit Privacy Cell;
default :
/ / Unknown cell
OWSAssert ( NO ) ;
@ -205,9 +205,9 @@ typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
[ self . tableView reloadData ] ;
}
- ( void ) didToggleEnableCallKit Switch: ( UISwitch * ) sender {
DDLogInfo ( @ "%@ user toggled call kit pr eference: %@", self.tag, (sender.isOn ? @"ON" : @"OFF"));
[ [ Environment getCurrent ] . preferences setIsCallKit Enabled: sender . isOn ] ;
- ( void ) didToggleEnableCallKit Privacy Switch: ( UISwitch * ) sender {
DDLogInfo ( @ "%@ user toggled call kit pr ivacy pr eference: %@", self.tag, (sender.isOn ? @"ON" : @"OFF"));
[ [ Environment getCurrent ] . preferences setIsCallKit Privacy Enabled: ! sender . isOn ] ;
[ [ Environment getCurrent ] . callService createCallUIAdapter ] ;
}