mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Remove the auto-update status bar item for not being needed anymore Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make adding of new tray icons easier by complying to Open Closed Principle Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Start showing different tray icon when checking for updates Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Include placeholder icon for checking for updates Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Simplify code Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add first keyframe for downloading spinner Signed-off-by: Sebastian Malton <sebastian@malton.name> Co-authored-by: Sebastian Malton <sebastian@malton.name>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
/**
|
|
* 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 getAbsolutePathInjectable from "../../../common/path/get-absolute-path.injectable";
|
|
import staticFilesDirectoryInjectable from "../../../common/vars/static-files-directory.injectable";
|
|
import isDevelopmentInjectable from "../../../common/vars/is-development.injectable";
|
|
import isMacInjectable from "../../../common/vars/is-mac.injectable";
|
|
import { camelCase, flow, upperFirst } from "lodash/fp";
|
|
const upperCamelCase = flow(camelCase, upperFirst);
|
|
|
|
const getTrayIconPathInjectable = getInjectable({
|
|
id: "get-tray-icon-path",
|
|
|
|
instantiate: (di) => {
|
|
const getAbsolutePath = di.inject(getAbsolutePathInjectable);
|
|
const staticFilesDirectory = di.inject(staticFilesDirectoryInjectable);
|
|
const isDevelopment = di.inject(isDevelopmentInjectable);
|
|
const isMac = di.inject(isMacInjectable);
|
|
|
|
const baseIconDirectory = getAbsolutePath(
|
|
staticFilesDirectory,
|
|
isDevelopment ? "../build/tray" : "icons", // copied within electron-builder extras
|
|
);
|
|
|
|
const fileSuffix = isMac ? "Template.png" : ".png";
|
|
|
|
return (name: string) =>
|
|
getAbsolutePath(
|
|
baseIconDirectory,
|
|
`trayIcon${upperCamelCase(name)}${fileSuffix}`,
|
|
);
|
|
},
|
|
});
|
|
|
|
export default getTrayIconPathInjectable;
|