mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
1dd06a5e6c
* Separate registering an account from registering for push notifications * Allows us to complete registration without prompting user for notification settings. UX Changes ---------- * Automatically keep push tokens in sync on startup. Push tokens *can* change, though they rarely do. It happens more often for people switching between appstore/beta builds. fixes #1174 * Show alert with registration failure * add secret 8-tap debug log gesture to registration flow * Move registration to separate flow * don't see flash of inbox when first launching * show useful error messages when given wrong code / no code * remove background fetch We werent using it, but only relying on a side effect of it which is no longer necessary. Code Changes ------------ * More registration logging. * Install PromiseKit with carthage Our dependencies are not yet framework compatible, so we can't use cocoapods. * Merge preferences util "category" into superclass. The immediate reason for this is Swift interop was assuming optional types were not optional, and exploding when a value was nil. This is clearer anyway, since we were treating it like a subclass, and it was the only thing using the class anyway. * auto-genstrings now searches *.swift (and *.h, which was previously broken) for translateable strings. // FREEBIE
61 lines
2.1 KiB
Objective-C
61 lines
2.1 KiB
Objective-C
//
|
|
// NotificationSettingsOptionsViewController.m
|
|
// Signal
|
|
//
|
|
// Created by Frederic Jacobs on 24/04/15.
|
|
// Copyright (c) 2015 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "NotificationSettingsOptionsViewController.h"
|
|
#import "Environment.h"
|
|
#import "PropertyListPreferences.h"
|
|
|
|
@interface NotificationSettingsOptionsViewController ()
|
|
@property NSArray *options;
|
|
@end
|
|
|
|
@implementation NotificationSettingsOptionsViewController
|
|
|
|
- (void)viewDidLoad {
|
|
self.options = @[ @(NotificationNamePreview), @(NotificationNameNoPreview), @(NotificationNoNameNoPreview) ];
|
|
|
|
[super viewDidLoad];
|
|
}
|
|
|
|
#pragma mark - Table view data source
|
|
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
return 1;
|
|
}
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
return (NSInteger)[self.options count];
|
|
}
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
|
|
reuseIdentifier:@"NotificationSettingsOption"];
|
|
PropertyListPreferences *prefs = [Environment preferences];
|
|
NSUInteger notifType = [[self.options objectAtIndex:(NSUInteger)indexPath.row] unsignedIntegerValue];
|
|
[[cell textLabel] setText:[prefs nameForNotificationPreviewType:notifType]];
|
|
|
|
NotificationType selectedNotifType = [prefs notificationPreviewType];
|
|
|
|
if (selectedNotifType == notifType) {
|
|
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
|
}
|
|
|
|
return cell;
|
|
}
|
|
|
|
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
|
|
return NSLocalizedString(@"NOTIFICATIONS_FOOTER_WARNING", nil);
|
|
}
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
[Environment.preferences
|
|
setNotificationPreviewType:[[self.options objectAtIndex:(NSUInteger)indexPath.row] unsignedIntegerValue]];
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
|
|
@end
|