From 93a665dc63833cf87e1818b1ae13e896dadf26b2 Mon Sep 17 00:00:00 2001 From: Bauke Date: Sat, 14 Nov 2020 18:24:20 +0100 Subject: [PATCH] Add some text to the version number when Queue is updated. --- source/background.ts | 1 + source/manifest.json | 2 +- source/settings-page.ts | 14 ++++++++++++-- source/utilities/components/page-footer.ts | 8 ++++++-- source/utilities/settings.ts | 7 +++++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/source/background.ts b/source/background.ts index f989d81..18de3ad 100644 --- a/source/background.ts +++ b/source/background.ts @@ -65,6 +65,7 @@ browser.runtime.onInstalled.addListener(async () => { manifest.nodeEnv === 'development' ) { settings.latestVersion = manifest.version; + settings.versionGotUpdated = true; await saveSettings(settings); await openOptionsPage(); } diff --git a/source/manifest.json b/source/manifest.json index f86a156..f3d63a0 100644 --- a/source/manifest.json +++ b/source/manifest.json @@ -3,7 +3,7 @@ "manifest_version": 2, "name": "Queue", "description": "A WebExtension for queueing links.", - "version": "0.1.3", + "version": "0.1.4", "permissions": [ "contextMenus", "storage", diff --git a/source/settings-page.ts b/source/settings-page.ts index f0dbdd9..2f1e060 100644 --- a/source/settings-page.ts +++ b/source/settings-page.ts @@ -5,7 +5,8 @@ import { getSettings, PageFooter, PageHeader, - PageMain + PageMain, + saveSettings } from '.'; (async () => { @@ -14,11 +15,20 @@ import { const manifest = getManifest(); const settings = await getSettings(); + const showVersionUpdated = settings.versionGotUpdated; + if (showVersionUpdated) { + settings.versionGotUpdated = false; + await saveSettings(settings); + } + render( html` <${PageHeader} /> <${PageMain} settings=${settings} /> - <${PageFooter} manifest=${manifest} /> + <${PageFooter} + manifest=${manifest} + showVersionUpdated=${showVersionUpdated} + /> `, document.body ); diff --git a/source/utilities/components/page-footer.ts b/source/utilities/components/page-footer.ts index 9ccf52f..364ffb4 100644 --- a/source/utilities/components/page-footer.ts +++ b/source/utilities/components/page-footer.ts @@ -1,8 +1,9 @@ import {html} from 'htm/preact'; -import {Link, QComponent, QManifest} from '../..'; +import {Link, QComponent, QManifest, Settings} from '../..'; type FooterProps = { manifest: QManifest; + showVersionUpdated: boolean; }; export function PageFooter(props: FooterProps): QComponent { @@ -12,10 +13,13 @@ export function PageFooter(props: FooterProps): QComponent { url="https://github.com/Holllo/queue/releases/tag/${version}" />`; + const versionUpdated = props.showVersionUpdated ? 'Updated to' : ''; + return html` `; diff --git a/source/utilities/settings.ts b/source/utilities/settings.ts index 044b185..0f2f17f 100644 --- a/source/utilities/settings.ts +++ b/source/utilities/settings.ts @@ -11,11 +11,13 @@ export type QItem = { export type Settings = { latestVersion: string; queue: QItem[]; + versionGotUpdated: boolean; }; const defaultSettings: Settings = { latestVersion: '0.0.0', - queue: [] + queue: [], + versionGotUpdated: false }; /** @@ -33,7 +35,8 @@ export async function getSettings(): Promise { const settings: Settings = { latestVersion: syncSettings.latestVersion, - queue + queue, + versionGotUpdated: syncSettings.versionGotUpdated }; return settings;