mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			70 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Matlab
		
	
		
		
			
		
	
	
			70 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Matlab
		
	
| 
											11 years ago
										 | // | ||
| 
											7 years ago
										 | //  Copyright (c) 2019 Open Whisper Systems. All rights reserved. | ||
| 
											11 years ago
										 | // | ||
|  | 
 | ||
| 
											10 years ago
										 | #import "NotificationSettingsOptionsViewController.h" | ||
| 
											7 years ago
										 | #import "Session-Swift.h" | ||
| 
											8 years ago
										 | #import "SignalApp.h" | ||
| 
											5 years ago
										 | #import <SessionMessagingKit/Environment.h> | ||
| 
											5 years ago
										 | #import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h> | ||
| 
											11 years ago
										 | 
 | ||
|  | @implementation NotificationSettingsOptionsViewController | ||
|  | 
 | ||
| 
											8 years ago
										 | - (void)viewDidLoad | ||
|  | { | ||
| 
											7 years ago
										 |     [super viewDidLoad]; | ||
|  |      | ||
| 
											8 years ago
										 |     [self updateTableContents]; | ||
| 
											5 years ago
										 | 
 | ||
| 
											5 years ago
										 |     [LKViewControllerUtilities setUpDefaultSessionStyleForVC:self withTitle:NSLocalizedString(@"Content", @"") customBackButton:NO]; | ||
| 
											6 years ago
										 |     self.tableView.backgroundColor = UIColor.clearColor; | ||
| 
											11 years ago
										 | } | ||
|  | 
 | ||
| 
											8 years ago
										 | #pragma mark - Table Contents | ||
| 
											11 years ago
										 | 
 | ||
| 
											8 years ago
										 | - (void)updateTableContents | ||
|  | { | ||
|  |     OWSTableContents *contents = [OWSTableContents new]; | ||
| 
											11 years ago
										 | 
 | ||
| 
											8 years ago
										 |     __weak NotificationSettingsOptionsViewController *weakSelf = self; | ||
| 
											11 years ago
										 | 
 | ||
| 
											8 years ago
										 |     OWSTableSection *section = [OWSTableSection new]; | ||
| 
											6 years ago
										 |     // section.footerTitle = NSLocalizedString(@"NOTIFICATIONS_FOOTER_WARNING", nil); | ||
| 
											10 years ago
										 | 
 | ||
| 
											7 years ago
										 |     OWSPreferences *prefs = Environment.shared.preferences; | ||
| 
											11 years ago
										 |     NotificationType selectedNotifType = [prefs notificationPreviewType]; | ||
| 
											8 years ago
										 |     for (NSNumber *option in | ||
|  |         @[ @(NotificationNamePreview), @(NotificationNameNoPreview), @(NotificationNoNameNoPreview) ]) { | ||
|  |         NotificationType notificationType = (NotificationType)option.intValue; | ||
|  | 
 | ||
| 
											7 years ago
										 |         [section addItem:[OWSTableItem | ||
|  |                              itemWithCustomCellBlock:^{ | ||
|  |                                  UITableViewCell *cell = [OWSTableItem newCell]; | ||
| 
											6 years ago
										 |                                  cell.tintColor = LKColors.accent; | ||
| 
											7 years ago
										 |                                  [[cell textLabel] setText:[prefs nameForNotificationPreviewType:notificationType]]; | ||
|  |                                  if (selectedNotifType == notificationType) { | ||
|  |                                      cell.accessoryType = UITableViewCellAccessoryCheckmark; | ||
|  |                                  } | ||
| 
											7 years ago
										 |                                  cell.accessibilityIdentifier | ||
| 
											7 years ago
										 |                                      = ACCESSIBILITY_IDENTIFIER_WITH_NAME(NotificationSettingsOptionsViewController, | ||
| 
											7 years ago
										 |                                          NSStringForNotificationType(notificationType)); | ||
| 
											7 years ago
										 |                                  return cell; | ||
|  |                              } | ||
| 
											8 years ago
										 |                              actionBlock:^{ | ||
|  |                                  [weakSelf setNotificationType:notificationType]; | ||
|  |                              }]]; | ||
| 
											11 years ago
										 |     } | ||
| 
											8 years ago
										 |     [contents addSection:section]; | ||
| 
											10 years ago
										 | 
 | ||
| 
											8 years ago
										 |     self.contents = contents; | ||
| 
											11 years ago
										 | } | ||
|  | 
 | ||
| 
											8 years ago
										 | - (void)setNotificationType:(NotificationType)notificationType | ||
|  | { | ||
| 
											7 years ago
										 |     [Environment.shared.preferences setNotificationPreviewType:notificationType]; | ||
| 
											8 years ago
										 | 
 | ||
| 
											11 years ago
										 |     [self.navigationController popViewControllerAnimated:YES]; | ||
|  | } | ||
|  | 
 | ||
|  | @end |