diff options
author | Thomas Huang <thomas.b.huang@gmail.com> | 2019-03-21 09:26:48 +0800 |
---|---|---|
committer | Thomas Huang <thomas.b.huang@gmail.com> | 2019-03-21 09:26:48 +0800 |
commit | c43374a553c28459be4cac116a72a4f34dddba72 (patch) | |
tree | e7584d60bf8617b742cdd09485f029e4d92f336d /app/scripts/notice-controller.js | |
parent | fc534b8041bbf69f3f7f8384554934d68a081835 (diff) | |
download | tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.gz tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.bz2 tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.lz tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.xz tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.zst tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.zip |
Clear notices when setCompletedOnboarding is called
Diffstat (limited to 'app/scripts/notice-controller.js')
-rw-r--r-- | app/scripts/notice-controller.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js index 6fe8b8cf0..d1a15ff08 100644 --- a/app/scripts/notice-controller.js +++ b/app/scripts/notice-controller.js @@ -58,6 +58,23 @@ module.exports = class NoticeController extends EventEmitter { } } + markAllNoticesRead (cb) { + cb = cb || function (err) { if (err) throw err } + try { + const noticeList = this.getNoticesList() + noticeList.forEach(notice => { + notice.read = true + notice.body = '' + }) + this.setNoticesList(noticeList) + const latestNotice = this.getNextUnreadNotice() + cb(null, latestNotice) + } catch (err) { + cb(err) + } + } + + async updateNoticesList () { const newNotices = await this._retrieveNoticeData() const oldNotices = this.getNoticesList() |