deviceId and userId are stored in IndexedDB. To avoid slowing down the notification, a Promise is used to perform the query asynchronously passed. The listener can then subscribe to the Promise to get the state, for example:
Because these data are used by the event reporting, I've refactored PusherPushNotifications.reportEvent to reuse the same Promise, to avoid querying IndexedDB twice.
Closes #64
Adds the following state to the service worker onNotificationReceived handler:
instanceId
publishId
deviceId
userId
appInBackground
hasDisplayableContent
hasData
deviceId
anduserId
are stored in IndexedDB. To avoid slowing down the notification, aPromise
is used to perform the query asynchronously passed. The listener can then subscribe to thePromise
to get the state, for example:Because these data are used by the event reporting, I've refactored
PusherPushNotifications.reportEvent
to reuse the samePromise
, to avoid querying IndexedDB twice.