HomePhabricator

[Cashtab] Use capacitor to build an android app

Description

[Cashtab] Use capacitor to build an android app

Summary:
Extend storage API to also handle android capacitor storage. Init capacitor app with android.

This code is mostly generated, but there are some manual edits in the android/ dir

  1. Camera permissions in the manifest
  2. main activity file is customized so the view is not edge-to-edge, i.e. we keep below the status bar

I am assuming the defaults in the generated .gitignores in the android directory are sensible. It seems like we do need a lot of these files in the repo as they could be expected to change, e.g. the camera permissions in the manifest, the main activity file, the various asset files used for splash screens and logos.

Going forward, changes would not be expected to impact so many files.

Note on storage
Originally I looked at the Preferences API, which is good for simple key value storage. However it is not recommended for a lot of storage (i.e. not really more than 1 mb).

Cashtab storage is simple key value. However with token caching, transaction history, and the ability to create an unlimited number of wallets, it could easily exceed 1mb. So, I refactored to use sqlite.

Sqlite is ... overkill for Cashtab's key value storage. But it is not expected to slow down the app at larger sizes in the way that Preferences could. Going forward...well sqlite is just way better than key value storage. Could make the app way better, store all tx history, better queries, etc. Apparently there are some ways to use sqlite in a webapp too, using wasm libs. But this kind of optimization would be for another time.

For now, we use key value store so that there is no difference in how storage is written / accessed between any supported platforms.

Test Plan:
./start-android.sh

Need android studio and a lot of patience to get that working. But if everything is set up, then plugging your android phone into your laptop with usb debug enabled and running, this command should pull up the app. camera scan should work, app should look same as the webapp. can check logs (another android studio exercise but doable) to confirm it is on android storage.

Known issues

  1. The faucet claims do not work (recaptcha only works for cashtab.com)
  2. May see a splash screen before qr scanner loads
  3. Some style issues, screen width issues, android vs web styling

I think it's worth landing this now. Those issues can be cleaned up in the time it will take to get an approved Play Store account. And, even with the issues, I think the app would be worth publishing as-is.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18493

Details

Provenance
bytesofmanAuthored on Aug 13 2025, 21:32
bytesofmanPushed on Aug 18 2025, 22:30
Reviewer
Restricted Project
Differential Revision
D18493: [Cashtab] Use capacitor to build an android app
Parents
rABCa214ff8662ab: [Cashtab] Improve handling of tx finality status updates
Branches
Unknown
Tags
Unknown