aboutsummaryrefslogtreecommitdiff
path: root/src/background/shared/versions
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-07-28 20:05:06 +0900
committerGitHub <noreply@github.com>2018-07-28 20:05:06 +0900
commited2bd7d75ee1e7aa1db7d03c3f908c740ded1983 (patch)
tree6ac3f5ac5126e1a07c958549c782aedd586c6534 /src/background/shared/versions
parent84a9655bb39e5902b417e124a0eb23d80808a6a7 (diff)
parent4bd2084ba7b23327c26a2d8b24dc4169c14bfa17 (diff)
Merge pull request #440 from ueokande/background-clean-architecture
Background clean architecture
Diffstat (limited to 'src/background/shared/versions')
-rw-r--r--src/background/shared/versions/index.js38
-rw-r--r--src/background/shared/versions/release-notes.js8
-rw-r--r--src/background/shared/versions/storage.js10
3 files changed, 0 insertions, 56 deletions
diff --git a/src/background/shared/versions/index.js b/src/background/shared/versions/index.js
deleted file mode 100644
index aa09c92..0000000
--- a/src/background/shared/versions/index.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import * as storage from './storage';
-import * as releaseNotes from './release-notes';
-import manifest from '../../../../manifest.json';
-
-const NOTIFICATION_ID = 'vimvixen-update';
-
-const notificationClickListener = (id) => {
- if (id !== NOTIFICATION_ID) {
- return;
- }
-
- browser.tabs.create({ url: releaseNotes.url(manifest.version) });
- browser.notifications.onClicked.removeListener(notificationClickListener);
-};
-
-const checkUpdated = async() => {
- let prev = await storage.load();
- if (!prev) {
- return true;
- }
- return manifest.version !== prev;
-};
-
-const notify = () => {
- browser.notifications.onClicked.addListener(notificationClickListener);
- return browser.notifications.create(NOTIFICATION_ID, {
- 'type': 'basic',
- 'iconUrl': browser.extension.getURL('resources/icon_48x48.png'),
- 'title': 'Vim Vixen ' + manifest.version + ' has been installed',
- 'message': 'Click here to see release notes',
- });
-};
-
-const commit = () => {
- storage.save(manifest.version);
-};
-
-export { checkUpdated, notify, commit };
diff --git a/src/background/shared/versions/release-notes.js b/src/background/shared/versions/release-notes.js
deleted file mode 100644
index 6ef2335..0000000
--- a/src/background/shared/versions/release-notes.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const url = (version) => {
- if (version) {
- return 'https://github.com/ueokande/vim-vixen/releases/tag/' + version;
- }
- return 'https://github.com/ueokande/vim-vixen/releases/';
-};
-
-export { url };
diff --git a/src/background/shared/versions/storage.js b/src/background/shared/versions/storage.js
deleted file mode 100644
index 7883258..0000000
--- a/src/background/shared/versions/storage.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const load = async() => {
- let { version } = await browser.storage.local.get('version');
- return version;
-};
-
-const save = (version) => {
- return browser.storage.local.set({ version });
-};
-
-export { load, save };