mirror of https://github.com/oxen-io/session-ios
WIP: Fix hanging registration when background modes disabled
fixes #1329 We must register notification settings earlier to be sure we'll be able to get the users push tokens. We were previously relying on a quirk of background fetch, a feature which we don't *actually* use, wherein it's possible to get push tokens for a user without first prompting them for their notification settings. More on this from UIApplication.h: // Calling this will result in either application:didRegisterForRemoteNotificationsWithDeviceToken: or application:didFailToRegisterForRemoteNotificationsWithError: to be called on the application delegate. // ---> Note: these callbacks will be made only if the application has successfully registered for user notifications with registerUserNotificationSettings:, or if it is enabled for Background App Refresh. - (void)registerForRemoteNotifications NS_AVAILABLE_IOS(8_0); In the previous implementation, if a user had disabled background notifications (e.g. in order to save battery), we were waiting for push tokens that would never come. However, this simple "fix" introduces a UX problem - now we prompt for an alert in the middle of our registration flow. // FREEBIEpull/1/head
parent
bae050480a
commit
f98e57e164
Loading…
Reference in New Issue