diff --git a/src/common/application-update/selected-update-channel/selected-update-channel.injectable.ts b/src/common/application-update/selected-update-channel/selected-update-channel.injectable.ts index ce07152b27..8ca31e00aa 100644 --- a/src/common/application-update/selected-update-channel/selected-update-channel.injectable.ts +++ b/src/common/application-update/selected-update-channel/selected-update-channel.injectable.ts @@ -5,13 +5,13 @@ import { getInjectable } from "@ogre-tools/injectable"; import type { IComputedValue } from "mobx"; import { action, computed, observable } from "mobx"; -import type { UpdateChannel, UpdateChannelId } from "../update-channels"; +import type { UpdateChannel, ReleaseChannel } from "../update-channels"; import { updateChannels } from "../update-channels"; import defaultUpdateChannelInjectable from "./default-update-channel.injectable"; export interface SelectedUpdateChannel { value: IComputedValue; - setValue: (channelId?: UpdateChannelId) => void; + setValue: (channelId?: ReleaseChannel) => void; } const selectedUpdateChannelInjectable = getInjectable({ diff --git a/src/common/application-update/update-channels.ts b/src/common/application-update/update-channels.ts index 5d166eabdb..1a38974946 100644 --- a/src/common/application-update/update-channels.ts +++ b/src/common/application-update/update-channels.ts @@ -4,7 +4,7 @@ */ -export type UpdateChannelId = "alpha" | "beta" | "latest"; +export type ReleaseChannel = "alpha" | "beta" | "latest"; const latestChannel: UpdateChannel = { id: "latest", @@ -31,7 +31,7 @@ export const updateChannels = { }; export interface UpdateChannel { - readonly id: UpdateChannelId; + readonly id: ReleaseChannel; readonly label: string; readonly moreStableUpdateChannel: UpdateChannel | null; } diff --git a/src/common/user-store/user-store.ts b/src/common/user-store/user-store.ts index b3f59c5359..7457548436 100644 --- a/src/common/user-store/user-store.ts +++ b/src/common/user-store/user-store.ts @@ -13,7 +13,7 @@ import { DESCRIPTORS } from "./preferences-helpers"; import type { UserPreferencesModel, StoreType } from "./preferences-helpers"; import logger from "../../main/logger"; import type { SelectedUpdateChannel } from "../application-update/selected-update-channel/selected-update-channel.injectable"; -import type { UpdateChannelId } from "../application-update/update-channels"; +import type { ReleaseChannel } from "../application-update/update-channels"; export interface UserStoreModel { lastSeenAppVersion: string; @@ -167,7 +167,7 @@ export class UserStore extends BaseStore /* implements UserStore // TODO: Switch to action-based saving instead saving stores by reaction if (preferences?.updateChannel) { - this.dependencies.selectedUpdateChannel.setValue(preferences?.updateChannel as UpdateChannelId); + this.dependencies.selectedUpdateChannel.setValue(preferences?.updateChannel as ReleaseChannel); } } diff --git a/src/common/vars/release-channel.injectable.ts b/src/common/vars/release-channel.injectable.ts index 78cc79cdb4..33dd26432a 100644 --- a/src/common/vars/release-channel.injectable.ts +++ b/src/common/vars/release-channel.injectable.ts @@ -3,14 +3,14 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import type { UpdateChannelId } from "../application-update/update-channels"; -import appSemanticVersionInjectable from "./app-semantic-version.injectable"; +import type { ReleaseChannel } from "../application-update/update-channels"; +import buildSemanticVersionInjectable from "./build-semantic-version.injectable"; const releaseChannelInjectable = getInjectable({ id: "release-channel", - instantiate: (di): UpdateChannelId => { - const appSemanticVersion = di.inject(appSemanticVersionInjectable); - const currentReleaseChannel = appSemanticVersion.prerelease[0]; + instantiate: (di): ReleaseChannel => { + const buildSemanticVersion = di.inject(buildSemanticVersionInjectable); + const currentReleaseChannel = buildSemanticVersion.get().prerelease[0]; switch (currentReleaseChannel) { case "latest": diff --git a/src/features/application-update/selection-of-update-stability.test.ts b/src/features/application-update/selection-of-update-stability.test.ts index e7c4a8bf1a..a24cf9f675 100644 --- a/src/features/application-update/selection-of-update-stability.test.ts +++ b/src/features/application-update/selection-of-update-stability.test.ts @@ -12,7 +12,7 @@ import type { CheckForPlatformUpdates } from "../../main/application-update/chec import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable"; import type { AsyncFnMock } from "@async-fn/jest"; import asyncFn from "@async-fn/jest"; -import type { UpdateChannel, UpdateChannelId } from "../../common/application-update/update-channels"; +import type { UpdateChannel, ReleaseChannel } from "../../common/application-update/update-channels"; import { updateChannels } from "../../common/application-update/update-channels"; import type { DownloadPlatformUpdate } from "../../main/application-update/download-platform-update/download-platform-update.injectable"; import downloadPlatformUpdateInjectable from "../../main/application-update/download-platform-update/download-platform-update.injectable"; @@ -89,7 +89,7 @@ describe("selection of update stability", () => { describe('given update channel "alpha" is selected, when checking for updates', () => { let selectedUpdateChannel: { value: IComputedValue; - setValue: (channelId: UpdateChannelId) => void; + setValue: (channelId: ReleaseChannel) => void; }; beforeEach(() => { @@ -180,7 +180,7 @@ describe("selection of update stability", () => { describe('given update channel "beta" is selected', () => { let selectedUpdateChannel: { value: IComputedValue; - setValue: (channelId: UpdateChannelId) => void; + setValue: (channelId: ReleaseChannel) => void; }; beforeEach(() => { @@ -254,7 +254,7 @@ describe("selection of update stability", () => { // TODO: UserStore is currently responsible for getting and setting initial value const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable); - selectedUpdateChannel.setValue("something-invalid" as UpdateChannelId); + selectedUpdateChannel.setValue("something-invalid" as ReleaseChannel); }); await builder.render(); diff --git a/src/main/application-update/check-for-platform-updates/check-for-platform-updates.test.ts b/src/main/application-update/check-for-platform-updates/check-for-platform-updates.test.ts index b826a1a5a7..17e750c52e 100644 --- a/src/main/application-update/check-for-platform-updates/check-for-platform-updates.test.ts +++ b/src/main/application-update/check-for-platform-updates/check-for-platform-updates.test.ts @@ -9,7 +9,7 @@ import asyncFn from "@async-fn/jest"; import type { AppUpdater, UpdateCheckResult } from "electron-updater"; import type { CheckForPlatformUpdates } from "./check-for-platform-updates.injectable"; import checkForPlatformUpdatesInjectable from "./check-for-platform-updates.injectable"; -import type { UpdateChannel, UpdateChannelId } from "../../../common/application-update/update-channels"; +import type { UpdateChannel, ReleaseChannel } from "../../../common/application-update/update-channels"; import { getPromiseStatus } from "../../../common/test-utils/get-promise-status"; import loggerInjectable from "../../../common/logger.injectable"; import type { Logger } from "../../../common/logger"; @@ -47,7 +47,7 @@ describe("check-for-platform-updates", () => { beforeEach(() => { const testUpdateChannel: UpdateChannel = { - id: "some-update-channel" as UpdateChannelId, + id: "some-update-channel" as ReleaseChannel, label: "Some update channel", moreStableUpdateChannel: null, };