mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Consolidate runnables related to Electron
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
c36aaa557e
commit
57a1677c48
@ -3,12 +3,18 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { isDevelopment } from "../../../common/vars";
|
|
||||||
import packageInfo from "../../../../package.json";
|
import packageInfo from "../../../../package.json";
|
||||||
|
import isDevelopmentInjectable from "../../../common/vars/is-development.injectable";
|
||||||
|
|
||||||
const appNameInjectable = getInjectable({
|
const appNameInjectable = getInjectable({
|
||||||
id: "app-name",
|
id: "app-name",
|
||||||
instantiate: () => `${packageInfo.productName}${isDevelopment ? "Dev" : ""}`,
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const isDevelopment = di.inject(isDevelopmentInjectable);
|
||||||
|
|
||||||
|
return `${packageInfo.productName}${isDevelopment ? "Dev" : ""}`;
|
||||||
|
},
|
||||||
|
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import catalogSyncToRendererInjectable from "./catalog-sync-to-renderer.injectable";
|
import catalogSyncToRendererInjectable from "./catalog-sync-to-renderer.injectable";
|
||||||
import { beforeApplicationSoftQuitInjectionToken } from "../start-main-application/before-application-soft-quit/before-application-soft-quit-injection-token";
|
import { beforeQuitOfFrontEndInjectionToken } from "../start-main-application/before-quit-of-front-end/before-quit-of-front-end-injection-token";
|
||||||
|
|
||||||
const stopCatalogSyncInjectable = getInjectable({
|
const stopCatalogSyncInjectable = getInjectable({
|
||||||
id: "stop-catalog-sync",
|
id: "stop-catalog-sync",
|
||||||
@ -19,7 +19,7 @@ const stopCatalogSyncInjectable = getInjectable({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationSoftQuitInjectionToken,
|
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default stopCatalogSyncInjectable;
|
export default stopCatalogSyncInjectable;
|
||||||
|
|||||||
@ -1,25 +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 electronAppInjectable from "./electron-app.injectable";
|
|
||||||
import type { ActivationArgs } from "../start-main-application/after-application-activation/after-application-activation-injection-token";
|
|
||||||
|
|
||||||
const afterApplicationActivationInjectable = getInjectable({
|
|
||||||
id: "after-application-activation",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const app = di.inject(electronAppInjectable);
|
|
||||||
|
|
||||||
return (callback: (args: ActivationArgs) => Promise<void>) => {
|
|
||||||
app.on("activate", async (_, windowIsVisible) => {
|
|
||||||
await callback({
|
|
||||||
windowIsVisible,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default afterApplicationActivationInjectable;
|
|
||||||
@ -3,9 +3,9 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../../start-main-application/after-application-is-ready/after-application-is-ready-injection-token";
|
||||||
import exitAppInjectable from "../../../electron-app/exit-app.injectable";
|
import exitAppInjectable from "../features/exit-app.injectable";
|
||||||
import requestSingleInstanceLockInjectable from "../../../electron-app/request-single-instance-lock.injectable";
|
import requestSingleInstanceLockInjectable from "../features/request-single-instance-lock.injectable";
|
||||||
|
|
||||||
const enforceSingleApplicationInstanceInjectable = getInjectable({
|
const enforceSingleApplicationInstanceInjectable = getInjectable({
|
||||||
id: "enforce-single-application-instance",
|
id: "enforce-single-application-instance",
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
* 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 electronAppInjectable from "../electron-app.injectable";
|
||||||
|
import openDeepLinkInjectable from "../../protocol-handler/lens-protocol-router-main/open-deep-link-for-url/open-deep-link.injectable";
|
||||||
|
import loggerInjectable from "../../../common/logger.injectable";
|
||||||
|
import { afterApplicationIsReadyInjectionToken } from "../../start-main-application/after-application-is-ready/after-application-is-ready-injection-token";
|
||||||
|
import commandLineArgumentsInjectable from "../../utils/command-line-arguments.injectable";
|
||||||
|
import { pipeline } from "@ogre-tools/fp";
|
||||||
|
import { find, startsWith, toLower, map } from "lodash/fp";
|
||||||
|
import ensureMainWindowInjectable from "../../ensure-main-window/ensure-main-window.injectable";
|
||||||
|
import enforceSingleApplicationInstanceInjectable from "./enforce-single-application-instance.injectable";
|
||||||
|
|
||||||
|
const setupDeepLinkingInjectable = getInjectable({
|
||||||
|
id: "setup-deep-linking",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const app = di.inject(electronAppInjectable);
|
||||||
|
const logger = di.inject(loggerInjectable);
|
||||||
|
const openDeepLinkForUrl = di.inject(openDeepLinkInjectable);
|
||||||
|
|
||||||
|
const firstInstanceCommandLineArguments = di.inject(
|
||||||
|
commandLineArgumentsInjectable,
|
||||||
|
);
|
||||||
|
|
||||||
|
const ensureMainWindow = di.inject(ensureMainWindowInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
runAfter: di.inject(enforceSingleApplicationInstanceInjectable),
|
||||||
|
|
||||||
|
run: async () => {
|
||||||
|
{
|
||||||
|
logger.info(`📟 Setting protocol client for lens://`);
|
||||||
|
|
||||||
|
if (app.setAsDefaultProtocolClient("lens")) {
|
||||||
|
logger.info("📟 Protocol client register succeeded ✅");
|
||||||
|
} else {
|
||||||
|
logger.info("📟 Protocol client register failed ❗");
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on("open-url", async (event, url) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
await openDeepLinkForUrl(url);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on(
|
||||||
|
"second-instance",
|
||||||
|
|
||||||
|
async (_, secondInstanceCommandLineArguments) => {
|
||||||
|
const url = getDeepLinkUrl(secondInstanceCommandLineArguments);
|
||||||
|
|
||||||
|
await ensureMainWindow();
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
await openDeepLinkForUrl(url);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const url = getDeepLinkUrl(firstInstanceCommandLineArguments);
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
await openDeepLinkForUrl(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: afterApplicationIsReadyInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default setupDeepLinkingInjectable;
|
||||||
|
|
||||||
|
const getDeepLinkUrl = (commandLineArguments: string[]) =>
|
||||||
|
pipeline(commandLineArguments, map(toLower), find(startsWith("lens://")));
|
||||||
@ -3,8 +3,8 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../../start-main-application/after-application-is-ready/after-application-is-ready-injection-token";
|
||||||
import loggerInjectable from "../../../../common/logger.injectable";
|
import loggerInjectable from "../../../common/logger.injectable";
|
||||||
|
|
||||||
const setupDeveloperToolsInDevelopmentEnvironmentInjectable = getInjectable({
|
const setupDeveloperToolsInDevelopmentEnvironmentInjectable = getInjectable({
|
||||||
id: "setup-developer-tools-in-development-environment",
|
id: "setup-developer-tools-in-development-environment",
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* 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 { afterApplicationIsReadyInjectionToken } from "../../start-main-application/after-application-is-ready/after-application-is-ready-injection-token";
|
||||||
|
import powerMonitorInjectable from "../features/power-monitor.injectable";
|
||||||
|
import exitAppInjectable from "../features/exit-app.injectable";
|
||||||
|
|
||||||
|
const setupDeviceShutdownInjectable = getInjectable({
|
||||||
|
id: "setup-device-shutdown",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const powerMonitor = di.inject(powerMonitorInjectable);
|
||||||
|
const exitApp = di.inject(exitAppInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
run: () => {
|
||||||
|
powerMonitor.on("shutdown", async () => {
|
||||||
|
exitApp();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: afterApplicationIsReadyInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default setupDeviceShutdownInjectable;
|
||||||
@ -3,14 +3,15 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import directoryForLensLocalStorageInjectable from "../../../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
import directoryForLensLocalStorageInjectable from "../../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
||||||
import { setupIpcMainHandlers } from "./setup-ipc-main-handlers";
|
import { setupIpcMainHandlers } from "./setup-ipc-main-handlers";
|
||||||
import loggerInjectable from "../../../../../common/logger.injectable";
|
import loggerInjectable from "../../../../common/logger.injectable";
|
||||||
import clusterManagerInjectable from "../../../../cluster-manager.injectable";
|
import clusterManagerInjectable from "../../../cluster-manager.injectable";
|
||||||
import applicationMenuItemsInjectable from "../../../../menu/application-menu-items.injectable";
|
import applicationMenuItemsInjectable from "../../../menu/application-menu-items.injectable";
|
||||||
import getAbsolutePathInjectable from "../../../../../common/path/get-absolute-path.injectable";
|
import getAbsolutePathInjectable from "../../../../common/path/get-absolute-path.injectable";
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../../../start-main-application/after-application-is-ready/after-application-is-ready-injection-token";
|
||||||
import catalogEntityRegistryInjectable from "../../../../catalog/catalog-entity-registry.injectable";
|
import catalogEntityRegistryInjectable from "../../../catalog/catalog-entity-registry.injectable";
|
||||||
|
import clusterStoreInjectable from "../../../../common/cluster-store/cluster-store.injectable";
|
||||||
|
|
||||||
const setupIpcMainHandlersInjectable = getInjectable({
|
const setupIpcMainHandlersInjectable = getInjectable({
|
||||||
id: "setup-ipc-main-handlers",
|
id: "setup-ipc-main-handlers",
|
||||||
@ -26,6 +27,7 @@ const setupIpcMainHandlersInjectable = getInjectable({
|
|||||||
const applicationMenuItems = di.inject(applicationMenuItemsInjectable);
|
const applicationMenuItems = di.inject(applicationMenuItemsInjectable);
|
||||||
const getAbsolutePath = di.inject(getAbsolutePathInjectable);
|
const getAbsolutePath = di.inject(getAbsolutePathInjectable);
|
||||||
const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable);
|
const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable);
|
||||||
|
const clusterStore = di.inject(clusterStoreInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
run: () => {
|
run: () => {
|
||||||
@ -37,6 +39,7 @@ const setupIpcMainHandlersInjectable = getInjectable({
|
|||||||
directoryForLensLocalStorage,
|
directoryForLensLocalStorage,
|
||||||
clusterManager,
|
clusterManager,
|
||||||
catalogEntityRegistry,
|
catalogEntityRegistry,
|
||||||
|
clusterStore,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -4,26 +4,26 @@
|
|||||||
*/
|
*/
|
||||||
import type { IpcMainInvokeEvent } from "electron";
|
import type { IpcMainInvokeEvent } from "electron";
|
||||||
import { BrowserWindow, Menu } from "electron";
|
import { BrowserWindow, Menu } from "electron";
|
||||||
import { clusterFrameMap } from "../../../../../common/cluster-frames";
|
import { clusterFrameMap } from "../../../../common/cluster-frames";
|
||||||
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterVisibilityHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterDeleteHandler, clusterSetDeletingHandler, clusterClearDeletingHandler } from "../../../../../common/ipc/cluster";
|
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterVisibilityHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterDeleteHandler, clusterSetDeletingHandler, clusterClearDeletingHandler } from "../../../../common/ipc/cluster";
|
||||||
import type { ClusterId } from "../../../../../common/cluster-types";
|
import type { ClusterId } from "../../../../common/cluster-types";
|
||||||
import { ClusterStore } from "../../../../../common/cluster-store/cluster-store";
|
import { ClusterStore } from "../../../../common/cluster-store/cluster-store";
|
||||||
import { appEventBus } from "../../../../../common/app-event-bus/event-bus";
|
import { appEventBus } from "../../../../common/app-event-bus/event-bus";
|
||||||
import { broadcastMainChannel, broadcastMessage, ipcMainHandle, ipcMainOn } from "../../../../../common/ipc";
|
import { broadcastMainChannel, broadcastMessage, ipcMainHandle, ipcMainOn } from "../../../../common/ipc";
|
||||||
import type { CatalogEntityRegistry } from "../../../../catalog";
|
import type { CatalogEntityRegistry } from "../../../catalog";
|
||||||
import { pushCatalogToRenderer } from "../../../../catalog-pusher";
|
import { pushCatalogToRenderer } from "../../../catalog-pusher";
|
||||||
import type { ClusterManager } from "../../../../cluster-manager";
|
import type { ClusterManager } from "../../../cluster-manager";
|
||||||
import { ResourceApplier } from "../../../../resource-applier";
|
import { ResourceApplier } from "../../../resource-applier";
|
||||||
import { remove } from "fs-extra";
|
import { remove } from "fs-extra";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
import type { GetAbsolutePath } from "../../../../../common/path/get-absolute-path.injectable";
|
import type { GetAbsolutePath } from "../../../../common/path/get-absolute-path.injectable";
|
||||||
import type { MenuItemOpts } from "../../../../menu/application-menu-items.injectable";
|
import type { MenuItemOpts } from "../../../menu/application-menu-items.injectable";
|
||||||
import { windowActionHandleChannel, windowLocationChangedChannel, windowOpenAppMenuAsContextMenuChannel } from "../../../../../common/ipc/window";
|
import { windowActionHandleChannel, windowLocationChangedChannel, windowOpenAppMenuAsContextMenuChannel } from "../../../../common/ipc/window";
|
||||||
import { handleWindowAction, onLocationChange } from "../../../../ipc/window";
|
import { handleWindowAction, onLocationChange } from "../../../ipc/window";
|
||||||
import { openFilePickingDialogChannel } from "../../../../../common/ipc/dialog";
|
import { openFilePickingDialogChannel } from "../../../../common/ipc/dialog";
|
||||||
import { showOpenDialog } from "../../../../ipc/dialog";
|
import { showOpenDialog } from "../../../ipc/dialog";
|
||||||
import { getNativeThemeChannel } from "../../../../../common/ipc/native-theme";
|
import { getNativeThemeChannel } from "../../../../common/ipc/native-theme";
|
||||||
import { getNativeColorTheme } from "../../../../native-theme";
|
import { getNativeColorTheme } from "../../../native-theme";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
directoryForLensLocalStorage: string;
|
directoryForLensLocalStorage: string;
|
||||||
@ -31,9 +31,10 @@ interface Dependencies {
|
|||||||
applicationMenuItems: IComputedValue<MenuItemOpts[]>;
|
applicationMenuItems: IComputedValue<MenuItemOpts[]>;
|
||||||
clusterManager: ClusterManager;
|
clusterManager: ClusterManager;
|
||||||
catalogEntityRegistry: CatalogEntityRegistry;
|
catalogEntityRegistry: CatalogEntityRegistry;
|
||||||
|
clusterStore: ClusterStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setupIpcMainHandlers = ({ applicationMenuItems, directoryForLensLocalStorage, getAbsolutePath, clusterManager, catalogEntityRegistry }: Dependencies) => {
|
export const setupIpcMainHandlers = ({ applicationMenuItems, directoryForLensLocalStorage, getAbsolutePath, clusterManager, catalogEntityRegistry, clusterStore }: Dependencies) => {
|
||||||
ipcMainHandle(clusterActivateHandler, (event, clusterId: ClusterId, force = false) => {
|
ipcMainHandle(clusterActivateHandler, (event, clusterId: ClusterId, force = false) => {
|
||||||
return ClusterStore.getInstance()
|
return ClusterStore.getInstance()
|
||||||
.getById(clusterId)
|
.getById(clusterId)
|
||||||
@ -167,4 +168,6 @@ export const setupIpcMainHandlers = ({ applicationMenuItems, directoryForLensLoc
|
|||||||
ipcMainHandle(getNativeThemeChannel, () => {
|
ipcMainHandle(getNativeThemeChannel, () => {
|
||||||
return getNativeColorTheme();
|
return getNativeColorTheme();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
clusterStore.provideInitialFromMain();
|
||||||
};
|
};
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* 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 electronAppInjectable from "../electron-app.injectable";
|
||||||
|
import { afterApplicationIsReadyInjectionToken } from "../../start-main-application/after-application-is-ready/after-application-is-ready-injection-token";
|
||||||
|
import ensureMainWindowInjectable from "../../ensure-main-window/ensure-main-window.injectable";
|
||||||
|
import loggerInjectable from "../../../common/logger.injectable";
|
||||||
|
|
||||||
|
const setupMainWindowVisibilityAfterActivationInjectable = getInjectable({
|
||||||
|
id: "setup-main-window-visibility-after-activation",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const app = di.inject(electronAppInjectable);
|
||||||
|
const ensureMainWindow = di.inject(ensureMainWindowInjectable);
|
||||||
|
const logger = di.inject(loggerInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
run: () => {
|
||||||
|
app.on("activate", async (_, windowIsVisible) => {
|
||||||
|
logger.info("APP:ACTIVATE", { hasVisibleWindows: windowIsVisible });
|
||||||
|
|
||||||
|
if (!windowIsVisible) {
|
||||||
|
await ensureMainWindow(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: afterApplicationIsReadyInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default setupMainWindowVisibilityAfterActivationInjectable;
|
||||||
@ -3,8 +3,8 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { broadcastNativeThemeOnUpdate } from "../../../native-theme";
|
import { broadcastNativeThemeOnUpdate } from "../../native-theme";
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../../start-main-application/after-application-is-ready/after-application-is-ready-injection-token";
|
||||||
|
|
||||||
const setupOsThemeUpdatesInjectable = getInjectable({
|
const setupOsThemeUpdatesInjectable = getInjectable({
|
||||||
id: "setup-os-theme-updates",
|
id: "setup-os-theme-updates",
|
||||||
@ -3,17 +3,16 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { afterRootFrameIsReadyInjectionToken } from "../after-root-frame-is-ready-injection-token";
|
import { afterRootFrameIsReadyInjectionToken } from "../../start-main-application/after-root-frame-is-ready/after-root-frame-is-ready-injection-token";
|
||||||
import { startUpdateChecking } from "../../../app-updater";
|
import { startUpdateChecking } from "../../app-updater";
|
||||||
import isAutoUpdateEnabledInjectable from "../../../is-auto-update-enabled.injectable";
|
import isAutoUpdateEnabledInjectable from "../../is-auto-update-enabled.injectable";
|
||||||
|
|
||||||
const startUpdateCheckingInjectable = getInjectable({
|
const setupUpdateCheckingInjectable = getInjectable({
|
||||||
id: "start-update-checking",
|
id: "setup-update-checking",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const isAutoUpdateEnabled = di.inject(isAutoUpdateEnabledInjectable);
|
const isAutoUpdateEnabled = di.inject(isAutoUpdateEnabledInjectable);
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
run: () => {
|
run: () => {
|
||||||
startUpdateChecking(isAutoUpdateEnabled)();
|
startUpdateChecking(isAutoUpdateEnabled)();
|
||||||
@ -26,4 +25,4 @@ const startUpdateCheckingInjectable = getInjectable({
|
|||||||
injectionToken: afterRootFrameIsReadyInjectionToken,
|
injectionToken: afterRootFrameIsReadyInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default startUpdateCheckingInjectable;
|
export default setupUpdateCheckingInjectable;
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* 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 appNameInjectable from "../../app-paths/app-name/app-name.injectable";
|
||||||
|
import { beforeApplicationIsReadyInjectionToken } from "../../start-main-application/before-application-is-ready/before-application-is-ready-injection-token";
|
||||||
|
import electronAppInjectable from "../electron-app.injectable";
|
||||||
|
|
||||||
|
const setupApplicationNameInjectable = getInjectable({
|
||||||
|
id: "setup-application-name",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const app = di.inject(electronAppInjectable);
|
||||||
|
const appName = di.inject(appNameInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
run: () => {
|
||||||
|
app.setName(appName);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: beforeApplicationIsReadyInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default setupApplicationNameInjectable;
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* 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 { beforeApplicationIsReadyInjectionToken } from "../../start-main-application/before-application-is-ready/before-application-is-ready-injection-token";
|
||||||
|
import { beforeQuitOfFrontEndInjectionToken } from "../../start-main-application/before-quit-of-front-end/before-quit-of-front-end-injection-token";
|
||||||
|
import { runManyFor } from "../../start-main-application/run-many-for";
|
||||||
|
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/before-quit-of-back-end/before-quit-of-back-end-injection-token";
|
||||||
|
import electronAppInjectable from "../electron-app.injectable";
|
||||||
|
import isIntegrationTestingInjectable from "../../../common/vars/is-integration-testing.injectable";
|
||||||
|
import autoUpdaterInjectable from "../features/auto-updater.injectable";
|
||||||
|
|
||||||
|
const setupRunnablesBeforeClosingOfApplicationInjectable = getInjectable({
|
||||||
|
id: "setup-closing-of-application",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const runMany = runManyFor(di);
|
||||||
|
|
||||||
|
const runRunnablesBeforeQuitOfFrontEnd = runMany(
|
||||||
|
beforeQuitOfFrontEndInjectionToken,
|
||||||
|
);
|
||||||
|
|
||||||
|
const runRunnablesBeforeQuitOfBackEnd = runMany(
|
||||||
|
beforeQuitOfBackEndInjectionToken,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
run: () => {
|
||||||
|
const app = di.inject(electronAppInjectable);
|
||||||
|
|
||||||
|
const isIntegrationTesting = di.inject(isIntegrationTestingInjectable);
|
||||||
|
const autoUpdater = di.inject(autoUpdaterInjectable);
|
||||||
|
|
||||||
|
let isAutoUpdating = false;
|
||||||
|
|
||||||
|
autoUpdater.on("before-quit-for-update", () => {
|
||||||
|
isAutoUpdating = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on("will-quit", async ({ preventDefault: cancelNativeQuit }) => {
|
||||||
|
await runRunnablesBeforeQuitOfFrontEnd();
|
||||||
|
|
||||||
|
const shouldQuitBackEnd = isIntegrationTesting || isAutoUpdating;
|
||||||
|
|
||||||
|
if (shouldQuitBackEnd) {
|
||||||
|
await runRunnablesBeforeQuitOfBackEnd();
|
||||||
|
} else {
|
||||||
|
cancelNativeQuit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: beforeApplicationIsReadyInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default setupRunnablesBeforeClosingOfApplicationInjectable;
|
||||||
@ -1,22 +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 powerMonitorInjectable from "./power-monitor.injectable";
|
|
||||||
|
|
||||||
const beforeDeviceShutdownInjectable = getInjectable({
|
|
||||||
id: "before-device-shutdown",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const powerMonitor = di.inject(powerMonitorInjectable);
|
|
||||||
|
|
||||||
return (callback: () => Promise<void> | void) => {
|
|
||||||
powerMonitor.on("shutdown", async () => {
|
|
||||||
await callback();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default beforeDeviceShutdownInjectable;
|
|
||||||
@ -3,8 +3,8 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { beforeApplicationHardQuitInjectionToken } from "../before-application-hard-quit-injection-token";
|
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/before-quit-of-back-end/before-quit-of-back-end-injection-token";
|
||||||
import lensProtocolRouterMainInjectable from "../../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
import lensProtocolRouterMainInjectable from "../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
||||||
|
|
||||||
const cleanUpDeepLinkingInjectable = getInjectable({
|
const cleanUpDeepLinkingInjectable = getInjectable({
|
||||||
id: "clean-up-deep-linking",
|
id: "clean-up-deep-linking",
|
||||||
@ -19,7 +19,7 @@ const cleanUpDeepLinkingInjectable = getInjectable({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationHardQuitInjectionToken,
|
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default cleanUpDeepLinkingInjectable;
|
export default cleanUpDeepLinkingInjectable;
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronAppInjectable from "./electron-app.injectable";
|
import electronAppInjectable from "../electron-app.injectable";
|
||||||
|
|
||||||
const disableHardwareAccelerationInjectable = getInjectable({
|
const disableHardwareAccelerationInjectable = getInjectable({
|
||||||
id: "disable-hardware-acceleration",
|
id: "disable-hardware-acceleration",
|
||||||
14
src/main/electron-app/features/electron-dialog.injectable.ts
Normal file
14
src/main/electron-app/features/electron-dialog.injectable.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 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 { dialog } from "electron";
|
||||||
|
|
||||||
|
const electronDialogInjectable = getInjectable({
|
||||||
|
id: "electron-dialog",
|
||||||
|
instantiate: () => dialog,
|
||||||
|
causesSideEffects: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default electronDialogInjectable;
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronAppInjectable from "./electron-app.injectable";
|
import electronAppInjectable from "../electron-app.injectable";
|
||||||
|
|
||||||
const exitAppInjectable = getInjectable({
|
const exitAppInjectable = getInjectable({
|
||||||
id: "exit-app",
|
id: "exit-app",
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronAppInjectable from "./electron-app.injectable";
|
import electronAppInjectable from "../electron-app.injectable";
|
||||||
|
|
||||||
const getCommandLineSwitchInjectable = getInjectable({
|
const getCommandLineSwitchInjectable = getInjectable({
|
||||||
id: "get-command-line-switch",
|
id: "get-command-line-switch",
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { protocol } from "electron";
|
import { protocol } from "electron";
|
||||||
import getAbsolutePathInjectable from "../../common/path/get-absolute-path.injectable";
|
import getAbsolutePathInjectable from "../../../common/path/get-absolute-path.injectable";
|
||||||
|
|
||||||
const registerFileProtocolInjectable = getInjectable({
|
const registerFileProtocolInjectable = getInjectable({
|
||||||
id: "register-file-protocol",
|
id: "register-file-protocol",
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronAppInjectable from "./electron-app.injectable";
|
import electronAppInjectable from "../electron-app.injectable";
|
||||||
|
|
||||||
const requestSingleInstanceLockInjectable = getInjectable({
|
const requestSingleInstanceLockInjectable = getInjectable({
|
||||||
id: "request-single-instance-lock",
|
id: "request-single-instance-lock",
|
||||||
@ -3,9 +3,9 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronAppInjectable from "./electron-app.injectable";
|
import electronAppInjectable from "../electron-app.injectable";
|
||||||
import isMacInjectable from "../../common/vars/is-mac.injectable";
|
import isMacInjectable from "../../../common/vars/is-mac.injectable";
|
||||||
import commandLineArgumentsInjectable from "../utils/command-line-arguments.injectable";
|
import commandLineArgumentsInjectable from "../../utils/command-line-arguments.injectable";
|
||||||
|
|
||||||
const shouldStartHiddenInjectable = getInjectable({
|
const shouldStartHiddenInjectable = getInjectable({
|
||||||
id: "should-start-hidden",
|
id: "should-start-hidden",
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 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 electronDialogInjectable from "./electron-dialog.injectable";
|
||||||
|
|
||||||
|
const showErrorPopupInjectable = getInjectable({
|
||||||
|
id: "show-error-popup",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const dialog = di.inject(electronDialogInjectable);
|
||||||
|
|
||||||
|
return (heading: string, message: string) => {
|
||||||
|
dialog.showErrorBox(heading, message);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default showErrorPopupInjectable;
|
||||||
@ -1,28 +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 loggerInjectable from "../../common/logger.injectable";
|
|
||||||
import electronAppInjectable from "./electron-app.injectable";
|
|
||||||
|
|
||||||
const registerProtocolClientInjectable = getInjectable({
|
|
||||||
id: "register-protocol-client",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const logger = di.inject(loggerInjectable);
|
|
||||||
const app = di.inject(electronAppInjectable);
|
|
||||||
|
|
||||||
return (protocol: string) => {
|
|
||||||
logger.info(`📟 Setting protocol client for ${protocol}://`);
|
|
||||||
|
|
||||||
if (app.setAsDefaultProtocolClient(protocol)) {
|
|
||||||
logger.info("📟 Protocol client register succeeded ✅");
|
|
||||||
} else {
|
|
||||||
logger.info("📟 Protocol client register failed ❗");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default registerProtocolClientInjectable;
|
|
||||||
@ -1,20 +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 electronAppInjectable from "./electron-app.injectable";
|
|
||||||
|
|
||||||
const setApplicationNameInjectable = getInjectable({
|
|
||||||
id: "set-application-name",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const app = di.inject(electronAppInjectable);
|
|
||||||
|
|
||||||
return (name: string) => {
|
|
||||||
app.setName(name);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default setApplicationNameInjectable;
|
|
||||||
@ -1,46 +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 electronAppInjectable from "./electron-app.injectable";
|
|
||||||
import isIntegrationTestingInjectable from "../../common/vars/is-integration-testing.injectable";
|
|
||||||
import autoUpdaterInjectable from "./auto-updater.injectable";
|
|
||||||
|
|
||||||
interface CallbackArgs {
|
|
||||||
cancel: () => void;
|
|
||||||
shouldOnlySoftQuit: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const whenApplicationWillQuitInjectable = getInjectable({
|
|
||||||
id: "when-application-will-quit",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const app = di.inject(electronAppInjectable);
|
|
||||||
|
|
||||||
const isIntegrationTesting = di.inject(isIntegrationTestingInjectable);
|
|
||||||
const autoUpdater = di.inject(autoUpdaterInjectable);
|
|
||||||
|
|
||||||
let isAutoUpdating = false;
|
|
||||||
|
|
||||||
return (callback: (args: CallbackArgs) => void) => {
|
|
||||||
autoUpdater.on("before-quit-for-update", () => {
|
|
||||||
isAutoUpdating = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on("will-quit", (event) => {
|
|
||||||
const shouldHardQuit = isIntegrationTesting || isAutoUpdating;
|
|
||||||
|
|
||||||
callback({
|
|
||||||
cancel: () => {
|
|
||||||
event.preventDefault();
|
|
||||||
},
|
|
||||||
|
|
||||||
shouldOnlySoftQuit: !shouldHardQuit,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default whenApplicationWillQuitInjectable;
|
|
||||||
@ -1,33 +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 electronAppInjectable from "./electron-app.injectable";
|
|
||||||
|
|
||||||
interface CallbackArgs {
|
|
||||||
cancel: () => void;
|
|
||||||
url: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const whenOpeningUrlInjectable = getInjectable({
|
|
||||||
id: "when-opening-url",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const app = di.inject(electronAppInjectable);
|
|
||||||
|
|
||||||
return (callback: (args: CallbackArgs) => void | Promise<void>) => {
|
|
||||||
app.on("open-url", async (event, url) => {
|
|
||||||
await callback({
|
|
||||||
cancel: () => {
|
|
||||||
event.preventDefault();
|
|
||||||
},
|
|
||||||
|
|
||||||
url,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default whenOpeningUrlInjectable;
|
|
||||||
@ -1,28 +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 electronAppInjectable from "./electron-app.injectable";
|
|
||||||
|
|
||||||
interface CallbackArgs {
|
|
||||||
commandLineArguments: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const whenSecondInstanceInjectable = getInjectable({
|
|
||||||
id: "when-second-instance",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const app = di.inject(electronAppInjectable);
|
|
||||||
|
|
||||||
return (callback: (args: CallbackArgs) => void | Promise<void>) => {
|
|
||||||
app.on("second-instance", async (_, commandLineArguments) => {
|
|
||||||
await callback({
|
|
||||||
commandLineArguments,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default whenSecondInstanceInjectable;
|
|
||||||
20
src/main/ensure-main-window/ensure-main-window.injectable.ts
Normal file
20
src/main/ensure-main-window/ensure-main-window.injectable.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 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 windowManagerInjectable from "../window-manager.injectable";
|
||||||
|
|
||||||
|
const ensureMainWindowInjectable = getInjectable({
|
||||||
|
id: "ensure-main-window",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const windowManager = di.inject(windowManagerInjectable);
|
||||||
|
|
||||||
|
return async (showSplash = true) => {
|
||||||
|
await windowManager.ensureMainWindow(showSplash);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default ensureMainWindowInjectable;
|
||||||
@ -39,14 +39,14 @@ import type { AppEvent } from "../common/app-event-bus/event-bus";
|
|||||||
import commandLineArgumentsInjectable from "./utils/command-line-arguments.injectable";
|
import commandLineArgumentsInjectable from "./utils/command-line-arguments.injectable";
|
||||||
import initializeExtensionsInjectable from "./start-main-application/after-application-is-ready/implementations/initialize-extensions.injectable";
|
import initializeExtensionsInjectable from "./start-main-application/after-application-is-ready/implementations/initialize-extensions.injectable";
|
||||||
import lensResourcesDirInjectable from "../common/vars/lens-resources-dir.injectable";
|
import lensResourcesDirInjectable from "../common/vars/lens-resources-dir.injectable";
|
||||||
import registerFileProtocolInjectable from "./electron-app/register-file-protocol.injectable";
|
import registerFileProtocolInjectable from "./electron-app/features/register-file-protocol.injectable";
|
||||||
import environmentVariablesInjectable from "../common/utils/environment-variables.injectable";
|
import environmentVariablesInjectable from "../common/utils/environment-variables.injectable";
|
||||||
import { CatalogCategoryRegistry } from "../common/catalog";
|
import { CatalogCategoryRegistry } from "../common/catalog";
|
||||||
import catalogCategoryRegistryInjectable from "../common/catalog/catalog-category-registry.injectable";
|
import catalogCategoryRegistryInjectable from "../common/catalog/catalog-category-registry.injectable";
|
||||||
import setupIpcMainHandlersInjectable from "./start-main-application/after-application-is-ready/implementations/setup-ipc-main-handlers/setup-ipc-main-handlers.injectable";
|
import setupIpcMainHandlersInjectable from "./electron-app/after-application-is-ready/setup-ipc-main-handlers/setup-ipc-main-handlers.injectable";
|
||||||
import setupLensProxyInjectable from "./start-main-application/after-application-is-ready/implementations/setup-lens-proxy.injectable";
|
import setupLensProxyInjectable from "./start-main-application/after-application-is-ready/implementations/setup-lens-proxy.injectable";
|
||||||
import setupListenerForRootFrameRenderingInjectable from "./start-main-application/after-application-is-ready/implementations/setup-listener-for-root-frame-rendering.injectable";
|
import setupRunnablesForAfterRootFrameIsReadyInjectable from "./start-main-application/after-application-is-ready/implementations/setup-runnables-for-after-root-frame-is-ready.injectable";
|
||||||
import setupOsThemeUpdatesInjectable from "./start-main-application/after-application-is-ready/implementations/setup-os-theme-updates.injectable";
|
import setupOsThemeUpdatesInjectable from "./electron-app/after-application-is-ready/setup-os-theme-updates.injectable";
|
||||||
import setupSentryInjectable from "./start-main-application/after-application-is-ready/implementations/setup-sentry.injectable";
|
import setupSentryInjectable from "./start-main-application/after-application-is-ready/implementations/setup-sentry.injectable";
|
||||||
import setupShellInjectable from "./start-main-application/after-application-is-ready/implementations/setup-shell.injectable";
|
import setupShellInjectable from "./start-main-application/after-application-is-ready/implementations/setup-shell.injectable";
|
||||||
import setupSyncingOfWeblinksInjectable from "./start-main-application/after-application-is-ready/implementations/setup-syncing-of-weblinks.injectable";
|
import setupSyncingOfWeblinksInjectable from "./start-main-application/after-application-is-ready/implementations/setup-syncing-of-weblinks.injectable";
|
||||||
@ -57,19 +57,18 @@ import windowManagerInjectable from "./window-manager.injectable";
|
|||||||
import isDevelopmentInjectable from "../common/vars/is-development.injectable";
|
import isDevelopmentInjectable from "../common/vars/is-development.injectable";
|
||||||
import setupSystemCaInjectable from "./start-main-application/before-application-is-ready/implementations/setup-system-ca.injectable";
|
import setupSystemCaInjectable from "./start-main-application/before-application-is-ready/implementations/setup-system-ca.injectable";
|
||||||
import whenApplicationWillQuitInjectable from "./electron-app/when-application-will-quit.injectable";
|
import whenApplicationWillQuitInjectable from "./electron-app/when-application-will-quit.injectable";
|
||||||
import whenOpeningUrlInjectable from "./electron-app/when-opening-url.injectable";
|
import setupDeepLinkingInjectable from "./electron-app/after-application-is-ready/setup-deep-linking.injectable";
|
||||||
import whenSecondInstanceInjectable from "./electron-app/when-second-instance.injectable";
|
import whenSecondInstanceInjectable from "./electron-app/when-second-instance.injectable";
|
||||||
import exitAppInjectable from "./electron-app/exit-app.injectable";
|
import exitAppInjectable from "./electron-app/features/exit-app.injectable";
|
||||||
import setApplicationNameInjectable from "./electron-app/set-application-name.injectable";
|
import setApplicationNameInjectable from "./electron-app/features/set-application-name.injectable";
|
||||||
import getCommandLineSwitchInjectable from "./electron-app/get-command-line-switch.injectable";
|
import getCommandLineSwitchInjectable from "./electron-app/features/get-command-line-switch.injectable";
|
||||||
import requestSingleInstanceLockInjectable from "./electron-app/request-single-instance-lock.injectable";
|
import requestSingleInstanceLockInjectable from "./electron-app/features/request-single-instance-lock.injectable";
|
||||||
import disableHardwareAccelerationInjectable from "./electron-app/disable-hardware-acceleration.injectable";
|
import disableHardwareAccelerationInjectable from "./electron-app/features/disable-hardware-acceleration.injectable";
|
||||||
import shouldStartHiddenInjectable from "./electron-app/should-start-hidden.injectable";
|
import shouldStartHiddenInjectable from "./electron-app/features/should-start-hidden.injectable";
|
||||||
import registerProtocolClientInjectable from "./electron-app/register-protocol-client.injectable";
|
|
||||||
import getElectronAppPathInjectable from "./app-paths/get-electron-app-path/get-electron-app-path.injectable";
|
import getElectronAppPathInjectable from "./app-paths/get-electron-app-path/get-electron-app-path.injectable";
|
||||||
import setElectronAppPathInjectable from "./app-paths/set-electron-app-path/set-electron-app-path.injectable";
|
import setElectronAppPathInjectable from "./app-paths/set-electron-app-path/set-electron-app-path.injectable";
|
||||||
import afterApplicationActivationInjectable from "./electron-app/after-application-activation.injectable";
|
import setupMainWindowVisibilityAfterActivationInjectable from "./electron-app/after-application-is-ready/setup-main-window-visibility-after-activation.injectable";
|
||||||
import beforeDeviceShutdownInjectable from "./electron-app/before-device-shutdown.injectable";
|
import setupDeviceShutdownInjectable from "./electron-app/after-application-is-ready/setup-device-shutdown.injectable";
|
||||||
|
|
||||||
export const getDiForUnitTesting = (
|
export const getDiForUnitTesting = (
|
||||||
{ doGeneralOverrides } = { doGeneralOverrides: false },
|
{ doGeneralOverrides } = { doGeneralOverrides: false },
|
||||||
@ -169,7 +168,7 @@ const overrideRunnablesHavingSideEffects = (di: DiContainer) => {
|
|||||||
initializeExtensionsInjectable,
|
initializeExtensionsInjectable,
|
||||||
setupIpcMainHandlersInjectable,
|
setupIpcMainHandlersInjectable,
|
||||||
setupLensProxyInjectable,
|
setupLensProxyInjectable,
|
||||||
setupListenerForRootFrameRenderingInjectable,
|
setupRunnablesForAfterRootFrameIsReadyInjectable,
|
||||||
setupOsThemeUpdatesInjectable,
|
setupOsThemeUpdatesInjectable,
|
||||||
setupSentryInjectable,
|
setupSentryInjectable,
|
||||||
setupShellInjectable,
|
setupShellInjectable,
|
||||||
@ -184,27 +183,35 @@ const overrideOperatingSystem = (di: DiContainer) => {
|
|||||||
di.override(isMacInjectable, () => true);
|
di.override(isMacInjectable, () => true);
|
||||||
di.override(isWindowsInjectable, () => false);
|
di.override(isWindowsInjectable, () => false);
|
||||||
di.override(isLinuxInjectable, () => false);
|
di.override(isLinuxInjectable, () => false);
|
||||||
|
|
||||||
di.override(getAbsolutePathInjectable, () => getAbsolutePathFake);
|
di.override(getAbsolutePathInjectable, () => getAbsolutePathFake);
|
||||||
di.override(joinPathsInjectable, () => joinPathsFake);
|
di.override(joinPathsInjectable, () => joinPathsFake);
|
||||||
};
|
};
|
||||||
|
|
||||||
const overrideElectron = (di: DiContainer) => {
|
const overrideElectron = (di: DiContainer) => {
|
||||||
di.override(afterApplicationActivationInjectable, () => () => {});
|
di.override(setupMainWindowVisibilityAfterActivationInjectable, () => ({
|
||||||
|
run: () => {},
|
||||||
|
}));
|
||||||
|
|
||||||
|
di.override(setupDeviceShutdownInjectable, () => ({
|
||||||
|
run: () => {},
|
||||||
|
}));
|
||||||
|
|
||||||
|
di.override(setupDeepLinkingInjectable, () => ({ run: () => {} }));
|
||||||
di.override(whenApplicationWillQuitInjectable, () => () => {});
|
di.override(whenApplicationWillQuitInjectable, () => () => {});
|
||||||
di.override(whenOpeningUrlInjectable, () => () => {});
|
|
||||||
di.override(whenSecondInstanceInjectable, () => () => {});
|
di.override(whenSecondInstanceInjectable, () => () => {});
|
||||||
di.override(beforeDeviceShutdownInjectable, () => () => {});
|
|
||||||
di.override(exitAppInjectable, () => () => {});
|
di.override(exitAppInjectable, () => () => {});
|
||||||
di.override(setApplicationNameInjectable, () => () => {});
|
di.override(setApplicationNameInjectable, () => () => {});
|
||||||
di.override(getCommandLineSwitchInjectable, () => () => "irrelevant");
|
di.override(getCommandLineSwitchInjectable, () => () => "irrelevant");
|
||||||
di.override(requestSingleInstanceLockInjectable, () => () => true);
|
di.override(requestSingleInstanceLockInjectable, () => () => true);
|
||||||
di.override(disableHardwareAccelerationInjectable, () => () => {});
|
di.override(disableHardwareAccelerationInjectable, () => () => {});
|
||||||
di.override(shouldStartHiddenInjectable, () => true);
|
di.override(shouldStartHiddenInjectable, () => true);
|
||||||
di.override(registerProtocolClientInjectable, () => () => {});
|
|
||||||
di.override(getElectronAppPathInjectable, () => (name: string) => `some-electron-app-path-for-${kebabCase(name)}`);
|
|
||||||
di.override(setElectronAppPathInjectable, () => () => {});
|
|
||||||
|
|
||||||
|
di.override(
|
||||||
|
getElectronAppPathInjectable,
|
||||||
|
() => (name: string) => `some-electron-app-path-for-${kebabCase(name)}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
di.override(setElectronAppPathInjectable, () => () => {});
|
||||||
di.override(isAutoUpdateEnabledInjectable, () => () => false);
|
di.override(isAutoUpdateEnabledInjectable, () => () => false);
|
||||||
di.override(registerFileProtocolInjectable, () => () => {});
|
di.override(registerFileProtocolInjectable, () => () => {});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import applicationMenuInjectable from "./application-menu.injectable";
|
import applicationMenuInjectable from "./application-menu.injectable";
|
||||||
import { beforeApplicationHardQuitInjectionToken } from "../start-main-application/before-application-hard-quit/before-application-hard-quit-injection-token";
|
import { beforeQuitOfBackEndInjectionToken } from "../start-main-application/before-quit-of-back-end/before-quit-of-back-end-injection-token";
|
||||||
|
|
||||||
const stopApplicationMenuInjectable = getInjectable({
|
const stopApplicationMenuInjectable = getInjectable({
|
||||||
id: "stop-application-menu",
|
id: "stop-application-menu",
|
||||||
@ -21,7 +21,7 @@ const stopApplicationMenuInjectable = getInjectable({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationHardQuitInjectionToken,
|
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default stopApplicationMenuInjectable;
|
export default stopApplicationMenuInjectable;
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 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 lensProtocolRouterMainInjectable from "../lens-protocol-router-main.injectable";
|
||||||
|
|
||||||
|
const openDeepLinkInjectable = getInjectable({
|
||||||
|
id: "open-deep-link",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const protocolRouter = di.inject(lensProtocolRouterMainInjectable);
|
||||||
|
|
||||||
|
return async (url: string) => {
|
||||||
|
await protocolRouter.route(url);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default openDeepLinkInjectable;
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
|
||||||
import type { Runnable } from "../run-many-for";
|
|
||||||
|
|
||||||
export interface ActivationArgs {
|
|
||||||
windowIsVisible: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const afterApplicationActivationInjectionToken = getInjectionToken<Runnable<ActivationArgs>>({
|
|
||||||
id: "after-application-activation",
|
|
||||||
});
|
|
||||||
@ -1,31 +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 loggerInjectable from "../../../../common/logger.injectable";
|
|
||||||
import windowManagerInjectable from "../../../window-manager.injectable";
|
|
||||||
import { afterApplicationActivationInjectionToken } from "../after-application-activation-injection-token";
|
|
||||||
|
|
||||||
const ensureMainWindowVisibilityInjectable = getInjectable({
|
|
||||||
id: "ensure-main-window-visibility",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const logger = di.inject(loggerInjectable);
|
|
||||||
const windowManager = di.inject(windowManagerInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
run: async ({ windowIsVisible }) => {
|
|
||||||
logger.info("APP:ACTIVATE", { hasVisibleWindows: windowIsVisible });
|
|
||||||
|
|
||||||
if (!windowIsVisible) {
|
|
||||||
await windowManager.ensureMainWindow(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
injectionToken: afterApplicationActivationInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ensureMainWindowVisibilityInjectable;
|
|
||||||
@ -9,7 +9,7 @@ import type { LensExtensionId } from "../../../../extensions/lens-extension";
|
|||||||
import loggerInjectable from "../../../../common/logger.injectable";
|
import loggerInjectable from "../../../../common/logger.injectable";
|
||||||
import extensionDiscoveryInjectable from "../../../../extensions/extension-discovery/extension-discovery.injectable";
|
import extensionDiscoveryInjectable from "../../../../extensions/extension-discovery/extension-discovery.injectable";
|
||||||
import extensionLoaderInjectable from "../../../../extensions/extension-loader/extension-loader.injectable";
|
import extensionLoaderInjectable from "../../../../extensions/extension-loader/extension-loader.injectable";
|
||||||
import { dialog } from "electron";
|
import showErrorPopupInjectable from "../../../electron-app/features/show-error-popup.injectable";
|
||||||
|
|
||||||
const initializeExtensionsInjectable = getInjectable({
|
const initializeExtensionsInjectable = getInjectable({
|
||||||
id: "initialize-extensions",
|
id: "initialize-extensions",
|
||||||
@ -18,6 +18,7 @@ const initializeExtensionsInjectable = getInjectable({
|
|||||||
const logger = di.inject(loggerInjectable);
|
const logger = di.inject(loggerInjectable);
|
||||||
const extensionDiscovery = di.inject(extensionDiscoveryInjectable);
|
const extensionDiscovery = di.inject(extensionDiscoveryInjectable);
|
||||||
const extensionLoader = di.inject(extensionLoaderInjectable);
|
const extensionLoader = di.inject(extensionLoaderInjectable);
|
||||||
|
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
run: async () => {
|
run: async () => {
|
||||||
@ -44,12 +45,13 @@ const initializeExtensionsInjectable = getInjectable({
|
|||||||
|
|
||||||
extensionLoader.initExtensions(extensions);
|
extensionLoader.initExtensions(extensions);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox(
|
showErrorPopup(
|
||||||
"Lens Error",
|
"Lens Error",
|
||||||
`Could not load extensions${
|
`Could not load extensions${
|
||||||
error?.message ? `: ${error.message}` : ""
|
error?.message ? `: ${error.message}` : ""
|
||||||
}`,
|
}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
console.trace();
|
console.trace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +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 { runManyFor } from "../../run-many-for";
|
|
||||||
import afterApplicationActivationInjectable from "../../../electron-app/after-application-activation.injectable";
|
|
||||||
import { afterApplicationActivationInjectionToken } from "../../after-application-activation/after-application-activation-injection-token";
|
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
|
||||||
|
|
||||||
const setupApplicationActivationEventsInjectable = getInjectable({
|
|
||||||
id: "setup-application-activation-events",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const afterApplicationActivation = di.inject(afterApplicationActivationInjectable);
|
|
||||||
const runRunnables = runManyFor(di)(afterApplicationActivationInjectionToken);
|
|
||||||
|
|
||||||
return {
|
|
||||||
run: () => {
|
|
||||||
afterApplicationActivation(runRunnables);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
injectionToken: afterApplicationIsReadyInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default setupApplicationActivationEventsInjectable;
|
|
||||||
@ -1,66 +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 lensProtocolRouterMainInjectable from "../../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
|
||||||
import windowManagerInjectable from "../../../window-manager.injectable";
|
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
|
||||||
import whenOpeningUrlInjectable from "../../../electron-app/when-opening-url.injectable";
|
|
||||||
import whenSecondInstanceInjectable from "../../../electron-app/when-second-instance.injectable";
|
|
||||||
import type { LensProtocolRouterMain } from "../../../protocol-handler";
|
|
||||||
import { pipeline } from "@ogre-tools/fp";
|
|
||||||
import { find, map, startsWith, toLower } from "lodash/fp";
|
|
||||||
import registerProtocolClientInjectable from "../../../electron-app/register-protocol-client.injectable";
|
|
||||||
import commandLineArgumentsInjectable from "../../../utils/command-line-arguments.injectable";
|
|
||||||
|
|
||||||
const setupDeepLinkingInjectable = getInjectable({
|
|
||||||
id: "setup-deep-linking",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const windowManager = di.inject(windowManagerInjectable);
|
|
||||||
const whenOpeningUrl = di.inject(whenOpeningUrlInjectable);
|
|
||||||
const whenSecondInstance = di.inject(whenSecondInstanceInjectable);
|
|
||||||
const protocolRouter = di.inject(lensProtocolRouterMainInjectable);
|
|
||||||
const routeWithProtocolRouter = routeWithProtocolRouterFor(protocolRouter);
|
|
||||||
const registerProtocolClient = di.inject(registerProtocolClientInjectable);
|
|
||||||
const commandLineArguments = di.inject(commandLineArgumentsInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
run: async () => {
|
|
||||||
whenOpeningUrl(async ({ cancel, url }) => {
|
|
||||||
cancel();
|
|
||||||
|
|
||||||
await protocolRouter.route(url);
|
|
||||||
});
|
|
||||||
|
|
||||||
whenSecondInstance(async ({ commandLineArguments: secondInstanceArguments }) => {
|
|
||||||
await routeWithProtocolRouter(secondInstanceArguments);
|
|
||||||
await windowManager.ensureMainWindow();
|
|
||||||
});
|
|
||||||
|
|
||||||
registerProtocolClient("lens");
|
|
||||||
|
|
||||||
await routeWithProtocolRouter(commandLineArguments);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
injectionToken: afterApplicationIsReadyInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
const routeWithProtocolRouterFor =
|
|
||||||
(protocolRouter: LensProtocolRouterMain) =>
|
|
||||||
async (commandLineArguments: string[]) => {
|
|
||||||
const route = pipeline(
|
|
||||||
commandLineArguments,
|
|
||||||
map(toLower),
|
|
||||||
find(startsWith("lens://")),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (route) {
|
|
||||||
await protocolRouter.route(route);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default setupDeepLinkingInjectable;
|
|
||||||
@ -1,28 +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 { runManyFor } from "../../run-many-for";
|
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
|
||||||
import beforeDeviceShutdownInjectable from "../../../electron-app/before-device-shutdown.injectable";
|
|
||||||
import { beforeDeviceShutdownInjectionToken } from "../../before-device-shutdown/before-device-shutdown-injection-token";
|
|
||||||
|
|
||||||
const setupDeviceShutdownEventsInjectable = getInjectable({
|
|
||||||
id: "setup-device-shutdown-events",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const beforeDeviceShutdown = di.inject(beforeDeviceShutdownInjectable);
|
|
||||||
const runRunnablesBeforeDeviceShutdown = runManyFor(di)(beforeDeviceShutdownInjectionToken);
|
|
||||||
|
|
||||||
return {
|
|
||||||
run: () => {
|
|
||||||
beforeDeviceShutdown(runRunnablesBeforeDeviceShutdown);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
injectionToken: afterApplicationIsReadyInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default setupDeviceShutdownEventsInjectable;
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
||||||
import registerFileProtocolInjectable from "../../../electron-app/register-file-protocol.injectable";
|
import registerFileProtocolInjectable from "../../../electron-app/features/register-file-protocol.injectable";
|
||||||
|
|
||||||
// TODO: Remove side effect on import defining __static
|
// TODO: Remove side effect on import defining __static
|
||||||
import "../../../../common/vars";
|
import "../../../../common/vars";
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
||||||
import environmentVariablesInjectable from "../../../../common/utils/environment-variables.injectable";
|
import environmentVariablesInjectable from "../../../../common/utils/environment-variables.injectable";
|
||||||
import disableHardwareAccelerationInjectable from "../../../electron-app/disable-hardware-acceleration.injectable";
|
import disableHardwareAccelerationInjectable from "../../../electron-app/features/disable-hardware-acceleration.injectable";
|
||||||
|
|
||||||
const setupHardwareAccelerationInjectable = getInjectable({
|
const setupHardwareAccelerationInjectable = getInjectable({
|
||||||
id: "setup-hardware-acceleration",
|
id: "setup-hardware-acceleration",
|
||||||
|
|||||||
@ -8,12 +8,12 @@ import {
|
|||||||
getAppVersion,
|
getAppVersion,
|
||||||
getAppVersionFromProxyServer,
|
getAppVersionFromProxyServer,
|
||||||
} from "../../../../common/utils";
|
} from "../../../../common/utils";
|
||||||
import exitAppInjectable from "../../../electron-app/exit-app.injectable";
|
import exitAppInjectable from "../../../electron-app/features/exit-app.injectable";
|
||||||
import lensProxyInjectable from "../../../lens-proxy.injectable";
|
import lensProxyInjectable from "../../../lens-proxy.injectable";
|
||||||
import loggerInjectable from "../../../../common/logger.injectable";
|
import loggerInjectable from "../../../../common/logger.injectable";
|
||||||
import { dialog } from "electron";
|
|
||||||
import lensProxyPortNumberStateInjectable from "../../../lens-proxy-port-number-state.injectable";
|
import lensProxyPortNumberStateInjectable from "../../../lens-proxy-port-number-state.injectable";
|
||||||
import isWindowsInjectable from "../../../../common/vars/is-windows.injectable";
|
import isWindowsInjectable from "../../../../common/vars/is-windows.injectable";
|
||||||
|
import showErrorPopupInjectable from "../../../electron-app/features/show-error-popup.injectable";
|
||||||
|
|
||||||
const setupLensProxyInjectable = getInjectable({
|
const setupLensProxyInjectable = getInjectable({
|
||||||
id: "setup-lens-proxy",
|
id: "setup-lens-proxy",
|
||||||
@ -24,6 +24,7 @@ const setupLensProxyInjectable = getInjectable({
|
|||||||
const logger = di.inject(loggerInjectable);
|
const logger = di.inject(loggerInjectable);
|
||||||
const lensProxyPortNumberState = di.inject(lensProxyPortNumberStateInjectable);
|
const lensProxyPortNumberState = di.inject(lensProxyPortNumberStateInjectable);
|
||||||
const isWindows = di.inject(isWindowsInjectable);
|
const isWindows = di.inject(isWindowsInjectable);
|
||||||
|
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
run: async () => {
|
run: async () => {
|
||||||
@ -31,7 +32,7 @@ const setupLensProxyInjectable = getInjectable({
|
|||||||
logger.info("🔌 Starting LensProxy");
|
logger.info("🔌 Starting LensProxy");
|
||||||
await lensProxy.listen(); // lensProxy.port available
|
await lensProxy.listen(); // lensProxy.port available
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
showErrorPopup("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
||||||
|
|
||||||
return exitApp();
|
return exitApp();
|
||||||
}
|
}
|
||||||
@ -63,7 +64,7 @@ const setupLensProxyInjectable = getInjectable({
|
|||||||
"If you have HTTP_PROXY or http_proxy set in your environment, make sure that the localhost and the ipv4 loopback address 127.0.0.1 are added to the NO_PROXY environment variable.",
|
"If you have HTTP_PROXY or http_proxy set in your environment, make sure that the localhost and the ipv4 loopback address 127.0.0.1 are added to the NO_PROXY environment variable.",
|
||||||
];
|
];
|
||||||
|
|
||||||
dialog.showErrorBox("Lens Proxy Error", message.join("\n\n"));
|
showErrorPopup("Lens Proxy Error", message.join("\n\n"));
|
||||||
|
|
||||||
return exitApp();
|
return exitApp();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +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 { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
|
||||||
import clusterStoreInjectable from "../../../../common/cluster-store/cluster-store.injectable";
|
|
||||||
|
|
||||||
const setupListenerForInitialStateOfClusterStoreInjectable = getInjectable({
|
|
||||||
id: "setup-listener-for-initial-state-of-cluster-store",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const clusterStore = di.inject(clusterStoreInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
run: () => {
|
|
||||||
clusterStore.provideInitialFromMain();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
injectionToken: afterApplicationIsReadyInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default setupListenerForInitialStateOfClusterStoreInjectable;
|
|
||||||
@ -9,20 +9,20 @@ import { afterRootFrameIsReadyInjectionToken } from "../../after-root-frame-is-r
|
|||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
||||||
import { runManyFor } from "../../run-many-for";
|
import { runManyFor } from "../../run-many-for";
|
||||||
|
|
||||||
const setupListenerForRootFrameRenderingInjectable = getInjectable({
|
const setupRunnablesForAfterRootFrameIsReadyInjectable = getInjectable({
|
||||||
id: "setup-listener-for-root-frame-rendering",
|
id: "setup-runnables-for-after-root-frame-is-ready",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const runMany = runManyFor(di);
|
const runMany = runManyFor(di);
|
||||||
|
|
||||||
const runAfterRootFrameIsReady = runMany(
|
const runRunnablesAfterRootFrameIsReady = runMany(
|
||||||
afterRootFrameIsReadyInjectionToken,
|
afterRootFrameIsReadyInjectionToken,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
run: () => {
|
run: () => {
|
||||||
ipcMainOn(IpcRendererNavigationEvents.LOADED, async () => {
|
ipcMainOn(IpcRendererNavigationEvents.LOADED, async () => {
|
||||||
await runAfterRootFrameIsReady();
|
await runRunnablesAfterRootFrameIsReady();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -34,4 +34,4 @@ const setupListenerForRootFrameRenderingInjectable = getInjectable({
|
|||||||
injectionToken: afterApplicationIsReadyInjectionToken,
|
injectionToken: afterApplicationIsReadyInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default setupListenerForRootFrameRenderingInjectable;
|
export default setupRunnablesForAfterRootFrameIsReadyInjectable;
|
||||||
@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import windowManagerInjectable from "../../../window-manager.injectable";
|
import windowManagerInjectable from "../../../window-manager.injectable";
|
||||||
import loggerInjectable from "../../../../common/logger.injectable";
|
import loggerInjectable from "../../../../common/logger.injectable";
|
||||||
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
||||||
import shouldStartHiddenInjectable from "../../../electron-app/should-start-hidden.injectable";
|
import shouldStartHiddenInjectable from "../../../electron-app/features/should-start-hidden.injectable";
|
||||||
|
|
||||||
const startMainWindowInjectable = getInjectable({
|
const startMainWindowInjectable = getInjectable({
|
||||||
id: "start-main-window",
|
id: "start-main-window",
|
||||||
|
|||||||
@ -1,25 +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 appNameInjectable from "../../../app-paths/app-name/app-name.injectable";
|
|
||||||
import { beforeApplicationIsReadyInjectionToken } from "../before-application-is-ready-injection-token";
|
|
||||||
import setApplicationNameInjectable from "../../../electron-app/set-application-name.injectable";
|
|
||||||
|
|
||||||
const setupApplicationNameInjectable = getInjectable({
|
|
||||||
id: "setup-application-name",
|
|
||||||
|
|
||||||
instantiate: (di) => ({
|
|
||||||
run: () => {
|
|
||||||
const setApplicationName = di.inject(setApplicationNameInjectable);
|
|
||||||
const appName = di.inject(appNameInjectable);
|
|
||||||
|
|
||||||
setApplicationName(appName);
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
|
|
||||||
injectionToken: beforeApplicationIsReadyInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default setupApplicationNameInjectable;
|
|
||||||
@ -1,48 +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 { beforeApplicationIsReadyInjectionToken } from "../before-application-is-ready-injection-token";
|
|
||||||
import { beforeApplicationSoftQuitInjectionToken } from "../../before-application-soft-quit/before-application-soft-quit-injection-token";
|
|
||||||
import { runManyFor } from "../../run-many-for";
|
|
||||||
import whenApplicationWillQuitInjectable from "../../../electron-app/when-application-will-quit.injectable";
|
|
||||||
import { beforeApplicationHardQuitInjectionToken } from "../../before-application-hard-quit/before-application-hard-quit-injection-token";
|
|
||||||
|
|
||||||
const setupClosingOfApplicationInjectable = getInjectable({
|
|
||||||
id: "setup-closing-of-application",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const whenApplicationWillQuit = di.inject(
|
|
||||||
whenApplicationWillQuitInjectable,
|
|
||||||
);
|
|
||||||
|
|
||||||
const runMany = runManyFor(di);
|
|
||||||
|
|
||||||
const runRunnablesBeforeApplicationSoftQuit = runMany(
|
|
||||||
beforeApplicationSoftQuitInjectionToken,
|
|
||||||
);
|
|
||||||
|
|
||||||
const runRunnablesBeforeApplicationHardQuit = runMany(
|
|
||||||
beforeApplicationHardQuitInjectionToken,
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
run: () => {
|
|
||||||
whenApplicationWillQuit(async ({ cancel: cancelNativeQuit, shouldOnlySoftQuit }) => {
|
|
||||||
await runRunnablesBeforeApplicationSoftQuit();
|
|
||||||
|
|
||||||
if (shouldOnlySoftQuit) {
|
|
||||||
cancelNativeQuit();
|
|
||||||
} else {
|
|
||||||
await runRunnablesBeforeApplicationHardQuit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
injectionToken: beforeApplicationIsReadyInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default setupClosingOfApplicationInjectable;
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { beforeApplicationIsReadyInjectionToken } from "../before-application-is-ready-injection-token";
|
import { beforeApplicationIsReadyInjectionToken } from "../before-application-is-ready-injection-token";
|
||||||
import getCommandLineSwitchInjectable from "../../../electron-app/get-command-line-switch.injectable";
|
import getCommandLineSwitchInjectable from "../../../electron-app/features/get-command-line-switch.injectable";
|
||||||
|
|
||||||
const setupProxyEnvInjectable = getInjectable({
|
const setupProxyEnvInjectable = getInjectable({
|
||||||
id: "setup-proxy-env",
|
id: "setup-proxy-env",
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
|
||||||
import type { Runnable } from "../run-many-for";
|
|
||||||
|
|
||||||
export const beforeDeviceShutdownInjectionToken = getInjectionToken<Runnable>({
|
|
||||||
id: "before-device-shutdown",
|
|
||||||
});
|
|
||||||
@ -1,25 +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 exitAppInjectable from "../../../electron-app/exit-app.injectable";
|
|
||||||
import { beforeDeviceShutdownInjectionToken } from "../before-device-shutdown-injection-token";
|
|
||||||
|
|
||||||
const exitAppBeforeShutdownInjectable = getInjectable({
|
|
||||||
id: "exit-app-before-shutdown",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const exitApp = di.inject(exitAppInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
run: () => {
|
|
||||||
exitApp();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
injectionToken: beforeDeviceShutdownInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default exitAppBeforeShutdownInjectable;
|
|
||||||
@ -5,7 +5,7 @@
|
|||||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||||
import type { Runnable } from "../run-many-for";
|
import type { Runnable } from "../run-many-for";
|
||||||
|
|
||||||
export const beforeApplicationSoftQuitInjectionToken =
|
export const beforeQuitOfBackEndInjectionToken =
|
||||||
getInjectionToken<Runnable>({
|
getInjectionToken<Runnable>({
|
||||||
id: "before-application-soft-quit",
|
id: "before-quit-of-back-end",
|
||||||
});
|
});
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { beforeApplicationHardQuitInjectionToken } from "../before-application-hard-quit-injection-token";
|
import { beforeQuitOfBackEndInjectionToken } from "../before-quit-of-back-end-injection-token";
|
||||||
import { ShellSession } from "../../../shell-session/shell-session";
|
import { ShellSession } from "../../../shell-session/shell-session";
|
||||||
|
|
||||||
const cleanUpShellSessionsInjectable = getInjectable({
|
const cleanUpShellSessionsInjectable = getInjectable({
|
||||||
@ -15,7 +15,7 @@ const cleanUpShellSessionsInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
injectionToken: beforeApplicationHardQuitInjectionToken,
|
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default cleanUpShellSessionsInjectable;
|
export default cleanUpShellSessionsInjectable;
|
||||||
@ -5,7 +5,7 @@
|
|||||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||||
import type { Runnable } from "../run-many-for";
|
import type { Runnable } from "../run-many-for";
|
||||||
|
|
||||||
export const beforeApplicationHardQuitInjectionToken =
|
export const beforeQuitOfFrontEndInjectionToken =
|
||||||
getInjectionToken<Runnable>({
|
getInjectionToken<Runnable>({
|
||||||
id: "before-application-hard-quit",
|
id: "before-quit-of-front-end",
|
||||||
});
|
});
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import appEventBusInjectable from "../../../../common/app-event-bus/app-event-bus.injectable";
|
import appEventBusInjectable from "../../../../common/app-event-bus/app-event-bus.injectable";
|
||||||
import { beforeApplicationSoftQuitInjectionToken } from "../before-application-soft-quit-injection-token";
|
import { beforeQuitOfFrontEndInjectionToken } from "../before-quit-of-front-end-injection-token";
|
||||||
|
|
||||||
const emitCloseToCommandBusInjectable = getInjectable({
|
const emitCloseToCommandBusInjectable = getInjectable({
|
||||||
id: "emit-close-to-command-bus",
|
id: "emit-close-to-command-bus",
|
||||||
@ -19,7 +19,7 @@ const emitCloseToCommandBusInjectable = getInjectable({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationSoftQuitInjectionToken,
|
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default emitCloseToCommandBusInjectable;
|
export default emitCloseToCommandBusInjectable;
|
||||||
@ -5,7 +5,7 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { runInAction } from "mobx";
|
import { runInAction } from "mobx";
|
||||||
import lensProtocolRouterMainInjectable from "../../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
import lensProtocolRouterMainInjectable from "../../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
||||||
import { beforeApplicationSoftQuitInjectionToken } from "../before-application-soft-quit-injection-token";
|
import { beforeQuitOfFrontEndInjectionToken } from "../before-quit-of-front-end-injection-token";
|
||||||
|
|
||||||
const flagRendererAsNotLoaded = getInjectable({
|
const flagRendererAsNotLoaded = getInjectable({
|
||||||
id: "stop-deep-linking",
|
id: "stop-deep-linking",
|
||||||
@ -23,7 +23,7 @@ const flagRendererAsNotLoaded = getInjectable({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationSoftQuitInjectionToken,
|
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default flagRendererAsNotLoaded;
|
export default flagRendererAsNotLoaded;
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import clusterManagerInjectable from "../../../cluster-manager.injectable";
|
import clusterManagerInjectable from "../../../cluster-manager.injectable";
|
||||||
import { beforeApplicationSoftQuitInjectionToken } from "../before-application-soft-quit-injection-token";
|
import { beforeQuitOfFrontEndInjectionToken } from "../before-quit-of-front-end-injection-token";
|
||||||
|
|
||||||
const stopClusterManagerInjectable = getInjectable({
|
const stopClusterManagerInjectable = getInjectable({
|
||||||
id: "stop-cluster-manager",
|
id: "stop-cluster-manager",
|
||||||
@ -14,12 +14,12 @@ const stopClusterManagerInjectable = getInjectable({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
run: () => {
|
run: () => {
|
||||||
clusterManager.stop(); // close cluster connections
|
clusterManager.stop();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationSoftQuitInjectionToken,
|
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||||
|
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
});
|
});
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import kubeconfigSyncManagerInjectable from "../../../catalog-sources/kubeconfig-sync-manager/kubeconfig-sync-manager.injectable";
|
import kubeconfigSyncManagerInjectable from "../../../catalog-sources/kubeconfig-sync-manager/kubeconfig-sync-manager.injectable";
|
||||||
import { beforeApplicationSoftQuitInjectionToken } from "../before-application-soft-quit-injection-token";
|
import { beforeQuitOfFrontEndInjectionToken } from "../before-quit-of-front-end-injection-token";
|
||||||
|
|
||||||
const stopKubeConfigSyncInjectable = getInjectable({
|
const stopKubeConfigSyncInjectable = getInjectable({
|
||||||
id: "stop-kube-config-sync",
|
id: "stop-kube-config-sync",
|
||||||
@ -19,7 +19,7 @@ const stopKubeConfigSyncInjectable = getInjectable({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationSoftQuitInjectionToken,
|
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default stopKubeConfigSyncInjectable;
|
export default stopKubeConfigSyncInjectable;
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import exitAppInjectable from "./electron-app/exit-app.injectable";
|
import exitAppInjectable from "./electron-app/features/exit-app.injectable";
|
||||||
import clusterManagerInjectable from "./cluster-manager.injectable";
|
import clusterManagerInjectable from "./cluster-manager.injectable";
|
||||||
import windowManagerInjectable from "./window-manager.injectable";
|
import windowManagerInjectable from "./window-manager.injectable";
|
||||||
import appEventBusInjectable from "../common/app-event-bus/app-event-bus.injectable";
|
import appEventBusInjectable from "../common/app-event-bus/app-event-bus.injectable";
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import trayInjectable from "./tray.injectable";
|
import trayInjectable from "./tray.injectable";
|
||||||
import { beforeApplicationHardQuitInjectionToken } from "../start-main-application/before-application-hard-quit/before-application-hard-quit-injection-token";
|
import { beforeQuitOfBackEndInjectionToken } from "../start-main-application/before-quit-of-back-end/before-quit-of-back-end-injection-token";
|
||||||
|
|
||||||
const stopTrayInjectable = getInjectable({
|
const stopTrayInjectable = getInjectable({
|
||||||
id: "stop-tray",
|
id: "stop-tray",
|
||||||
@ -19,7 +19,7 @@ const stopTrayInjectable = getInjectable({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: beforeApplicationHardQuitInjectionToken,
|
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default stopTrayInjectable;
|
export default stopTrayInjectable;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user