diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-12 16:39:55 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-12 16:39:55 +0100 |
commit | b5a4bcb247ec94ee99ca83c068d660574a36a0d7 (patch) | |
tree | b6fe2b9aebc35f342f730a776ec9a50eb480caa6 /src/wallet.ts | |
parent | 1bcc5022c27fff2c28c38b3db12ac353cc7d3481 (diff) |
show notification dot when balance changes (#5214)
Diffstat (limited to 'src/wallet.ts')
-rw-r--r-- | src/wallet.ts | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/wallet.ts b/src/wallet.ts index 5b658de85..9e8eb3f3e 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -247,6 +247,16 @@ export interface Badge { * Stop indicating background activity. */ stopBusy(): void; + + /** + * Show the notification in the badge. + */ + showNotification(): void; + + /** + * Stop showing the notification. + */ + clearNotification(): void; } @@ -982,7 +992,7 @@ export class Wallet { .put(Stores.purchases, t) .putAll(Stores.coins, payCoinInfo.map((pci) => pci.updatedCoin)) .finish(); - + this.badge.showNotification(); this.notifier.notify(); } @@ -1198,7 +1208,11 @@ export class Wallet { return c; } await this.q().mutate(Stores.coins, coin.coinPub, mutateCoin) + // Show notifications only for accepted tips + this.badge.showNotification(); } + } else { + this.badge.showNotification(); } this.notifier.notify(); @@ -1720,6 +1734,7 @@ export class Wallet { console.log("suspending coin", c); c.suspended = true; q.put(Stores.coins, c); + this.badge.showNotification(); this.notifier.notify(); }); await q.finish(); @@ -2673,6 +2688,7 @@ export class Wallet { .put(Stores.coinsReturns, coinsReturnRecord) .putAll(Stores.coins, payCoinInfo.map((pci) => pci.updatedCoin)) .finish(); + this.badge.showNotification(); this.notifier.notify(); this.depositReturnedCoins(coinsReturnRecord); @@ -2835,6 +2851,7 @@ export class Wallet { this.refresh(perm.coin_pub); } + this.badge.showNotification(); this.notifier.notify(); } @@ -2968,6 +2985,7 @@ export class Wallet { } await q.finish(); + this.badge.showNotification(); this.notifier.notify(); } @@ -3047,4 +3065,8 @@ export class Wallet { // FIXME(#5210) also GC coins } + + clearNotification(): void { + this.badge.clearNotification(); + } } |