mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
wip, with notification
Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
parent
34aed58ff0
commit
470de1c5b2
@ -9,19 +9,17 @@ import processCheckingForUpdatesInjectable from "../../../main/process-checking-
|
|||||||
import showApplicationWindowInjectable from "../../../../../main/start-main-application/lens-window/show-application-window.injectable";
|
import showApplicationWindowInjectable from "../../../../../main/start-main-application/lens-window/show-application-window.injectable";
|
||||||
import updatingIsEnabledInjectable from "../../../main/updating-is-enabled/updating-is-enabled.injectable";
|
import updatingIsEnabledInjectable from "../../../main/updating-is-enabled/updating-is-enabled.injectable";
|
||||||
import isMacInjectable from "../../../../../common/vars/is-mac.injectable";
|
import isMacInjectable from "../../../../../common/vars/is-mac.injectable";
|
||||||
|
// import showSuccessNotificationInjectable from "../../../../../renderer/components/notifications/show-success-notification.injectable";
|
||||||
|
|
||||||
const checkForUpdatesMenuItemInjectable = getInjectable({
|
const checkForUpdatesMenuItemInjectable = getInjectable({
|
||||||
id: "check-for-updates-menu-item",
|
id: "check-for-updates-menu-item",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const processCheckingForUpdates = di.inject(
|
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable,);
|
||||||
processCheckingForUpdatesInjectable,
|
|
||||||
);
|
|
||||||
|
|
||||||
const showApplicationWindow = di.inject(showApplicationWindowInjectable);
|
const showApplicationWindow = di.inject(showApplicationWindowInjectable);
|
||||||
|
|
||||||
const updatingIsEnabled = di.inject(updatingIsEnabledInjectable);
|
const updatingIsEnabled = di.inject(updatingIsEnabledInjectable);
|
||||||
const isMac = di.inject(isMacInjectable);
|
const isMac = di.inject(isMacInjectable);
|
||||||
|
// const showSuccessNotification = di.inject(showSuccessNotificationInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
kind: "clickable-menu-item" as const,
|
kind: "clickable-menu-item" as const,
|
||||||
@ -31,11 +29,16 @@ const checkForUpdatesMenuItemInjectable = getInjectable({
|
|||||||
label: "Check for updates",
|
label: "Check for updates",
|
||||||
isShown: updatingIsEnabled,
|
isShown: updatingIsEnabled,
|
||||||
|
|
||||||
onClick: () => {
|
onClick: async () => {
|
||||||
// Todo: implement using async/await
|
const { updateIsReadyToBeInstalled } = await processCheckingForUpdates("application-menu");
|
||||||
processCheckingForUpdates("application-menu").then(() =>
|
|
||||||
showApplicationWindow(),
|
if (updateIsReadyToBeInstalled) {
|
||||||
);
|
await showApplicationWindow();
|
||||||
|
} else {
|
||||||
|
// showSuccessNotification(
|
||||||
|
// `You're all good\n\nYou've got the latest version of Lens\nthanks for staying on the ball.`,
|
||||||
|
// );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import processCheckingForUpdatesInjectable from "../../../../main/process-checki
|
|||||||
import { withErrorSuppression } from "../../../../../../common/utils/with-error-suppression/with-error-suppression";
|
import { withErrorSuppression } from "../../../../../../common/utils/with-error-suppression/with-error-suppression";
|
||||||
import { pipeline } from "@ogre-tools/fp";
|
import { pipeline } from "@ogre-tools/fp";
|
||||||
import withErrorLoggingInjectable from "../../../../../../common/utils/with-error-logging/with-error-logging.injectable";
|
import withErrorLoggingInjectable from "../../../../../../common/utils/with-error-logging/with-error-logging.injectable";
|
||||||
|
// import showSuccessNotificationInjectable from "../../../../../../renderer/components/notifications/show-success-notification.injectable";
|
||||||
|
|
||||||
const checkForUpdatesTrayItemInjectable = getInjectable({
|
const checkForUpdatesTrayItemInjectable = getInjectable({
|
||||||
id: "check-for-updates-tray-item",
|
id: "check-for-updates-tray-item",
|
||||||
@ -29,6 +30,7 @@ const checkForUpdatesTrayItemInjectable = getInjectable({
|
|||||||
const checkingForUpdatesState = di.inject(updatesAreBeingDiscoveredInjectable);
|
const checkingForUpdatesState = di.inject(updatesAreBeingDiscoveredInjectable);
|
||||||
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable);
|
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable);
|
||||||
const withErrorLoggingFor = di.inject(withErrorLoggingInjectable);
|
const withErrorLoggingFor = di.inject(withErrorLoggingInjectable);
|
||||||
|
// const showSuccessNotification = di.inject(showSuccessNotificationInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: "check-for-updates",
|
id: "check-for-updates",
|
||||||
@ -63,6 +65,10 @@ const checkForUpdatesTrayItemInjectable = getInjectable({
|
|||||||
|
|
||||||
if (updateIsReadyToBeInstalled) {
|
if (updateIsReadyToBeInstalled) {
|
||||||
await showApplicationWindow();
|
await showApplicationWindow();
|
||||||
|
} else {
|
||||||
|
// showSuccessNotification(
|
||||||
|
// `You're all good\n\nYou've got the latest version of Lens\nthanks for staying on the ball.`,
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user