diff --git a/packages/core/src/features/application-update/child-features/application-update-using-application-menu/main/check-for-updates-menu-item.injectable.ts b/packages/core/src/features/application-update/child-features/application-update-using-application-menu/main/check-for-updates-menu-item.injectable.ts index fe997e62fb..18bd45874b 100644 --- a/packages/core/src/features/application-update/child-features/application-update-using-application-menu/main/check-for-updates-menu-item.injectable.ts +++ b/packages/core/src/features/application-update/child-features/application-update-using-application-menu/main/check-for-updates-menu-item.injectable.ts @@ -9,20 +9,17 @@ import processCheckingForUpdatesInjectable from "../../../main/process-checking- 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 isMacInjectable from "../../../../../common/vars/is-mac.injectable"; +import showMessagePopupInjectable from "../../../../../main/electron-app/features/show-message-popup.injectable"; const checkForUpdatesMenuItemInjectable = getInjectable({ id: "check-for-updates-menu-item", instantiate: (di) => { - const processCheckingForUpdates = di.inject( - processCheckingForUpdatesInjectable, - ); - + const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable,); const showApplicationWindow = di.inject(showApplicationWindowInjectable); - const updatingIsEnabled = di.inject(updatingIsEnabledInjectable); const isMac = di.inject(isMacInjectable); - + const showMessagePopup = di.inject(showMessagePopupInjectable); return { kind: "clickable-menu-item" as const, id: "check-for-updates", @@ -31,11 +28,21 @@ const checkForUpdatesMenuItemInjectable = getInjectable({ label: "Check for updates", isShown: updatingIsEnabled, - onClick: () => { - // Todo: implement using async/await - processCheckingForUpdates("application-menu").then(() => - showApplicationWindow(), - ); + onClick: async () => { + const { updateIsReadyToBeInstalled } = await processCheckingForUpdates("application-menu"); + + if (updateIsReadyToBeInstalled) { + await showApplicationWindow(); + } else { + showMessagePopup( + "No Updates Available", + "You're all good", + "You've got the latest version of Lens,\nthanks for staying on the ball.", + { + textWidth: 300, + }, + ); + } }, }; }, diff --git a/packages/core/src/features/application-update/child-features/application-update-using-tray/main/tray-items/check-for-updates-tray-item.injectable.ts b/packages/core/src/features/application-update/child-features/application-update-using-tray/main/tray-items/check-for-updates-tray-item.injectable.ts index e904abaa99..ccbb71c323 100644 --- a/packages/core/src/features/application-update/child-features/application-update-using-tray/main/tray-items/check-for-updates-tray-item.injectable.ts +++ b/packages/core/src/features/application-update/child-features/application-update-using-tray/main/tray-items/check-for-updates-tray-item.injectable.ts @@ -16,6 +16,7 @@ import processCheckingForUpdatesInjectable from "../../../../main/process-checki import { withErrorSuppression } from "../../../../../../common/utils/with-error-suppression/with-error-suppression"; import { pipeline } from "@ogre-tools/fp"; import withErrorLoggingInjectable from "../../../../../../common/utils/with-error-logging/with-error-logging.injectable"; +import showMessagePopupInjectable from "../../../../../../main/electron-app/features/show-message-popup.injectable"; const checkForUpdatesTrayItemInjectable = getInjectable({ id: "check-for-updates-tray-item", @@ -29,6 +30,7 @@ const checkForUpdatesTrayItemInjectable = getInjectable({ const checkingForUpdatesState = di.inject(updatesAreBeingDiscoveredInjectable); const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable); const withErrorLoggingFor = di.inject(withErrorLoggingInjectable); + const showMessagePopup = di.inject(showMessagePopupInjectable); return { id: "check-for-updates", @@ -63,6 +65,15 @@ const checkForUpdatesTrayItemInjectable = getInjectable({ if (updateIsReadyToBeInstalled) { await showApplicationWindow(); + } else { + showMessagePopup( + "No Updates Available", + "You're all good", + "You've got the latest version of Lens,\nthanks for staying on the ball.", + { + textWidth: 300, + }, + ); } },