From c88ea7150c79cffa192a74d57cea0b39a0f82555 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 12 Aug 2021 12:02:41 +0900 Subject: fix(client): 更新時にテーマキャッシュをクリアするように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/init.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/client') diff --git a/src/client/init.ts b/src/client/init.ts index a4a228da22..95aa18862c 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -16,7 +16,7 @@ import { router } from '@client/router'; import { applyTheme } from '@client/scripts/theme'; import { isDeviceDarkmode } from '@client/scripts/is-device-darkmode'; import { i18n } from '@client/i18n'; -import { stream, dialog, post } from '@client/os'; +import { stream, dialog, post, popup } from '@client/os'; import * as sound from '@client/scripts/sound'; import { $i, refreshAccount, login, updateAccount, signout } from '@client/account'; import { defaultStore, ColdDeviceStorage } from '@client/store'; @@ -198,6 +198,19 @@ if (splash) { splash.style.pointerEvents = 'none'; } +// クライアントが更新されたか? +const lastVersion = localStorage.getItem('lastVersion'); +if (lastVersion !== version) { + localStorage.setItem('lastVersion', version); + + // テーマリビルドするため + localStorage.removeItem('theme'); + + // TODO: バージョンが新しくなった時だけダイアログ出す + //popup(); +} + +// NOTE: この処理は必ず↑のクライアント更新時処理より後に来ること(テーマ再構築のため) watch(defaultStore.reactiveState.darkMode, (darkMode) => { applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme')); }, { immediate: localStorage.theme == null }); -- cgit v1.2.3-freya