Skip to content

Commit

Permalink
Add in-code documentation on user state observer
Browse files Browse the repository at this point in the history
* Add a callout on the usage of the user state observer.
* App developers should be checking the `externalId` when they retreive the `onesignalId`. This is to make sure they are grabbing the onesignalId for the user that they expect.
  • Loading branch information
nan-li committed Dec 11, 2023
1 parent 813933c commit 06ab04a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ import OneSignalNotifications
var pushSubscription: OSPushSubscription { get }
var onesignalId: String? { get }
var externalId: String? { get }
// User State Observer
/**
Add an observer to the user state, allowing the provider to be notified when the user state has changed.
Important: When using the observer to retrieve the `onesignalId`, check the `externalId` as well to confirm the values are associated with the expected user.
*/
func addObserver(_ observer: OSUserStateObserver)
func removeObserver(_ observer: OSUserStateObserver)
// Aliases
Expand Down

0 comments on commit 06ab04a

Please sign in to comment.