From e84fcd7c94df9e9e1c27cc7a30a8bbb1acaecd68 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 16 Nov 2017 12:02:55 -0500 Subject: [PATCH 1/2] Registration bug also affects other versions of iOS // FREEBIE --- Signal/src/environment/PushRegistrationManager.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Signal/src/environment/PushRegistrationManager.swift b/Signal/src/environment/PushRegistrationManager.swift index 99542b84c..75a5f0d32 100644 --- a/Signal/src/environment/PushRegistrationManager.swift +++ b/Signal/src/environment/PushRegistrationManager.swift @@ -152,15 +152,13 @@ public enum PushRegistrationError: Error { } /** - * work around for iOS11 bug, wherein for users who have disabled notifications - * and background fetch, the AppDelegate will neither succeed nor fail at registering - * for a vanilla push token. + * When users have disabled notifications and background fetch, the system hangs when returning a push token. + * More specifically, after registering for remote notification, the app delegate calls neither + * `didFailToRegisterForRemoteNotificationsWithError` nor `didRegisterForRemoteNotificationsWithDeviceToken` + * This behavior is identical to what you'd see if we hadn't previously registered for user notification settings, though + * in this case we've verified that we *have* properly registered notification settings. */ private var isSusceptibleToFailedPushRegistration: Bool { - // Only affects iOS11 users - guard #available(iOS 11.0, *) else { - return false - } // Only affects users who have disabled both: background refresh *and* notifications guard UIApplication.shared.backgroundRefreshStatus == .denied else { From 607a5cb08ecf1d07b88655a80659d48b2463e6ec Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 16 Nov 2017 12:27:57 -0500 Subject: [PATCH 2/2] Fix typo in re-registration flow // FREEBIE --- Signal/src/environment/OWSPreferences.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Signal/src/environment/OWSPreferences.m b/Signal/src/environment/OWSPreferences.m index 7ce1b9a5a..6e7e66467 100644 --- a/Signal/src/environment/OWSPreferences.m +++ b/Signal/src/environment/OWSPreferences.m @@ -270,8 +270,8 @@ NSString *const OWSPreferencesKeyIOSUpgradeNagVersion = @"iOSUpgradeNagVersion"; - (void)unsetRecordedAPNSTokens { DDLogWarn(@"%@ Forgetting recorded APNS tokens", self.tag); - [self setValue:nil forKey:OWSPreferencesKeyLastRecordedPushToken]; - [self setValue:nil forKey:OWSPreferencesKeyLastRecordedVoipToken]; + [self setValueForKey:OWSPreferencesKeyLastRecordedPushToken toValue:nil]; + [self setValueForKey:OWSPreferencesKeyLastRecordedVoipToken toValue:nil]; } #pragma mark - Logging