diff options
| author | Adam Soltys <[email protected]> | 2026-06-25 17:02:08 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-25 17:02:08 -0700 |
| commit | 6a94730d92b069344ded846acd8caad6689c2eb5 (patch) | |
| tree | 2f5e8b01bcbc0c32917ed43c4fb70aa7af2b733f /src | |
| parent | 181b1b8c680346e2be6dfa833dac3f23704b8d5e (diff) | |
| download | coinosv3-6a94730d92b069344ded846acd8caad6689c2eb5.tar.gz coinosv3-6a94730d92b069344ded846acd8caad6689c2eb5.zip | |
Celebrate a received payment once; don't re-show after refresh/reopen
Persist the receive-ack the moment the 'Payment received!' screen is shown
(not only on tap), so refreshing or navigating away without tapping won't bring
it back. It still stays visible in the current session until dismissed.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.js | 10 | ||||
| -rw-r--r-- | src/wallet.js | 6 |
2 files changed, 10 insertions, 6 deletions
@@ -626,9 +626,9 @@ async function activateAccount(acc, opts = {}) { try { // Celebration baseline. Opening/importing/switching a wallet (opts.fresh) // baselines to the current frontier, so payments already received before - // opening never trigger the "payment received" screen. A same-session - // refresh keeps the persisted ack, so an unacknowledged celebration - // survives the refresh. + // opening never trigger the "payment received" screen. On a same-session + // refresh we restore the persisted ack — which is advanced the moment the + // celebration is shown, so a payment celebrates once and never reappears. let ack; if (opts.fresh) { ack = wallet.nextReceiveIndex; @@ -1798,6 +1798,10 @@ function receiveTab() { // stays null and we never celebrate. The recency guard additionally ensures an // already-old payment never celebrates when a wallet is opened. if (ui.receiveSeenIndex != null && wallet.nextReceiveIndex > ui.receiveSeenIndex && hasRecentIncoming()) { + // Mark it acknowledged as soon as it's shown — so a refresh or navigating + // away (without tapping) won't bring the celebration back. It stays visible + // this session (ui.receiveSeenIndex is unchanged) until the tap below. + wallet.setReceiveAck(wallet.nextReceiveIndex); let amt = 0; for (let i = ui.receiveSeenIndex; i < wallet.nextReceiveIndex; i++) { const e = wallet._addrInfo(0, i); diff --git a/src/wallet.js b/src/wallet.js index 4e6a0d5..fb9e49e 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -1490,9 +1490,9 @@ export class Wallet { return 'btc-wallet-cache:' + hex.encode(sha256(bytes)).slice(0, 32); } - // The fresh receive index the user has acknowledged (tapped past the - // "payment received" screen for). Persisted so a received payment keeps - // showing the celebration until acknowledged, even across refreshes. + // The fresh receive index the "payment received" screen has been shown for. + // Persisted (and advanced as soon as the celebration appears) so a payment + // celebrates once and never reappears on a refresh or reopen. getReceiveAck() { try { const v = localStorage.getItem(this._cacheKey() + ':ack'); |
