Open johnsmith-gooddollar opened 2 years ago
- for use serviceWorkers with RN we can use library like 'react-native-workers' (https://www.npmjs.com/package/react-native-workers)
we already using RNBackgroundFetch. please check how it implemented does it working and will it be suitable for this task
- we couldn't create more then one serviceWorker because it would rewrite previous. There is one workaround solution to create multiple serviceWorkers: Is it possible to use load webworkers? facebook/create-react-app#1277 (comment)
please look how we could add custom code to the SW generated by the workbox
- the only way to communicate with SW is by messaging, so we can emit messages on wallet events which we listen to and add the appropriate listener inside the worker itself, thus using it as something like a reducer with action types. To implement this, we can use Broadcast Channel API (https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API) or MessageChannel API. But not sure that solution will works correct with foreground state.
i've already done with this: #3766
- possible solution for execute it in background can be next libraries: react-native-background-job react-native-background-task
should be service worker
@johnsmith-gooddollar webworkers are irrelevant we need service worker in any case I suggest to first get Android/iOS working as we already have the boilerplate code for that then start with browser notifications
@alt-a1r @johnsmith-gooddollar @patpedrosa
see: https://stackoverflow.com/a/29750936/6379521
and see https://whatwebcando.today/scheduler.html
My suggestion as mentioned elsewhere is to hold on with web notifications. And in the first phase for web support only claim reminder only for Chrome with the periodicsync api
@sirpy should we proceed with Chrome + periodicsync to implement claim notifications on web ?
discuss with Pat. perhaps as part of goodswap.xyz
no good solution for web at the moment.
@sirpy I've done MVP using Firebase messaging for deliver pushes some time ago. Have you looked onto it ?
Currently we have service worker auto generated by the workbox. It manages web app caching and updating