GoCarrot/teak-ios

Add data-only push support & implement health check

Closed this issue · 3 comments

https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app

Server:

{
"aps" : {
"content-available" : 1
},
"event": "string event name",
"params": {}
}

On Client we need to add application:didRecieveRemoteNotifications:fetchCompletionHandler: to the Teak instance (method hook already exists. just impl it).

In that method it will look for data-only pushes, and dispatch events based on the event name/params in the dictionary received.

  • Add handler to TeakPushState for the push registration check
    • Call determineCurrentPushStateWithCompletionHandler
    • In the completion handler, call server (no session)
  • Add handler in Teak instance for install tracker
    • Send ping to server (no session)

For iOS we may need to add 'Background Fetch' to make sure we can send the requests off to the server, for both these tasks as well as the Session Duration reporting.

https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/using_background_tasks_to_update_your_app

HOWEVER

I do not expect that we need to add it, as we supposedly have 30 seconds to perform tasks and call completion handler.

Updates:

  • For the "health check"
    • Send back DeviceId + any parameters the server sends us
    • Send back current push state chain

We do not need to enable background mode, however the Apple docs are incorrect; there can be no other items in the aps dictionary besides the content-available item.

Items outside the aps dictionary are fine.