|
| 1 | +diff --git a/dist/NotificationServicesController/NotificationServicesController.cjs b/dist/NotificationServicesController/NotificationServicesController.cjs |
| 2 | +index 2c0e69468c3bab825ca6d9e6d78d9fb3b4372081..2f6214553fc6dcfecaa8a614e05980dfd8118e10 100644 |
| 3 | +--- a/dist/NotificationServicesController/NotificationServicesController.cjs |
| 4 | ++++ b/dist/NotificationServicesController/NotificationServicesController.cjs |
| 5 | +@@ -307,8 +307,11 @@ class NotificationServicesController extends base_controller_1.BaseController { |
| 6 | + * And call effects to subscribe/unsubscribe to notifications. |
| 7 | + */ |
| 8 | + subscribe: () => { |
| 9 | +- this.messagingSystem.subscribe('KeyringController:stateChange', async () => { |
| 10 | +- if (!this.state.isNotificationServicesEnabled) { |
| 11 | ++ this.messagingSystem.subscribe('KeyringController:stateChange', async (totalAccounts, prevTotalAccounts) => { |
| 12 | ++ // Fixed in a release that contains https://github.com/MetaMask/core/pull/5731 |
| 13 | ++ const hasTotalAccountsChanged = totalAccounts !== prevTotalAccounts; |
| 14 | ++ if (!this.state.isNotificationServicesEnabled || |
| 15 | ++ !hasTotalAccountsChanged) { |
| 16 | + return; |
| 17 | + } |
| 18 | + const { accountsAdded, accountsRemoved } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts(); |
| 19 | +@@ -320,6 +323,9 @@ class NotificationServicesController extends base_controller_1.BaseController { |
| 20 | + promises.push(this.deleteOnChainTriggersByAccount(accountsRemoved)); |
| 21 | + } |
| 22 | + await Promise.all(promises); |
| 23 | ++ }, (state) => { |
| 24 | ++ return (state?.keyrings?.flatMap?.((keyring) => keyring.accounts)?.length ?? |
| 25 | ++ 0); |
| 26 | + }); |
| 27 | + }, |
| 28 | + }); |
| 29 | +diff --git a/dist/NotificationServicesController/NotificationServicesController.mjs b/dist/NotificationServicesController/NotificationServicesController.mjs |
| 30 | +index 1eeede947b3a8875589a81c140f001f358d8bcc1..9a1c68b32169e2e0a7574e4cc270e63d6e07f326 100644 |
| 31 | +--- a/dist/NotificationServicesController/NotificationServicesController.mjs |
| 32 | ++++ b/dist/NotificationServicesController/NotificationServicesController.mjs |
| 33 | +@@ -285,8 +285,11 @@ class NotificationServicesController extends BaseController { |
| 34 | + * And call effects to subscribe/unsubscribe to notifications. |
| 35 | + */ |
| 36 | + subscribe: () => { |
| 37 | +- this.messagingSystem.subscribe('KeyringController:stateChange', async () => { |
| 38 | +- if (!this.state.isNotificationServicesEnabled) { |
| 39 | ++ this.messagingSystem.subscribe('KeyringController:stateChange', async (totalAccounts, prevTotalAccounts) => { |
| 40 | ++ // Fixed in a release that contains https://github.com/MetaMask/core/pull/5731 |
| 41 | ++ const hasTotalAccountsChanged = totalAccounts !== prevTotalAccounts; |
| 42 | ++ if (!this.state.isNotificationServicesEnabled || |
| 43 | ++ !hasTotalAccountsChanged) { |
| 44 | + return; |
| 45 | + } |
| 46 | + const { accountsAdded, accountsRemoved } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts(); |
| 47 | +@@ -298,6 +301,9 @@ class NotificationServicesController extends BaseController { |
| 48 | + promises.push(this.deleteOnChainTriggersByAccount(accountsRemoved)); |
| 49 | + } |
| 50 | + await Promise.all(promises); |
| 51 | ++ }, (state) => { |
| 52 | ++ return (state?.keyrings?.flatMap?.((keyring) => keyring.accounts)?.length ?? |
| 53 | ++ 0); |
| 54 | + }); |
| 55 | + }, |
| 56 | + }); |
0 commit comments