1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Tweak naming

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-05-09 09:23:23 +03:00
parent 84ac22904d
commit 1f178ba833
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A
10 changed files with 80 additions and 80 deletions

View File

@ -3,18 +3,18 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import synchronizeUpdateIsAvailableStateInjectable from "./synchronize-update-is-available-state.injectable";
import syncUpdateIsReadyToBeInstalledInjectable from "./sync-update-is-ready-to-be-installed.injectable";
import { onLoadOfApplicationInjectionToken } from "../../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
const startSynchronizingUpdateIsAvailableStateInjectable = getInjectable({
id: "start-synchronizing-update-is-available-state",
const startSyncingUpdateIsReadyToBeInstalledInjectable = getInjectable({
id: "start-syncing-update-is-ready-to-be-installed",
instantiate: (di) => {
const synchronizeUpdateIsAvailableState = di.inject(synchronizeUpdateIsAvailableStateInjectable);
const syncUpdateIsReadyToBeInstalledState = di.inject(syncUpdateIsReadyToBeInstalledInjectable);
return {
run: () => {
synchronizeUpdateIsAvailableState.start();
syncUpdateIsReadyToBeInstalledState.start();
},
};
},
@ -22,4 +22,4 @@ const startSynchronizingUpdateIsAvailableStateInjectable = getInjectable({
injectionToken: onLoadOfApplicationInjectionToken,
});
export default startSynchronizingUpdateIsAvailableStateInjectable;
export default startSyncingUpdateIsReadyToBeInstalledInjectable;

View File

@ -3,18 +3,18 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import synchronizeUpdateIsAvailableStateInjectable from "./synchronize-update-is-available-state.injectable";
import syncUpdateIsReadyToBeInstalledInjectable from "./sync-update-is-ready-to-be-installed.injectable";
import { beforeQuitOfBackEndInjectionToken } from "../../../start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
const stopSynchronizingUpdateIsAvailableStateInjectable = getInjectable({
id: "stop-synchronizing-update-is-available-state",
const stopSyncingUpdateIsReadyToBeInstalledInjectable = getInjectable({
id: "stop-syncing-update-is-ready-to-be-installed",
instantiate: (di) => {
const synchronizeUpdateIsAvailableState = di.inject(synchronizeUpdateIsAvailableStateInjectable);
const syncUpdateIsReadyToBeInstalled = di.inject(syncUpdateIsReadyToBeInstalledInjectable);
return {
run: () => {
synchronizeUpdateIsAvailableState.stop();
syncUpdateIsReadyToBeInstalled.stop();
},
};
},
@ -22,4 +22,4 @@ const stopSynchronizingUpdateIsAvailableStateInjectable = getInjectable({
injectionToken: beforeQuitOfBackEndInjectionToken,
});
export default stopSynchronizingUpdateIsAvailableStateInjectable;
export default stopSyncingUpdateIsReadyToBeInstalledInjectable;

View File

@ -0,0 +1,40 @@
/**
* 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 { getStartableStoppable } from "../../../../common/utils/get-startable-stoppable";
import electronUpdaterInjectable from "../../features/electron-updater.injectable";
import updateIsReadyToBeInstalledStateInjectable from "../../../update-app/update-is-ready-to-be-installed-state.injectable";
const syncUpdateIsReadyToBeInstalledInjectable = getInjectable({
id: "sync-update-is-ready-to-be-installed",
instantiate: (di) => {
const electronUpdater = di.inject(electronUpdaterInjectable);
const updateIsReadyToBeInstalledState = di.inject(updateIsReadyToBeInstalledStateInjectable);
const makeUpdateReadyToBeInstalledFor = (available: boolean) => () => {
updateIsReadyToBeInstalledState.set(available);
};
return getStartableStoppable(
"synchronize-update-is-available-state",
() => {
const makeUpdateReadyToBeInstalled = makeUpdateReadyToBeInstalledFor(true);
const makeUpdateUnavailable = makeUpdateReadyToBeInstalledFor(false);
electronUpdater.on("update-downloaded", makeUpdateReadyToBeInstalled);
electronUpdater.on("update-not-available", makeUpdateUnavailable);
return () => {
electronUpdater.off("update-downloaded", makeUpdateReadyToBeInstalled);
electronUpdater.off("update-not-available", makeUpdateUnavailable);
};
},
);
},
});
export default syncUpdateIsReadyToBeInstalledInjectable;

View File

@ -1,40 +0,0 @@
/**
* 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 { getStartableStoppable } from "../../../../common/utils/get-startable-stoppable";
import electronUpdaterInjectable from "../../features/electron-updater.injectable";
import updateIsAvailableStateInjectable from "../../../update-app/update-is-available-state.injectable";
const synchronizeUpdateIsAvailableStateInjectable = getInjectable({
id: "synchronize-update-is-available-state",
instantiate: (di) => {
const electronUpdater = di.inject(electronUpdaterInjectable);
const updateIsAvailableState = di.inject(updateIsAvailableStateInjectable);
const makeUpdateAvailableFor = (available: boolean) => () => {
updateIsAvailableState.set(available);
};
return getStartableStoppable(
"synchronize-update-is-available-state",
() => {
const makeUpdateAvailable = makeUpdateAvailableFor(true);
const makeUpdateUnavailable = makeUpdateAvailableFor(false);
electronUpdater.on("update-downloaded", makeUpdateAvailable);
electronUpdater.on("update-not-available", makeUpdateUnavailable);
return () => {
electronUpdater.off("update-downloaded", makeUpdateAvailable);
electronUpdater.off("update-not-available", makeUpdateUnavailable);
};
},
);
},
});
export default synchronizeUpdateIsAvailableStateInjectable;

View File

@ -78,7 +78,7 @@ import getElectronThemeInjectable from "./electron-app/features/get-electron-the
import syncThemeFromOperatingSystemInjectable from "./electron-app/features/sync-theme-from-operating-system.injectable";
import platformInjectable from "../common/vars/platform.injectable";
import productNameInjectable from "./app-paths/app-name/product-name.injectable";
import synchronizeUpdateIsAvailableStateInjectable from "./electron-app/runnables/update-application/synchronize-update-is-available-state.injectable";
import syncUpdateIsReadyToBeInstalledInjectable from "./electron-app/runnables/update-application/sync-update-is-ready-to-be-installed.injectable";
import quitAndInstallUpdateInjectable from "./electron-app/features/quit-and-install-update.injectable";
export function getDiForUnitTesting(opts: GetDiForUnitTestingOptions = {}) {
@ -222,7 +222,7 @@ const overrideElectronFeatures = (di: DiContainer) => {
di.override(ipcMainInjectable, () => ({}));
di.override(getElectronThemeInjectable, () => () => "dark");
di.override(syncThemeFromOperatingSystemInjectable, () => ({ start: () => {}, stop: () => {} }));
di.override(synchronizeUpdateIsAvailableStateInjectable, () => ({ start: () => {}, stop: () => {} }));
di.override(syncUpdateIsReadyToBeInstalledInjectable, () => ({ start: () => {}, stop: () => {} }));
di.override(quitAndInstallUpdateInjectable, () => () => {});
di.override(createElectronWindowForInjectable, () => () => async () => ({

View File

@ -5,14 +5,14 @@
import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx";
import { trayMenuItemInjectionToken } from "../tray/tray-menu-item/tray-menu-item-injection-token";
import updateIsAvailableInjectable from "./update-is-available.injectable";
import updateIsReadyToBeInstalledInjectable from "./update-is-ready-to-be-installed.injectable";
import triggerApplicationUpdateInjectable from "./trigger-application-update.injectable";
const triggerApplicationUpdateTrayItemInjectable = getInjectable({
id: "trigger-application-update-tray-item",
instantiate: (di) => {
const updateIsAvailable = di.inject(updateIsAvailableInjectable);
const updateIsReadyToBeInstalled = di.inject(updateIsReadyToBeInstalledInjectable);
const triggerApplicationUpdate = di.inject(triggerApplicationUpdateInjectable);
return {
@ -21,7 +21,7 @@ const triggerApplicationUpdateTrayItemInjectable = getInjectable({
orderNumber: 50,
label: "Trigger update",
enabled: computed(() => true),
visible: computed(() => updateIsAvailable.get()),
visible: computed(() => updateIsReadyToBeInstalled.get()),
click: () => {
triggerApplicationUpdate();

View File

@ -1,19 +0,0 @@
/**
* 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 updateIsAvailableStateInjectable from "./update-is-available-state.injectable";
const updateIsAvailableInjectable = getInjectable({
id: "update-is-available",
instantiate: (di) => {
const updateIsAvailableState = di.inject(updateIsAvailableStateInjectable);
return computed(() => updateIsAvailableState.get());
},
});
export default updateIsAvailableInjectable;

View File

@ -5,9 +5,9 @@
import { getInjectable } from "@ogre-tools/injectable";
import { observable } from "mobx";
const updateIsAvailableState = getInjectable({
id: "update-is-available-state",
const updateIsReadyToBeInstalledState = getInjectable({
id: "update-is-ready-to-be-installed-state",
instantiate: () => observable.box<boolean>(false),
});
export default updateIsAvailableState;
export default updateIsReadyToBeInstalledState;

View File

@ -0,0 +1,19 @@
/**
* 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 updateIsReadyToBeInstalledInjectableState from "./update-is-ready-to-be-installed-state.injectable";
const updateIsReadyToBeInstalledInjectable = getInjectable({
id: "update-is-ready-to-be-installed",
instantiate: (di) => {
const updateIsReadyToBeInstalledState = di.inject(updateIsReadyToBeInstalledInjectableState);
return computed(() => updateIsReadyToBeInstalledState.get());
},
});
export default updateIsReadyToBeInstalledInjectable;

View File

@ -46,7 +46,7 @@ import namespaceStoreInjectable from "../+namespaces/store.injectable";
import historyInjectable from "../../navigation/history.injectable";
import trayMenuItemsInjectable from "../../../main/tray/tray-menu-item/tray-menu-items.injectable";
import type { TrayMenuItem } from "../../../main/tray/tray-menu-item/tray-menu-item-injection-token";
import updateIsAvailableStateInjectable from "../../../main/update-app/update-is-available-state.injectable";
import updateIsAvailableStateInjectable from "../../../main/update-app/update-is-ready-to-be-installed-state.injectable";
type Callback = (dis: DiContainers) => void | Promise<void>;