daneden / Zeitgeist

👁 An iOS app for keeping an eye on your Vercel deployments

Home Page:http://zeitgeist.daneden.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

daneden opened this issue · comments

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