mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use BuildSemanticVersion
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
ea70e7decc
commit
7a687dbe09
@ -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<UpdateChannel>;
|
||||
setValue: (channelId?: UpdateChannelId) => void;
|
||||
setValue: (channelId?: ReleaseChannel) => void;
|
||||
}
|
||||
|
||||
const selectedUpdateChannelInjectable = getInjectable({
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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<UserStoreModel> /* 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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":
|
||||
|
||||
@ -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<UpdateChannel>;
|
||||
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<UpdateChannel>;
|
||||
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();
|
||||
|
||||
@ -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,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user