mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify naming
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
1810a330cf
commit
32a128d44b
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
||||||
import currentOperatingSystemThemeStateInjectable from "../../theme/current-operating-system-theme-state.injectable";
|
import operatingSystemThemeStateInjectable from "../../theme/operating-system-theme-state.injectable";
|
||||||
import nativeThemeInjectable from "./native-theme.injectable";
|
import nativeThemeInjectable from "./native-theme.injectable";
|
||||||
import getElectronThemeInjectable from "./get-electron-theme.injectable";
|
import getElectronThemeInjectable from "./get-electron-theme.injectable";
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ const syncThemeFromOperatingSystemInjectable = getInjectable({
|
|||||||
id: "sync-theme-from-operating-system",
|
id: "sync-theme-from-operating-system",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const currentThemeState = di.inject(currentOperatingSystemThemeStateInjectable);
|
const currentThemeState = di.inject(operatingSystemThemeStateInjectable);
|
||||||
const nativeTheme = di.inject(nativeThemeInjectable);
|
const nativeTheme = di.inject(nativeThemeInjectable);
|
||||||
const getElectronTheme = di.inject(getElectronThemeInjectable);
|
const getElectronTheme = di.inject(getElectronThemeInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import getAbsolutePathInjectable from "../../../../common/path/get-absolute-path
|
|||||||
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";
|
import clusterStoreInjectable from "../../../../common/cluster-store/cluster-store.injectable";
|
||||||
import { whenApplicationIsLoadingInjectionToken } from "../../../start-main-application/runnable-tokens/when-application-is-loading-injection-token";
|
import { whenApplicationIsLoadingInjectionToken } from "../../../start-main-application/runnable-tokens/when-application-is-loading-injection-token";
|
||||||
import currentOperatingSystemThemeInjectable from "../../../theme/current-operating-system-theme.injectable";
|
import operatingSystemThemeInjectable from "../../../theme/operating-system-theme.injectable";
|
||||||
|
|
||||||
const setupIpcMainHandlersInjectable = getInjectable({
|
const setupIpcMainHandlersInjectable = getInjectable({
|
||||||
id: "setup-ipc-main-handlers",
|
id: "setup-ipc-main-handlers",
|
||||||
@ -29,7 +29,7 @@ const setupIpcMainHandlersInjectable = getInjectable({
|
|||||||
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);
|
const clusterStore = di.inject(clusterStoreInjectable);
|
||||||
const currentOperatingSystemTheme = di.inject(currentOperatingSystemThemeInjectable);
|
const operatingSystemTheme = di.inject(operatingSystemThemeInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
run: () => {
|
run: () => {
|
||||||
@ -42,7 +42,7 @@ const setupIpcMainHandlersInjectable = getInjectable({
|
|||||||
clusterManager,
|
clusterManager,
|
||||||
catalogEntityRegistry,
|
catalogEntityRegistry,
|
||||||
clusterStore,
|
clusterStore,
|
||||||
currentOperatingSystemTheme,
|
operatingSystemTheme,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -23,7 +23,7 @@ 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 type { Theme } from "../../../theme/current-operating-system-theme-state.injectable";
|
import type { Theme } from "../../../theme/operating-system-theme-state.injectable";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
directoryForLensLocalStorage: string;
|
directoryForLensLocalStorage: string;
|
||||||
@ -32,10 +32,10 @@ interface Dependencies {
|
|||||||
clusterManager: ClusterManager;
|
clusterManager: ClusterManager;
|
||||||
catalogEntityRegistry: CatalogEntityRegistry;
|
catalogEntityRegistry: CatalogEntityRegistry;
|
||||||
clusterStore: ClusterStore;
|
clusterStore: ClusterStore;
|
||||||
currentOperatingSystemTheme: IComputedValue<Theme>;
|
operatingSystemTheme: IComputedValue<Theme>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setupIpcMainHandlers = ({ applicationMenuItems, directoryForLensLocalStorage, getAbsolutePath, clusterManager, catalogEntityRegistry, clusterStore, currentOperatingSystemTheme }: Dependencies) => {
|
export const setupIpcMainHandlers = ({ applicationMenuItems, directoryForLensLocalStorage, getAbsolutePath, clusterManager, catalogEntityRegistry, clusterStore, operatingSystemTheme }: 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,7 +167,7 @@ export const setupIpcMainHandlers = ({ applicationMenuItems, directoryForLensLoc
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMainHandle(getNativeThemeChannel, () => {
|
ipcMainHandle(getNativeThemeChannel, () => {
|
||||||
return currentOperatingSystemTheme.get();
|
return operatingSystemTheme.get();
|
||||||
});
|
});
|
||||||
|
|
||||||
clusterStore.provideInitialFromMain();
|
clusterStore.provideInitialFromMain();
|
||||||
|
|||||||
@ -6,14 +6,14 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import { reaction } from "mobx";
|
import { reaction } from "mobx";
|
||||||
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
||||||
import { setNativeThemeChannel } from "../../../common/ipc/native-theme";
|
import { setNativeThemeChannel } from "../../../common/ipc/native-theme";
|
||||||
import currentOperatingSystemThemeInjectable from "../current-operating-system-theme.injectable";
|
import operatingSystemThemeInjectable from "../operating-system-theme.injectable";
|
||||||
import broadcastMessageInjectable from "../../../common/ipc/broadcast-message.injectable";
|
import broadcastMessageInjectable from "../../../common/ipc/broadcast-message.injectable";
|
||||||
|
|
||||||
const broadcastThemeChangeInjectable = getInjectable({
|
const broadcastThemeChangeInjectable = getInjectable({
|
||||||
id: "broadcast-theme-change",
|
id: "broadcast-theme-change",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const currentTheme = di.inject(currentOperatingSystemThemeInjectable);
|
const currentTheme = di.inject(operatingSystemThemeInjectable);
|
||||||
const broadcastMessage = di.inject(broadcastMessageInjectable);
|
const broadcastMessage = di.inject(broadcastMessageInjectable);
|
||||||
|
|
||||||
return getStartableStoppable("broadcast-theme-change", () =>
|
return getStartableStoppable("broadcast-theme-change", () =>
|
||||||
|
|||||||
@ -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 currentOperatingSystemThemeStateInjectable from "./current-operating-system-theme-state.injectable";
|
|
||||||
|
|
||||||
const currentOperatingSystemThemeInjectable = getInjectable({
|
|
||||||
id: "current-operating-system-theme",
|
|
||||||
|
|
||||||
instantiate: (di) => {
|
|
||||||
const currentThemeState = di.inject(currentOperatingSystemThemeStateInjectable);
|
|
||||||
|
|
||||||
return computed(() => currentThemeState.get());
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default currentOperatingSystemThemeInjectable;
|
|
||||||
@ -8,8 +8,8 @@ import getElectronThemeInjectable from "../electron-app/features/get-electron-th
|
|||||||
|
|
||||||
export type Theme = "dark" | "light";
|
export type Theme = "dark" | "light";
|
||||||
|
|
||||||
const currentOperatingSystemThemeStateInjectable = getInjectable({
|
const operatingSystemThemeStateInjectable = getInjectable({
|
||||||
id: "current-operating-system-theme-state",
|
id: "operating-system-theme-state",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const getElectronTheme = di.inject(getElectronThemeInjectable);
|
const getElectronTheme = di.inject(getElectronThemeInjectable);
|
||||||
@ -21,4 +21,4 @@ const currentOperatingSystemThemeStateInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default currentOperatingSystemThemeStateInjectable;
|
export default operatingSystemThemeStateInjectable;
|
||||||
19
src/main/theme/operating-system-theme.injectable.ts
Normal file
19
src/main/theme/operating-system-theme.injectable.ts
Normal 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 operatingSystemThemeStateInjectable from "./operating-system-theme-state.injectable";
|
||||||
|
|
||||||
|
const operatingSystemThemeInjectable = getInjectable({
|
||||||
|
id: "operating-system-theme",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const currentThemeState = di.inject(operatingSystemThemeStateInjectable);
|
||||||
|
|
||||||
|
return computed(() => currentThemeState.get());
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default operatingSystemThemeInjectable;
|
||||||
Loading…
Reference in New Issue
Block a user