Skip to content

Commit

Permalink
fix: add missing parts for correct Push Notification work
Browse files Browse the repository at this point in the history
  • Loading branch information
ttypic committed Mar 20, 2024
1 parent 0741d8b commit df3c40e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions textile/features.textile
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,8 @@ h3(#activation-state-machine). Activation State Machine
* @(RSH3)@ In platforms that support receiving push notifications, in order to connect the device's push features with Ably's, the library must perform the process described in the following abstract state machine. While this process should be implemented in whatever way better fits the concrete platform, it should be taken into account that its lifetime is that of the _app_ that runs it, which outlives that of the @RestClient@ instance or (typically) the process running the app. This typically forces some kind of on-disk storage to which the state machine's state must be persisted, so that it can be recovered later by new instances and processes running the app triggered by external events.
** @(RSH3a)@ State @NotActivated@ (the initial one).
*** @(RSH3a1)@ On event @CalledDeactivate@:
**** @(RSH3a1a)@ Makes @Push#deactivate@ return or call its callback with no error.
**** @(RSH3a3a)@ If the local device has @deviceIdentityToken@, does the same as @(RSH3d2)@.
**** @(RSH3a3b)@ Otherwise, makes @Push#deactivate@ return or call its callback with no error.
**** @(RSH3a1b)@ Transitions to @NotActivated@.
*** @(RSH3a2)@ On event @CalledActivate@:
**** @(RSH3a2a)@ If the local device has @deviceIdentityToken@, performs a validation of the local DeviceDetails via the following steps. "@(RSH3a2b)@":#RSH3a2b onwards then don't apply.
Expand Down Expand Up @@ -1185,8 +1186,9 @@ h3(#activation-state-machine). Activation State Machine
**** @(RSH3d1b)@ Transitions to @WaitingForNewPushDeviceDetails@.
*** @(RSH3d2)@ On event @CalledDeactivate@:
**** @(RSH3d2a)@ If a custom @deregisterCallback@ was provided to @Push#deactivate@, pass it the local @DeviceDetails@ 's id.
**** @(RSH3d2b)@ Otherwise, make an asynchronous DELETE HTTP request to "/push/deviceRegistrations":/rest-api/#delete-device-registration using the local @DeviceDetails@ 's ID. This operation requires "push device authentication":#push-device-authentication.
**** @(RSH3d2b)@ Otherwise, make an asynchronous DELETE HTTP request to "/push/deviceRegistrations":/rest-api/#delete-device-registration using the local @DeviceDetails@ 's ID. This operation requires "push device authentication":#push-device-authentication without other token or key authentication.
**** @(RSH3d2c)@ Either way, when the registration is done, a @Deregistered@ or @DeregistrationFailed@ event should be fired.
**** @(RSH3d2c1a)@ @Deregistered@ event should be fired if the HTTP request returns a status code in the 2xx range, 401 (unauthorized), or code 40005 (invalid credentials). Otherwise @DeregistrationFailed@ event should be fired.
**** @(RSH3d2d)@ Transitions to @WaitingForDeregistration@.
*** @(RSH3d3)@ On event @GotPushDeviceDetails@ (note that this will only happen on platforms whose push device details, after first set, can change, e. g. FCM's registration token refresh):
**** @(RSH3d3a)@ If a custom @registerCallback@ was provided to @Push#activate@, pass it the local @DeviceDetails@ updated with the push details.
Expand Down

0 comments on commit df3c40e

Please sign in to comment.