Skip to content

Commit

Permalink
[CP-3095] 2.3.1-mockdev.70 requests not existing app update (#2045)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarski authored Sep 2, 2024
1 parent d4c86bc commit ebe4eca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/core/settings/actions/load-settings.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions libs/core/utils/get-base-bersion.ts
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ebe4eca

Please sign in to comment.