From d10be711613a897e0c4356993ea98af81b1c0c0e Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 2 Mar 2018 18:46:08 +0900 Subject: #1161, #1163 --- src/web/app/common/scripts/check-for-update.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/web/app/common/scripts') diff --git a/src/web/app/common/scripts/check-for-update.ts b/src/web/app/common/scripts/check-for-update.ts index fe539407da..3e7eb79d8b 100644 --- a/src/web/app/common/scripts/check-for-update.ts +++ b/src/web/app/common/scripts/check-for-update.ts @@ -1,8 +1,8 @@ import MiOS from '../mios'; import { version } from '../../config'; -export default async function(mios: MiOS) { - const meta = await mios.getMeta(); +export default async function(mios: MiOS, force = false, silent = false) { + const meta = await mios.getMeta(force); if (meta.version != version) { localStorage.setItem('should-refresh', 'true'); @@ -20,6 +20,12 @@ export default async function(mios: MiOS) { console.error(e); } - alert('%i18n:common.update-available%'.replace('{newer}', meta.version).replace('{current}', version)); + if (!silent) { + alert('%i18n:common.update-available%'.replace('{newer}', meta.version).replace('{current}', version)); + } + + return meta.version; + } else { + return null; } } -- cgit v1.2.3-freya