Add wallet-backed home page#77
Conversation
…endpoint choice and a Change server bottom sheet when sync fails or timesout.
| final WalletSyncResult result; | ||
| try { | ||
| result = await runner(request); | ||
| result = await runner(request).timeout(timeout); |
There was a problem hiding this comment.
Future.timeout does not cancel the underlying sync; the Isolate.run can continue and persist the wallet DB after this controller marks timeout and releases _inFlight. Since the timeout UI immediately offers “Change server”, a retry can overlap with the old sync for the same wallet. So I think we can move the timeout into the backend/client layer or keep the controller serialized until the original runner is finished/cancelled, and add a retry-after-timeout test covering that overlap.
There was a problem hiding this comment.
Yep, I removed the controller timeout and pushed it into the sync job instead... so _inFlight now stays locked until the real sync attempt finishes, and retries can’t overlap. I also map those near timeout Electrum failures into the same “Change server” UX.
| await selectNetworkEndpoint(ref, network, url); | ||
| if (!context.mounted) return; | ||
| Navigator.of(context).pop(); | ||
| await ref.read(syncActiveWalletTriggerProvider).call(); |
There was a problem hiding this comment.
Small async lifecycle nit: after Navigator.pop(), this bottom sheet widget may be disposed, so using this ref again can be fragile. Could we capture the sync callback before popping, then call the captured function after closing the sheet?
j-kon
left a comment
There was a problem hiding this comment.
This is looking great, nice work on the wallet-backed home page and the sync UX. One tiny lifecycle nit: after Navigator.pop(), the bottom sheet widget may be disposed, so using this ref again can be fragile. Could we capture the sync callback before popping, then call the captured function after closing the sheet?
j-kon
left a comment
There was a problem hiding this comment.
Thanks for addressing my comment
ACK
This pr resolves #5
Replaces the home placeholder with a wallet-backed page that shows balance, sync status, a BTC/sats toggle, and offline gating for Send. It also auto-triggers sync for the current active wallet without retriggering on rebuilds, so the UI reflects the provider state.
To navigate to the Homepage tap on 'Use and Active Wallet' then 'Create a new wallet'.
Note to Reviewers:
Regtest wallets no longer show the sync card on HomePage. Regtest sync depends on local Esplora (localhost:3002), which fails on mobile and was surfacing misleading sync errors. Auto-sync stays off for regtest; Signet/Testnet behavior is unchanged. Pull-to-refresh still works. This is interim until we add a separate Developer Regtest flow with its own backend setup and wallet list.