mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Extract updating is enabled to separate injectable
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
384d39cd6c
commit
44e0ebc10d
12 files changed
+79
-54
No files matched your search
@@ -1,24 +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 electronUpdaterInjectable from "../electron-app/features/electron-updater.injectable";
|
||||
import packageJsonInjectable from "../../common/vars/package-json.injectable";
|
||||
|
||||
const isAutoUpdateEnabledInjectable = getInjectable({
|
||||
id: "is-auto-update-enabled",
|
||||
|
||||
instantiate: (di) => {
|
||||
const electronUpdater = di.inject(electronUpdaterInjectable);
|
||||
const packageJson = di.inject(packageJsonInjectable);
|
||||
|
||||
const isPublishConfigured = Object.keys(packageJson.build).includes("publish");
|
||||
|
||||
return () => {
|
||||
return electronUpdater.isUpdaterActive() && isPublishConfigured;
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default isAutoUpdateEnabledInjectable;
|
||||
@@ -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 packageJsonInjectable from "../../common/vars/package-json.injectable";
|
||||
import { has } from "lodash/fp";
|
||||
|
||||
// TOOO: Rename to something less technical
|
||||
const publishIsConfiguredInjectable = getInjectable({
|
||||
id: "publish-is-configured",
|
||||
|
||||
instantiate: (di) => {
|
||||
const packageJson = di.inject(packageJsonInjectable);
|
||||
|
||||
return has("build.publish", packageJson);
|
||||
},
|
||||
});
|
||||
|
||||
export default publishIsConfiguredInjectable;
|
||||
@@ -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 electronUpdaterIsActiveInjectable from "../electron-app/features/electron-updater-is-active.injectable";
|
||||
import publishIsConfiguredInjectable from "./publish-is-configured.injectable";
|
||||
|
||||
const updatingIsEnabledInjectable = getInjectable({
|
||||
id: "updating-is-enabled",
|
||||
|
||||
instantiate: (di) => {
|
||||
const electronUpdaterIsActive = di.inject(electronUpdaterIsActiveInjectable);
|
||||
const publishIsConfigured = di.inject(publishIsConfiguredInjectable);
|
||||
|
||||
return electronUpdaterIsActive && publishIsConfigured;
|
||||
},
|
||||
});
|
||||
|
||||
export default updatingIsEnabledInjectable;
|
||||
Reference in new issue
Block a user