Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add background push-notification on Android App #619

Open
Reckless-Satoshi opened this issue May 23, 2023 · 2 comments
Open

Add background push-notification on Android App #619

Reckless-Satoshi opened this issue May 23, 2023 · 2 comments
Labels
⚡Eligible for Sats ⚡ This issue or pull request rewards bitcoin enhancement 🆙 New feature or request

Comments

@Reckless-Satoshi
Copy link
Collaborator

Reckless-Satoshi commented May 23, 2023

Is your feature request related to a problem? Please describe.
The Android app is torified and, while on the foreground, is continuously refreshing the current order. However, when in the background the code running in the webview pauses and the order stops refreshing.

The Android app is the perfect notification system for robosats as it is fully private and secure. Any other alternative (firebase, telegra, etc has very negative impact to privacy).

Describe the solution you'd like
Ideally, we should be able to run a background process that is not killed by Android and that will notify users on order status changes. I think react-native-background-actions and react-native-notifications might be good packages for this task.

The order is currently refreshing on our web js. This means we will probably need to move this chunk inside of a new systemClient method that fetches order status as usual if the app is ran in the browser, but instead, fetches order status from the parent react-native wrapper if the app is running within the Android webview app (and triggers the notifications if needed).

Additional context

This task is rewarded with ⚡ 800K Sats ⚡

@Reckless-Satoshi Reckless-Satoshi added enhancement 🆙 New feature or request ⚡Eligible for Sats ⚡ This issue or pull request rewards bitcoin labels May 23, 2023
@ghost
Copy link

ghost commented Jun 17, 2023

Short update on notifications.

Looks like react-native-notifications doesn't support local notifications on Android - https://github.com/wix/react-native-notifications/blob/c877f54c8a8df713536479a2cdf740a11be966ce/README.md?plain=1#L38

It also looks like react-native-push-notifications isn't really maintained anymore - last commit was 2 years ago and maintainer says he has stopped.

"notifee" seems to be the new kid on the block and actively maintained so I'll be evaluating that. It has a paid for vibe but is FOSS as of September (Apache)

https://github.com/invertase/notifee

@ghost
Copy link

ghost commented Jun 27, 2023

Update: will be using react-native-background-actions for the background order status polling.

Current thinking:

  • The background service runs in its own HeadlessJS context, and the code must reside in /mobile i.e. the React Native project
  • However, the polling frequencies are currently defined in frontend/src/contexts/AppContext.ts#L38
  • Since an order could undergo multiple state changes while the app is backgrounded, the background service needs to be aware of the dynamic polling frequencies.
  • As far as I can tell, this is the first time that logic (at the very least this table of polling constants, possibly more) needs to be shared across both the React App and the React Native subprojects
  • Currently experimenting with a /shared top level folder for this purpose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡Eligible for Sats ⚡ This issue or pull request rewards bitcoin enhancement 🆙 New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant