mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
80e5f281c6
// FREEBIE
54 lines
1.7 KiB
Objective-C
54 lines
1.7 KiB
Objective-C
//
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "NotificationSettingsOptionsViewController.h"
|
|
#import "Environment.h"
|
|
|
|
@implementation NotificationSettingsOptionsViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[self updateTableContents];
|
|
}
|
|
|
|
#pragma mark - Table Contents
|
|
|
|
- (void)updateTableContents
|
|
{
|
|
OWSTableContents *contents = [OWSTableContents new];
|
|
|
|
__weak NotificationSettingsOptionsViewController *weakSelf = self;
|
|
|
|
OWSTableSection *section = [OWSTableSection new];
|
|
section.footerTitle = NSLocalizedString(@"NOTIFICATIONS_FOOTER_WARNING", nil);
|
|
|
|
OWSPreferences *prefs = [Environment preferences];
|
|
NotificationType selectedNotifType = [prefs notificationPreviewType];
|
|
for (NSNumber *option in
|
|
@[ @(NotificationNamePreview), @(NotificationNameNoPreview), @(NotificationNoNameNoPreview) ]) {
|
|
NotificationType notificationType = (NotificationType)option.intValue;
|
|
|
|
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{
|
|
UITableViewCell *cell = [UITableViewCell new];
|
|
[[cell textLabel] setText:[prefs nameForNotificationPreviewType:notificationType]];
|
|
if (selectedNotifType == notificationType) {
|
|
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
|
}
|
|
return cell;
|
|
}
|
|
actionBlock:^{
|
|
[weakSelf setNotificationType:notificationType];
|
|
}]];
|
|
}
|
|
[contents addSection:section];
|
|
|
|
self.contents = contents;
|
|
}
|
|
|
|
- (void)setNotificationType:(NotificationType)notificationType
|
|
{
|
|
[Environment.preferences setNotificationPreviewType:notificationType];
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
|
|
@end
|