diff --git a/src/common/vars/release-channel.injectable.ts b/src/common/vars/release-channel.injectable.ts index 33dd26432a..d8275ff1cb 100644 --- a/src/common/vars/release-channel.injectable.ts +++ b/src/common/vars/release-channel.injectable.ts @@ -2,13 +2,13 @@ * 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 type { ReleaseChannel } from "../application-update/update-channels"; +import { createInitializableState } from "../initializable-state/create"; import buildSemanticVersionInjectable from "./build-semantic-version.injectable"; -const releaseChannelInjectable = getInjectable({ +const releaseChannelInjectable = createInitializableState({ id: "release-channel", - instantiate: (di): ReleaseChannel => { + init: (di): ReleaseChannel => { const buildSemanticVersion = di.inject(buildSemanticVersionInjectable); const currentReleaseChannel = buildSemanticVersion.get().prerelease[0]; diff --git a/src/main/vars/release-channel/init.injectable.ts b/src/main/vars/release-channel/init.injectable.ts new file mode 100644 index 0000000000..ed358af550 --- /dev/null +++ b/src/main/vars/release-channel/init.injectable.ts @@ -0,0 +1,23 @@ +/** + * 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 releaseChannelInjectable from "../../../common/vars/release-channel.injectable"; +import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token"; +import initSemanticBuildVersionInjectable from "../semantic-build-version/init.injectable"; + +const initReleaseChannelInjectable = getInjectable({ + id: "init-release-channel", + instantiate: (di) => { + const releaseChannel = di.inject(releaseChannelInjectable); + + return { + run: () => releaseChannel.init(), + runAfter: di.inject(initSemanticBuildVersionInjectable), + }; + }, + injectionToken: beforeApplicationIsLoadingInjectionToken, +}); + +export default initReleaseChannelInjectable; diff --git a/src/renderer/vars/release-channel/init.injectable.ts b/src/renderer/vars/release-channel/init.injectable.ts new file mode 100644 index 0000000000..f384fd2716 --- /dev/null +++ b/src/renderer/vars/release-channel/init.injectable.ts @@ -0,0 +1,23 @@ +/** + * 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 releaseChannelInjectable from "../../../common/vars/release-channel.injectable"; +import { beforeFrameStartsInjectionToken } from "../../before-frame-starts/before-frame-starts-injection-token"; +import initSemanticBuildVersionInjectable from "../semantic-build-version/init.injectable"; + +const initReleaseChannelInjectable = getInjectable({ + id: "init-release-channel", + instantiate: (di) => { + const releaseChannel = di.inject(releaseChannelInjectable); + + return { + run: () => releaseChannel.init(), + runAfter: di.inject(initSemanticBuildVersionInjectable), + }; + }, + injectionToken: beforeFrameStartsInjectionToken, +}); + +export default initReleaseChannelInjectable;