This spike is for the iOS engineers to dig on some questions around the receipt of notifications:
- Confirm how the server manipulates notifications before delivering. Root job notifications are deduplicated with only the latest instance showing, but what types of notifications are root? Confirm other notifications are batched and sent individually at a random time.
- Sidenote: will we do any OS-supported grouping and is that possible? (this seems doubtful, but just to confirm).
Answer: applicable comments are here, here and here. Sounds like we don't need to worry about root details, but we will not be able to assume a 1 to 1 mapping between the push notification received and objects in the notifications API response.
Sidenote Answer: Actually I think we could via the Notification Service extension. When constructing the UNMutableNotificationContent in didReceive(_ request: UNNotificationRequest), we should be able to assign a threadIdentifier at this point.
- Will deduping always match the echo read notifications API? I.e. push notification sends one deduped notificaation, to represent for example “7 posts were made to your talk page”. When then fetching the push notification read API, do we get 7 different notification objects? Or are they grouped there into one as well?
Answer: No, we can not assume we'll receive 4 push notifications and read 4 new push notifications from the notifications API. We need to be able to handle a push notification with no new content to read, as well as a push notification with multiple new notification types to read. (spun off https://phabricator.wikimedia.org/T285353 and https://phabricator.wikimedia.org/T285348 for further discussion on these).
- How do we determine the unread push notification content to display in a push?
- Should we do coalescing on our end, i.e. get all new notifications from the API and combine them into one notification to read? This runs the risk of there being a followup push without anything new to read because we already combined it in a previous notification display. We’d need generic text for this case since we can't suppress the OS notification. We would also need design input on the wording and quick actions for a combined notification.
- OR do we pull only the first new notification from the API and display that? There’s a risk here in that we’re relying on the push notification service to send follow up pushes for every notification that returns from the notifications API.
Answer: we need to be able to display a notification with no new data (https://phabricator.wikimedia.org/T285353), and we either combine the content of multiple notification types into one push content (without quick actions), or schedule followup local notifications for the additional unread notifications (to be explored in https://phabricator.wikimedia.org/T285348)
- There are 20 different notification types, all of which the user can enable and receive in the app via changing settings on Desktop. How do we handle undesigned notifications? Do we have a very plain version that asks them to go to desktop to view?
Answer: We either design for all notification types, or consider disabling the unsupported checkboxes in Desktop (see https://phabricator.wikimedia.org/T284238#7138541). Update: there's a 3rd option, which is that we add very default/generic handling for any notification type the app doesn't recognize, which should catch these extra types. (to be done in https://phabricator.wikimedia.org/T287033)
