mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify even more naming
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
9c5971378b
commit
3e5f374122
@ -9,15 +9,14 @@ import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/
|
|||||||
import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable";
|
import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable";
|
||||||
import type { AsyncFnMock } from "@async-fn/jest";
|
import type { AsyncFnMock } from "@async-fn/jest";
|
||||||
import asyncFn from "@async-fn/jest";
|
import asyncFn from "@async-fn/jest";
|
||||||
import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable";
|
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||||
import startCheckingForUpdatesInjectable
|
import startCheckingForUpdatesInjectable from "../../main/application-update/periodical-check-for-updates/start-checking-for-updates.injectable";
|
||||||
from "../../main/application-update/periodical-check-for-updates/start-checking-for-updates.injectable";
|
|
||||||
|
|
||||||
const ENOUGH_TIME = 1000 * 60 * 60 * 2;
|
const ENOUGH_TIME = 1000 * 60 * 60 * 2;
|
||||||
|
|
||||||
describe("checking for updates automatically", () => {
|
describe("checking for updates automatically", () => {
|
||||||
let applicationBuilder: ApplicationBuilder;
|
let applicationBuilder: ApplicationBuilder;
|
||||||
let checkForUpdatesMock: AsyncFnMock<() => Promise<void>>;
|
let processCheckingForUpdatesMock: AsyncFnMock<() => Promise<void>>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
@ -27,11 +26,11 @@ describe("checking for updates automatically", () => {
|
|||||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||||
mainDi.unoverride(startCheckingForUpdatesInjectable);
|
mainDi.unoverride(startCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdatesMock = asyncFn();
|
processCheckingForUpdatesMock = asyncFn();
|
||||||
|
|
||||||
mainDi.override(
|
mainDi.override(
|
||||||
checkForUpdatesInjectable,
|
processCheckingForUpdatesInjectable,
|
||||||
() => checkForUpdatesMock,
|
() => processCheckingForUpdatesMock,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -53,23 +52,23 @@ describe("checking for updates automatically", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("checks for updates", () => {
|
it("checks for updates", () => {
|
||||||
expect(checkForUpdatesMock).toHaveBeenCalled();
|
expect(processCheckingForUpdatesMock).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("when just not enough time passes, does not check for updates again automatically yet", () => {
|
it("when just not enough time passes, does not check for updates again automatically yet", () => {
|
||||||
checkForUpdatesMock.mockClear();
|
processCheckingForUpdatesMock.mockClear();
|
||||||
|
|
||||||
jest.advanceTimersByTime(ENOUGH_TIME - 1);
|
jest.advanceTimersByTime(ENOUGH_TIME - 1);
|
||||||
|
|
||||||
expect(checkForUpdatesMock).not.toHaveBeenCalled();
|
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("when just enough time passes, checks for updates again automatically", () => {
|
it("when just enough time passes, checks for updates again automatically", () => {
|
||||||
checkForUpdatesMock.mockClear();
|
processCheckingForUpdatesMock.mockClear();
|
||||||
|
|
||||||
jest.advanceTimersByTime(ENOUGH_TIME);
|
jest.advanceTimersByTime(ENOUGH_TIME);
|
||||||
|
|
||||||
expect(checkForUpdatesMock).toHaveBeenCalled();
|
expect(processCheckingForUpdatesMock).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -84,13 +83,13 @@ describe("checking for updates automatically", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not check for updates", () => {
|
it("does not check for updates", () => {
|
||||||
expect(checkForUpdatesMock).not.toHaveBeenCalled();
|
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("when enough time passes for checking updates again, still does not check for updates", () => {
|
it("when enough time passes for checking updates again, still does not check for updates", () => {
|
||||||
jest.advanceTimersByTime(ENOUGH_TIME);
|
jest.advanceTimersByTime(ENOUGH_TIME);
|
||||||
|
|
||||||
expect(checkForUpdatesMock).not.toHaveBeenCalled();
|
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -105,13 +104,13 @@ describe("checking for updates automatically", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not check for updates", () => {
|
it("does not check for updates", () => {
|
||||||
expect(checkForUpdatesMock).not.toHaveBeenCalled();
|
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("when enough time passes for checking updates again, still does not check for updates", () => {
|
it("when enough time passes for checking updates again, still does not check for updates", () => {
|
||||||
jest.advanceTimersByTime(ENOUGH_TIME);
|
jest.advanceTimersByTime(ENOUGH_TIME);
|
||||||
|
|
||||||
expect(checkForUpdatesMock).not.toHaveBeenCalled();
|
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import type { AsyncFnMock } from "@async-fn/jest";
|
|||||||
import asyncFn from "@async-fn/jest";
|
import asyncFn from "@async-fn/jest";
|
||||||
import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||||
import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||||
import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable";
|
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||||
import selectedUpdateChannelInjectable from "../../common/application-update/selected-update-channel/selected-update-channel.injectable";
|
import selectedUpdateChannelInjectable from "../../common/application-update/selected-update-channel/selected-update-channel.injectable";
|
||||||
import type { DiContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
||||||
@ -77,9 +77,9 @@ describe("downgrading version update", () => {
|
|||||||
|
|
||||||
selectedUpdateChannel.setValue(updateChannel.id);
|
selectedUpdateChannel.setValue(updateChannel.id);
|
||||||
|
|
||||||
const checkForUpdates = mainDi.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(expect.any(Object), { allowDowngrade: downgradeIsAllowed });
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(expect.any(Object), { allowDowngrade: downgradeIsAllowed });
|
||||||
});
|
});
|
||||||
|
|||||||
@ -22,9 +22,8 @@ import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-upda
|
|||||||
import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable";
|
import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable";
|
||||||
import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable";
|
import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable";
|
||||||
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
|
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
|
||||||
import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable";
|
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||||
import appVersionInjectable
|
import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
||||||
from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
|
||||||
|
|
||||||
describe("installing update from update channels", () => {
|
describe("installing update from update channels", () => {
|
||||||
let applicationBuilder: ApplicationBuilder;
|
let applicationBuilder: ApplicationBuilder;
|
||||||
@ -73,12 +72,12 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
describe("when started", () => {
|
describe("when started", () => {
|
||||||
let rendered: RenderResult;
|
let rendered: RenderResult;
|
||||||
let checkForUpdates: () => Promise<void>;
|
let processCheckingForUpdates: () => Promise<void>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
rendered = await applicationBuilder.render();
|
rendered = await applicationBuilder.render();
|
||||||
|
|
||||||
checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
@ -98,7 +97,7 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
selectedUpdateChannel.setValue(updateChannels.alpha.id);
|
selectedUpdateChannel.setValue(updateChannels.alpha.id);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checks updates from update channel "alpha"', () => {
|
it('checks updates from update channel "alpha"', () => {
|
||||||
@ -192,7 +191,7 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
describe("when checking for updates", () => {
|
describe("when checking for updates", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when update from "beta" channel is discovered', () => {
|
describe('when update from "beta" channel is discovered', () => {
|
||||||
@ -240,9 +239,9 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
await applicationBuilder.render();
|
await applicationBuilder.render();
|
||||||
|
|
||||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||||
});
|
});
|
||||||
@ -258,9 +257,9 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
await applicationBuilder.render();
|
await applicationBuilder.render();
|
||||||
|
|
||||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.latest, expect.any(Object));
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.latest, expect.any(Object));
|
||||||
});
|
});
|
||||||
@ -272,9 +271,9 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
await applicationBuilder.render();
|
await applicationBuilder.render();
|
||||||
|
|
||||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
||||||
updateChannels.latest,
|
updateChannels.latest,
|
||||||
@ -289,9 +288,9 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
await applicationBuilder.render();
|
await applicationBuilder.render();
|
||||||
|
|
||||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.alpha, expect.any(Object));
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.alpha, expect.any(Object));
|
||||||
});
|
});
|
||||||
@ -303,9 +302,9 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
await applicationBuilder.render();
|
await applicationBuilder.render();
|
||||||
|
|
||||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||||
});
|
});
|
||||||
@ -323,9 +322,9 @@ describe("installing update from update channels", () => {
|
|||||||
|
|
||||||
await applicationBuilder.render();
|
await applicationBuilder.render();
|
||||||
|
|
||||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||||
});
|
});
|
||||||
|
|||||||
@ -63,10 +63,10 @@ describe("installing update using tray", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("when user checks for updates using tray", () => {
|
describe("when user checks for updates using tray", () => {
|
||||||
let checkForUpdatesPromise: Promise<void>;
|
let processCheckingForUpdatesPromise: Promise<void>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
checkForUpdatesPromise =
|
processCheckingForUpdatesPromise =
|
||||||
applicationBuilder.tray.click("check-for-updates");
|
applicationBuilder.tray.click("check-for-updates");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ describe("installing update using tray", () => {
|
|||||||
updateWasDiscovered: false,
|
updateWasDiscovered: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
await checkForUpdatesPromise;
|
await processCheckingForUpdatesPromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows application window", () => {
|
it("shows application window", () => {
|
||||||
@ -135,7 +135,7 @@ describe("installing update using tray", () => {
|
|||||||
version: "some-version",
|
version: "some-version",
|
||||||
});
|
});
|
||||||
|
|
||||||
await checkForUpdatesPromise;
|
await processCheckingForUpdatesPromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows application window", () => {
|
it("shows application window", () => {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-upda
|
|||||||
import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable";
|
import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable";
|
||||||
import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable";
|
import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable";
|
||||||
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
|
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
|
||||||
import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable";
|
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||||
|
|
||||||
describe("installing update", () => {
|
describe("installing update", () => {
|
||||||
let applicationBuilder: ApplicationBuilder;
|
let applicationBuilder: ApplicationBuilder;
|
||||||
@ -67,12 +67,12 @@ describe("installing update", () => {
|
|||||||
|
|
||||||
describe("when started", () => {
|
describe("when started", () => {
|
||||||
let rendered: RenderResult;
|
let rendered: RenderResult;
|
||||||
let checkForUpdates: () => Promise<void>;
|
let processCheckingForUpdates: () => Promise<void>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
rendered = await applicationBuilder.render();
|
rendered = await applicationBuilder.render();
|
||||||
|
|
||||||
checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
@ -80,10 +80,10 @@ describe("installing update", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("when user checks for updates", () => {
|
describe("when user checks for updates", () => {
|
||||||
let checkForUpdatesPromise: Promise<void>;
|
let processCheckingForUpdatesPromise: Promise<void>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
checkForUpdatesPromise = checkForUpdates();
|
processCheckingForUpdatesPromise = processCheckingForUpdates();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("checks for updates", () => {
|
it("checks for updates", () => {
|
||||||
@ -109,7 +109,7 @@ describe("installing update", () => {
|
|||||||
updateWasDiscovered: false,
|
updateWasDiscovered: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
await checkForUpdatesPromise;
|
await processCheckingForUpdatesPromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("notifies the user", () => {
|
it("notifies the user", () => {
|
||||||
@ -132,7 +132,7 @@ describe("installing update", () => {
|
|||||||
version: "some-version",
|
version: "some-version",
|
||||||
});
|
});
|
||||||
|
|
||||||
await checkForUpdatesPromise;
|
await processCheckingForUpdatesPromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("starts downloading the update", () => {
|
it("starts downloading the update", () => {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import updateIsBeingDownloadedInjectable from "../../common/application-update/u
|
|||||||
import updatesAreBeingDiscoveredInjectable from "../../common/application-update/updates-are-being-discovered/updates-are-being-discovered.injectable";
|
import updatesAreBeingDiscoveredInjectable from "../../common/application-update/updates-are-being-discovered/updates-are-being-discovered.injectable";
|
||||||
import progressOfUpdateDownloadInjectable from "../../common/application-update/progress-of-update-download/progress-of-update-download.injectable";
|
import progressOfUpdateDownloadInjectable from "../../common/application-update/progress-of-update-download/progress-of-update-download.injectable";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import checkForUpdatesInjectable from "./check-for-updates/check-for-updates.injectable";
|
import processCheckingForUpdatesInjectable from "./check-for-updates/process-checking-for-updates.injectable";
|
||||||
|
|
||||||
const checkForUpdatesTrayItemInjectable = getInjectable({
|
const checkForUpdatesTrayItemInjectable = getInjectable({
|
||||||
id: "check-for-updates-tray-item",
|
id: "check-for-updates-tray-item",
|
||||||
@ -24,7 +24,7 @@ const checkForUpdatesTrayItemInjectable = getInjectable({
|
|||||||
const discoveredVersionState = di.inject(discoveredUpdateVersionInjectable);
|
const discoveredVersionState = di.inject(discoveredUpdateVersionInjectable);
|
||||||
const downloadingUpdateState = di.inject(updateIsBeingDownloadedInjectable);
|
const downloadingUpdateState = di.inject(updateIsBeingDownloadedInjectable);
|
||||||
const checkingForUpdatesState = di.inject(updatesAreBeingDiscoveredInjectable);
|
const checkingForUpdatesState = di.inject(updatesAreBeingDiscoveredInjectable);
|
||||||
const checkForUpdates = di.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: "check-for-updates",
|
id: "check-for-updates",
|
||||||
@ -52,7 +52,7 @@ const checkForUpdatesTrayItemInjectable = getInjectable({
|
|||||||
visible: computed(() => updatingIsEnabled),
|
visible: computed(() => updatingIsEnabled),
|
||||||
|
|
||||||
click: async () => {
|
click: async () => {
|
||||||
await checkForUpdates();
|
await processCheckingForUpdates();
|
||||||
|
|
||||||
await showApplicationWindow();
|
await showApplicationWindow();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,8 +14,8 @@ import downloadUpdateInjectable from "../download-update/download-update.injecta
|
|||||||
import broadcastChangeInUpdatingStatusInjectable from "./broadcast-change-in-updating-status.injectable";
|
import broadcastChangeInUpdatingStatusInjectable from "./broadcast-change-in-updating-status.injectable";
|
||||||
import checkForUpdatesStartingFromChannelInjectable from "./check-for-updates-starting-from-channel.injectable";
|
import checkForUpdatesStartingFromChannelInjectable from "./check-for-updates-starting-from-channel.injectable";
|
||||||
|
|
||||||
const checkForUpdatesInjectable = getInjectable({
|
const processCheckingForUpdatesInjectable = getInjectable({
|
||||||
id: "check-for-updates",
|
id: "process-checking-for-updates",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const askBoolean = di.inject(askBooleanInjectable);
|
const askBoolean = di.inject(askBooleanInjectable);
|
||||||
@ -92,4 +92,4 @@ const checkForUpdatesInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default checkForUpdatesInjectable;
|
export default processCheckingForUpdatesInjectable;
|
||||||
@ -4,23 +4,23 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
||||||
import checkForUpdatesInjectable from "../check-for-updates/check-for-updates.injectable";
|
import processCheckingForUpdatesInjectable from "../check-for-updates/process-checking-for-updates.injectable";
|
||||||
|
|
||||||
const periodicalCheckForUpdatesInjectable = getInjectable({
|
const periodicalCheckForUpdatesInjectable = getInjectable({
|
||||||
id: "periodical-check-for-updates",
|
id: "periodical-check-for-updates",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const checkForUpdates = di.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
return getStartableStoppable("periodical-check-for-updates", () => {
|
return getStartableStoppable("periodical-check-for-updates", () => {
|
||||||
const TWO_HOURS = 1000 * 60 * 60 * 2;
|
const TWO_HOURS = 1000 * 60 * 60 * 2;
|
||||||
|
|
||||||
// Note: intentional orphan promise to make checking for updates happen in the background
|
// Note: intentional orphan promise to make checking for updates happen in the background
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
|
|
||||||
const intervalId = setInterval(() => {
|
const intervalId = setInterval(() => {
|
||||||
// Note: intentional orphan promise to make checking for updates happen in the background
|
// Note: intentional orphan promise to make checking for updates happen in the background
|
||||||
checkForUpdates();
|
processCheckingForUpdates();
|
||||||
}, TWO_HOURS);
|
}, TWO_HOURS);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import showAboutInjectable from "./show-about.injectable";
|
|||||||
import applicationWindowInjectable from "../start-main-application/lens-window/application-window/application-window.injectable";
|
import applicationWindowInjectable from "../start-main-application/lens-window/application-window/application-window.injectable";
|
||||||
import reloadWindowInjectable from "../start-main-application/lens-window/reload-window.injectable";
|
import reloadWindowInjectable from "../start-main-application/lens-window/reload-window.injectable";
|
||||||
import showApplicationWindowInjectable from "../start-main-application/lens-window/show-application-window.injectable";
|
import showApplicationWindowInjectable from "../start-main-application/lens-window/show-application-window.injectable";
|
||||||
import checkForUpdatesInjectable from "../application-update/check-for-updates/check-for-updates.injectable";
|
import processCheckingForUpdatesInjectable from "../application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||||
|
|
||||||
function ignoreIf(check: boolean, menuItems: MenuItemOpts[]) {
|
function ignoreIf(check: boolean, menuItems: MenuItemOpts[]) {
|
||||||
return check ? [] : menuItems;
|
return check ? [] : menuItems;
|
||||||
@ -53,7 +53,7 @@ const applicationMenuItemsInjectable = getInjectable({
|
|||||||
const navigateToWelcome = di.inject(navigateToWelcomeInjectable);
|
const navigateToWelcome = di.inject(navigateToWelcomeInjectable);
|
||||||
const navigateToAddCluster = di.inject(navigateToAddClusterInjectable);
|
const navigateToAddCluster = di.inject(navigateToAddClusterInjectable);
|
||||||
const stopServicesAndExitApp = di.inject(stopServicesAndExitAppInjectable);
|
const stopServicesAndExitApp = di.inject(stopServicesAndExitAppInjectable);
|
||||||
const checkForUpdates = di.inject(checkForUpdatesInjectable);
|
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable);
|
||||||
|
|
||||||
logger.info(`[MENU]: autoUpdateEnabled=${updatingIsEnabled}`);
|
logger.info(`[MENU]: autoUpdateEnabled=${updatingIsEnabled}`);
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ const applicationMenuItemsInjectable = getInjectable({
|
|||||||
{
|
{
|
||||||
label: "Check for updates",
|
label: "Check for updates",
|
||||||
click() {
|
click() {
|
||||||
checkForUpdates().then(() => showApplicationWindow());
|
processCheckingForUpdates().then(() => showApplicationWindow());
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
@ -285,7 +285,7 @@ const applicationMenuItemsInjectable = getInjectable({
|
|||||||
{
|
{
|
||||||
label: "Check for updates",
|
label: "Check for updates",
|
||||||
click() {
|
click() {
|
||||||
checkForUpdates().then(() =>
|
processCheckingForUpdates().then(() =>
|
||||||
showApplicationWindow(),
|
showApplicationWindow(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user