Note a full end-to-end setup is blocked on https://phabricator.wikimedia.org/T285417, but in the meantime we can trigger pushes manually at https://ios-playground.wmflabs.org/push/.
This encompases the development for these tasks.
1. Add push capability/entitlements in project.
2. Ask UNNotifications framework to `registerForRemoteNotifications` in AppDelegate's `didFinishLaunching`.
3. In `UNUserNotificationCenterDelegate` callbacks, remember device token or failure in some form in memory, it will be used in the next step.
4. Tweak notification settings screen to only have a single toggle to enable or disable permissions. Handle case where user is not logged in, OS registration in step 2 failed, or permissions are in denied state. This screen will likely be tweaked further in https://phabricator.wikimedia.org/T271855, this is just to get end-to-end working.
5. When permissions are allowed in step 4, register device token with PI registration service (https://en.wikipedia.org/w/api.php?action=help&modules=echopushsubscriptions, create command). Handle failure in Notification Settings UI.
6. Upon logout, unregister token with PI service (https://en.wikipedia.org/w/api.php?action=help&modules=echopushsubscriptions, delete command)
7. After launch when device token is set, register with PI service if permissions are enabled in case token has changed. If permissions are not enabled, unregister token.
8. Upon foreground, if permissions are disabled, unregister token with PI service. If permissions are enabled, register token with PI service (may want to check that they were disabled or enabled previously in memory to reduce unnecessary calls.
**Useful documentation**:
https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns
https://developer.apple.com/documentation/usernotifications/asking_permission_to_use_notifications
https://www.mediawiki.org/wiki/Wikimedia_Product_Infrastructure_team/Push_Notifications_Infrastructure
https://wikitech.wikimedia.org/wiki/Push_notifications
https://www.mediawiki.org/wiki/Notifications/Developer_guide/Push#Subscription_registration