From ebe4eca3724092c04e3751fd4e47e26e12910b95 Mon Sep 17 00:00:00 2001 From: Daniel Karski Date: Mon, 2 Sep 2024 11:31:09 +0200 Subject: [PATCH] [CP-3095] 2.3.1-mockdev.70 requests not existing app update (#2045) --- .../settings/actions/load-settings.action.ts | 5 ++++- libs/core/utils/get-base-bersion.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 libs/core/utils/get-base-bersion.ts diff --git a/libs/core/settings/actions/load-settings.action.ts b/libs/core/settings/actions/load-settings.action.ts index e31a1467bc..f8f4e9287b 100644 --- a/libs/core/settings/actions/load-settings.action.ts +++ b/libs/core/settings/actions/load-settings.action.ts @@ -12,6 +12,7 @@ import logger from "Core/__deprecated__/main/utils/logger" import { getConfiguration } from "Core/settings/requests" import packageInfo from "../../../../apps/mudita-center/package.json" import { ReduxRootState } from "Core/__deprecated__/renderer/store" +import getBaseVersion from "Core/utils/get-base-bersion" export const loadSettings = createAsyncThunk< void, @@ -23,9 +24,11 @@ export const loadSettings = createAsyncThunk< const configuration = await getConfiguration() try { + const packageInfoBaseVersion = getBaseVersion(packageInfo.version) as string + updateRequired = isVersionGreater( configuration.centerVersion, - packageInfo.version + packageInfoBaseVersion ) // AUTO DISABLED - fix me if you like :) // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/libs/core/utils/get-base-bersion.ts b/libs/core/utils/get-base-bersion.ts new file mode 100644 index 0000000000..b6ff64af6d --- /dev/null +++ b/libs/core/utils/get-base-bersion.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Mudita sp. z o.o. All rights reserved. + * For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md + */ + +import semver from "semver/preload" + +const getBaseVersion = (version = "") => { + const baseVersion = semver.parse(version); + if (baseVersion) { + return `${baseVersion.major}.${baseVersion.minor}.${baseVersion.patch}`; + } + + return null; +}; + +export default getBaseVersion