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

Reimplement setup for electron application name using runnables instead of non-OCP in index.ts

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

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-04-27 11:14:43 +03:00
parent 9c3c075887
commit 74f8d7462e
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A
2 changed files with 29 additions and 2 deletions

View File

@ -3,11 +3,13 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import electronAppInjectable from "../get-electron-app-path/electron-app/electron-app.injectable";
import { isDevelopment } from "../../../common/vars";
import packageInfo from "../../../../package.json";
const appNameInjectable = getInjectable({
id: "app-name",
instantiate: (di) => di.inject(electronAppInjectable).name,
instantiate: () => `${packageInfo.productName}${isDevelopment ? "Dev" : ""}`,
causesSideEffects: true,
});
export default appNameInjectable;

View File

@ -0,0 +1,25 @@
/**
* 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 "../../../app-paths/get-electron-app-path/electron-app/electron-app.injectable";
import appNameInjectable from "../../../app-paths/app-name/app-name.injectable";
import { beforeApplicationIsReadyInjectionToken } from "../before-application-is-ready-injection-token";
const setupApplicationNameInjectable = getInjectable({
id: "setup-application-name",
instantiate: (di) => ({
run: () => {
const app = di.inject(electronAppInjectable);
const appName = di.inject(appNameInjectable);
app.setName(appName);
},
}),
injectionToken: beforeApplicationIsReadyInjectionToken,
});
export default setupApplicationNameInjectable;