diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-05-14 00:16:09 +0800 |
---|---|---|
committer | Dan J Miller <danjm.com@gmail.com> | 2019-05-14 00:16:09 +0800 |
commit | 28c4001f5269eb170f14bd2829698ee402b2cfbf (patch) | |
tree | a9cb1fbf6fbbb2304c0d3224c1856e70a1fc69e5 /app/scripts/metamask-controller.js | |
parent | 08e8fb21dc142ab21184c1125f55b9f3e0ce6412 (diff) | |
download | tangerine-wallet-browser-28c4001f5269eb170f14bd2829698ee402b2cfbf.tar tangerine-wallet-browser-28c4001f5269eb170f14bd2829698ee402b2cfbf.tar.gz tangerine-wallet-browser-28c4001f5269eb170f14bd2829698ee402b2cfbf.tar.bz2 tangerine-wallet-browser-28c4001f5269eb170f14bd2829698ee402b2cfbf.tar.lz tangerine-wallet-browser-28c4001f5269eb170f14bd2829698ee402b2cfbf.tar.xz tangerine-wallet-browser-28c4001f5269eb170f14bd2829698ee402b2cfbf.tar.zst tangerine-wallet-browser-28c4001f5269eb170f14bd2829698ee402b2cfbf.zip |
Update auto-logout to recognize idle time in background (#6593)
* Fix wording of autoLogoutTimeLimitDescription
* AppStateController and update auto-logout functionality
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index bdfff9827..07054f84b 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -25,6 +25,7 @@ const {setupMultiplex} = require('./lib/stream-utils.js') const KeyringController = require('eth-keyring-controller') const NetworkController = require('./controllers/network') const PreferencesController = require('./controllers/preferences') +const AppStateController = require('./controllers/app-state') const CurrencyController = require('./controllers/currency') const ShapeShiftController = require('./controllers/shapeshift') const InfuraController = require('./controllers/infura') @@ -101,6 +102,12 @@ module.exports = class MetamaskController extends EventEmitter { network: this.networkController, }) + // app-state controller + this.appStateController = new AppStateController({ + preferencesStore: this.preferencesController.store, + onInactiveTimeout: () => this.setLocked(), + }) + // currency controller this.currencyController = new CurrencyController({ initState: initState.CurrencyController, @@ -252,6 +259,7 @@ module.exports = class MetamaskController extends EventEmitter { }) this.store.updateStructure({ + AppStateController: this.appStateController.store, TransactionController: this.txController.store, KeyringController: this.keyringController.store, PreferencesController: this.preferencesController.store, @@ -264,6 +272,7 @@ module.exports = class MetamaskController extends EventEmitter { }) this.memStore = new ComposableObservableStore(null, { + AppStateController: this.appStateController.store, NetworkController: this.networkController.store, AccountTracker: this.accountTracker.store, TxController: this.txController.memStore, @@ -462,6 +471,9 @@ module.exports = class MetamaskController extends EventEmitter { // AddressController setAddressBook: this.addressBookController.set.bind(this.addressBookController), + // AppStateController + setLastActiveTime: nodeify(this.appStateController.setLastActiveTime, this.appStateController), + // KeyringController setLocked: nodeify(this.setLocked, this), createNewVaultAndKeychain: nodeify(this.createNewVaultAndKeychain, this), |