diff options
| -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'); |
