1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/application-update/check-for-updates/update-can-be-downgraded.injectable.ts
Janne Savolainen d705e92b17
Consolidate names of directories
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
2022-05-20 14:11:20 +03:00

30 lines
1020 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx";
import selectedUpdateChannelInjectable from "../../../common/application-update/selected-update-channel/selected-update-channel.injectable";
import appVersionInjectable from "../../../common/get-configuration-file-model/app-version/app-version.injectable";
import { SemVer } from "semver";
const updateCanBeDowngradedInjectable = getInjectable({
id: "update-can-be-downgraded",
instantiate: (di) => {
const selectedUpdateChannel = di.inject(selectedUpdateChannelInjectable);
const appVersion = di.inject(appVersionInjectable);
return computed(() => {
const semVer = new SemVer(appVersion);
return (
semVer.prerelease[0] !==
selectedUpdateChannel.value.get().id
);
});
},
});
export default updateCanBeDowngradedInjectable;