Actually use chosen setting

pull/157/head
nielsandriesse 5 years ago
parent 0386b856a1
commit 5c5b28e0d9

@ -61,7 +61,6 @@ static NSTimeInterval launchStartedAt;
// Debug settings // Debug settings
static BOOL isInternalTestVersion = NO; static BOOL isInternalTestVersion = NO;
static BOOL isUsingFullAPNs = YES;
@interface AppDelegate () <UNUserNotificationCenterDelegate> @interface AppDelegate () <UNUserNotificationCenterDelegate>
@ -589,12 +588,10 @@ static BOOL isUsingFullAPNs = YES;
} }
OWSLogInfo(@"Registered for push notifications with token: %@.", deviceToken); OWSLogInfo(@"Registered for push notifications with token: %@.", deviceToken);
BOOL isUsingFullAPNs = [NSUserDefaults.standardUserDefaults boolForKey:@"isUsingFullAPNs"];
if (isUsingFullAPNs) { if (isUsingFullAPNs) {
[LKPushNotificationManager registerWithToken:deviceToken hexEncodedPublicKey:self.tsAccountManager.localNumber]; [LKPushNotificationManager registerWithToken:deviceToken hexEncodedPublicKey:self.tsAccountManager.localNumber];
} else {
[LKPushNotificationManager registerWithToken:deviceToken];
} }
// [self.pushRegistrationManager didReceiveVanillaPushToken:deviceToken];
} }
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
@ -709,6 +706,7 @@ static BOOL isUsingFullAPNs = YES;
- (void)enableBackgroundRefreshIfNecessary - (void)enableBackgroundRefreshIfNecessary
{ {
BOOL isUsingFullAPNs = [NSUserDefaults.standardUserDefaults boolForKey:@"isUsingFullAPNs"];
if (isUsingFullAPNs) { return; } if (isUsingFullAPNs) { return; }
[AppReadiness runNowOrWhenAppDidBecomeReady:^{ [AppReadiness runNowOrWhenAppDidBecomeReady:^{
[UIApplication.sharedApplication setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum]; [UIApplication.sharedApplication setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum];

@ -87,6 +87,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
} }
@objc private func register() { @objc private func register() {
UserDefaults.standard[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView)
TSAccountManager.sharedInstance().didRegister() TSAccountManager.sharedInstance().didRegister()
let homeVC = HomeVC() let homeVC = HomeVC()
navigationController!.setViewControllers([ homeVC ], animated: true) navigationController!.setViewControllers([ homeVC ], animated: true)

Loading…
Cancel
Save