From e89f82399f1c732c40dc644c496795833691cff0 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 28 Nov 2017 11:14:57 -0800 Subject: Add optional version field to notices Allows notices to only show to users who are on a certain version. --- app/scripts/metamask-controller.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/scripts/metamask-controller.js') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index a4c77e468..c1b63449a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -44,6 +44,7 @@ module.exports = class MetamaskController extends EventEmitter { this.opts = opts const initState = opts.initState || {} + this.recordFirstTimeInfo(initState) // platform-specific api this.platform = opts.platform @@ -149,6 +150,7 @@ module.exports = class MetamaskController extends EventEmitter { // notices this.noticeController = new NoticeController({ initState: initState.NoticeController, + version, }) this.noticeController.updateNoticesList() // to be uncommented when retrieving notices from a remote server. @@ -797,4 +799,13 @@ module.exports = class MetamaskController extends EventEmitter { return rpcTarget } + recordFirstTimeInfo (initState) { + if (!('firstTimeInfo' in initState)) { + initState.firstTimeInfo = { + version, + date: Date.now(), + } + } + } + } -- cgit v1.2.3 From ec4b7de962d0c4913f8f65a21a6cbef9f2ebc261 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 28 Nov 2017 11:22:09 -0800 Subject: Add firstVersion field to notices selector --- app/scripts/metamask-controller.js | 1 + 1 file changed, 1 insertion(+) (limited to 'app/scripts/metamask-controller.js') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index c1b63449a..0c759010b 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -151,6 +151,7 @@ module.exports = class MetamaskController extends EventEmitter { this.noticeController = new NoticeController({ initState: initState.NoticeController, version, + firstVersion: initState.firstTimeInfo.version, }) this.noticeController.updateNoticesList() // to be uncommented when retrieving notices from a remote server. -- cgit v1.2.3 From f0f6bb28e0e721c0f802354b72f02ed83afbb3b5 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 28 Nov 2017 15:16:04 -0800 Subject: Get notice version filtering working nicely --- app/scripts/metamask-controller.js | 1 + 1 file changed, 1 insertion(+) (limited to 'app/scripts/metamask-controller.js') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 0c759010b..c9eb27fbf 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -45,6 +45,7 @@ module.exports = class MetamaskController extends EventEmitter { this.opts = opts const initState = opts.initState || {} this.recordFirstTimeInfo(initState) + opts.initState.firstTimeInfo.version = '4.5.0' // platform-specific api this.platform = opts.platform -- cgit v1.2.3 From 049ec52a95d0323c2b79cbd785582c5d6a90cb52 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 28 Nov 2017 15:29:56 -0800 Subject: Add seed phrase bounty award notice Only shows to people who installed before or equal to MetaMask 3.12.1 --- app/scripts/metamask-controller.js | 1 - 1 file changed, 1 deletion(-) (limited to 'app/scripts/metamask-controller.js') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index c9eb27fbf..0c759010b 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -45,7 +45,6 @@ module.exports = class MetamaskController extends EventEmitter { this.opts = opts const initState = opts.initState || {} this.recordFirstTimeInfo(initState) - opts.initState.firstTimeInfo.version = '4.5.0' // platform-specific api this.platform = opts.platform -- cgit v1.2.3 From bd82b173106d8b6d4c7b47a4f6c30d59b76bf8c5 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 28 Nov 2017 15:35:20 -0800 Subject: Linted --- app/scripts/metamask-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/metamask-controller.js') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 0c759010b..94831e8ef 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -486,7 +486,7 @@ module.exports = class MetamaskController extends EventEmitter { vault = await this.keyringController.fullUpdate() } else { - let vault = await this.keyringController.createNewVaultAndKeychain(password) + vault = await this.keyringController.createNewVaultAndKeychain(password) this.selectFirstIdentity(vault) } release() -- cgit v1.2.3