diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-02-25 22:01:37 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 22:01:37 +0900 |
commit | cebd64a69f705482957a5e6a3f23054ca7985aa4 (patch) | |
tree | 9e8ffd8209972f839367302d3a4b68051f5c2823 /src/background/usecases | |
parent | dfeb7e75498384af5e24255ee0fe7f8af37ac489 (diff) | |
parent | 8614c7a516b475803b0ad30a0fe8e6d0c98e7b48 (diff) |
Merge pull request #539 from ueokande/webext-on-install-event
Use browser.runtime.onInstalled event
Diffstat (limited to 'src/background/usecases')
-rw-r--r-- | src/background/usecases/VersionUseCase.js | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/background/usecases/VersionUseCase.js b/src/background/usecases/VersionUseCase.js index 704c808..ed5112b 100644 --- a/src/background/usecases/VersionUseCase.js +++ b/src/background/usecases/VersionUseCase.js @@ -1,40 +1,25 @@ import manifest from '../../../manifest.json'; -import VersionRepository from '../repositories/VersionRepository'; import TabPresenter from '../presenters/TabPresenter'; -import Notifier from '../infrastructures/Notifier'; +import NotifyPresenter from '../presenters/NotifyPresenter'; export default class VersionUseCase { constructor() { - this.versionRepository = new VersionRepository(); this.tabPresenter = new TabPresenter(); - this.notifier = new Notifier(); + this.notifyPresenter = new NotifyPresenter(); } - async notifyIfUpdated() { - if (!await this.checkUpdated()) { - return; - } - - let title = 'Vim Vixen ' + manifest.version + ' has been installed'; + notify() { + let title = `Vim Vixen ${manifest.version} has been installed`; let message = 'Click here to see release notes'; - this.notifier.notify(title, message, () => { - let url = this.releaseNoteUrl(manifest.version); + let url = this.releaseNoteUrl(manifest.version); + this.notifyPresenter.notify(title, message, () => { this.tabPresenter.create(url); }); - this.versionRepository.update(manifest.version); - } - - async checkUpdated() { - let prev = await this.versionRepository.get(); - if (!prev) { - return true; - } - return manifest.version !== prev; } releaseNoteUrl(version) { if (version) { - return 'https://github.com/ueokande/vim-vixen/releases/tag/' + version; + return `https://github.com/ueokande/vim-vixen/releases/tag/${version}`; } return 'https://github.com/ueokande/vim-vixen/releases/'; } |