square/SuperDelegate

Should not need to re-request UserNotification permissions on every WillEnterForeground

Closed this issue · 2 comments

dfed commented

We should be able just use currentUserNotificationSettings. Not re-requesting will reduce noise on the API, and more over currentUserNotificationSettings is known to be more reliable than the notification settings passed down into application(_:didRegister:).

Our re-request is a holdover from iOS 7, e.g the days before currentUserNotificationSettings existed.

Hmm, do you mean lines 146-153 in SuperDelegate+UserNotifications.swift. Cause an actual re-requesting does not happen anymore, or am I mistaken?

dfed commented

We call requestUserNotificationPermissionsIfPreviouslyRegistered() every time the app enters the foreground in order to keep our notification permissions up to date. Instead, we should just directly call didReceive(userNotificationPermissions:preferredPermissions:) using currentUserNotificationSettings when the app enters the foreground. I also believe that our comment saying that currentUserNotificationSettings was unreliable only applied to beta OS versions. I do not remember seeing reports that that was unreliable in GM software.