daneden / Zeitgeist

👁 An iOS app for keeping an eye on your Vercel deployments
http://zeitgeist.daneden.me
Apache License 2.0
190 stars 7 forks source link

APNS registration isn't always successful on long-lived sessions #80

Closed daneden closed 1 year ago

daneden commented 1 year ago

As documented in #79, sometimes notifications aren't always successfully set up. The current workaround involves restarting the app, which forces registration with APNS if it hasn't already happened.

I should investigate the notification registration process when notifications are first enabled from a project's settings to ensure it happens as expected. There should be two points where registration is attempted:

  1. When first opening the app a. AppDelegate calls registerForRemoteNotifications b. didRegisterForRemoteNotificationsWithDeviceToken is called, mapping over authenticated accounts and attempts saving them in the Zeitgeist “postal service” remote database against the device token
  2. When enabling notifications (this is where the bug is) a. The requestAuthorization method ought to re-trigger remote notification registration