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

Persist Data on Android #258

Closed
KoalaSat opened this issue Sep 28, 2022 · 1 comment · Fixed by #274
Closed

Persist Data on Android #258

KoalaSat opened this issue Sep 28, 2022 · 1 comment · Fixed by #274
Assignees
Labels
⚡Eligible for Sats ⚡ This issue or pull request rewards bitcoin enhancement 🆙 New feature or request

Comments

@KoalaSat
Copy link
Member

KoalaSat commented Sep 28, 2022

Is your feature request related to a problem? Please describe.
As part of the Android first functional apk, we want to be able to store data as we do with cookies on web, but using Android's persistent storage.

Describe the solution you'd like
The same way we implementedApiWebClient/ApiNativeClient, we must create:

  • SystemWebClient: It allows to get/write/delete data from cookies
  • SystemNativeClient: It allows to get/write/delete data from Android's persistent storage.
flowchart LR
    SystemClient <--> SystemWebClient
    SystemClient <--> SystemNativeClient
    SystemNativeClient <--> react-native
    react-native <--> PersistedStorage
    SystemWebClient <--> Cookies
Loading

Describe alternatives you've considered
Because of this react-native-webview/react-native-webview#2643 using cookies on WebView won't work

Additional context
Keep in mind this message structure is for HTTP requests https://github.com/Reckless-Satoshi/robosats/pull/247/files#diff-cc3020823102c0ca6d5e5f5b49c0b9eecdb94b3b51cb89cafdc754b8b777ca87R14 we must create an different structure for the system actions.

Watch out! with the Native client, this data needs to be obtained through Promises, this will require to change a lot of logic on the app, which right now assumes the way to obtain cookies is synchronous.

@Reckless-Satoshi
Copy link
Collaborator

Reckless-Satoshi commented Sep 28, 2022

Hey KoalaSat,

Watch out! with the Native client, this data needs to be obtained through Promises, this will require to change a lot of logic on the app, which right now assumes the way to obtain cookies is synchronous.

Indeed, there is quite a few checks the app performs synchronously in several components to detect whether the user has an active robot. It would have to be adapted.

I think this approach is perfect. Once the SystemWebClient / SystemNativeClient libraries are in place, there is a lot of functionality that can be extracted from them on top to just cookies. For example have persistent user settings: dark/light mode, language, fontSize (UI size), etc.

The approach seems great to be extended in the future with a SystemNodeClient to allow for persistent storage in the node app (e.g., Umbrel).

This and #257 can be combined into a single rewarded task. Let's put a little incentive on it of ⚡600 K Sats⚡. I am assigning you.

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

Successfully merging a pull request may close this issue.

2 participants