mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Show Message Box when no update is available after manually checking for updates (#7390)
* no updates available Signed-off-by: Gabriel <gaccettola@mirantis.com> * lint fix Signed-off-by: Gabriel <gaccettola@mirantis.com> * lint padding-line-between-statements Signed-off-by: Gabriel <gaccettola@mirantis.com> * test stubs - wip Signed-off-by: Gabriel <gaccettola@mirantis.com> * tray - when no new update is discovered showMessagePopupMock toHaveBeenCalled & toHaveBeenCalledWith Signed-off-by: Gabriel <gaccettola@mirantis.com> * fake tray and fake menu parity Signed-off-by: Gabriel <gaccettola@mirantis.com> * tray and menu passing tests and lint Signed-off-by: Gabriel <gaccettola@mirantis.com> --------- Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
parent
4856e3c5aa
commit
e790757302
@ -0,0 +1,286 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`installing update using application menu when started renders 1`] = `
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="ClusterManager"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="topBar"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="items"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="preventedDragging"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="Icon material interactive disabled focusable"
|
||||||
|
data-testid="home-button"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
data-icon-name="home"
|
||||||
|
>
|
||||||
|
home
|
||||||
|
</span>
|
||||||
|
</i>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="size-sm"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="preventedDragging"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="Icon material interactive disabled focusable"
|
||||||
|
data-testid="history-back"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
data-icon-name="arrow_back"
|
||||||
|
>
|
||||||
|
arrow_back
|
||||||
|
</span>
|
||||||
|
</i>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="size-sm"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="preventedDragging"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="Icon material interactive disabled focusable"
|
||||||
|
data-testid="history-forward"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
data-icon-name="arrow_forward"
|
||||||
|
>
|
||||||
|
arrow_forward
|
||||||
|
</span>
|
||||||
|
</i>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="separator"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<main>
|
||||||
|
<div
|
||||||
|
id="lens-views"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="flex justify-center Welcome align-center"
|
||||||
|
data-testid="welcome-page"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-testid="welcome-banner-container"
|
||||||
|
style="width: 320px;"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="Icon logo svg focusable"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
/>
|
||||||
|
</i>
|
||||||
|
<div
|
||||||
|
class="flex justify-center"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-testid="welcome-text-container"
|
||||||
|
style="width: 320px;"
|
||||||
|
>
|
||||||
|
<h2>
|
||||||
|
Welcome to some-product-name!
|
||||||
|
</h2>
|
||||||
|
<p>
|
||||||
|
To get you started we have auto-detected your clusters in your
|
||||||
|
|
||||||
|
kubeconfig file and added them to the catalog, your centralized
|
||||||
|
|
||||||
|
view for managing all your cloud-native resources.
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
If you have any questions or feedback, please join our
|
||||||
|
<a
|
||||||
|
class="link"
|
||||||
|
href="https://forums.k8slens.dev"
|
||||||
|
rel="noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
Lens Forums
|
||||||
|
</a>
|
||||||
|
.
|
||||||
|
</p>
|
||||||
|
<ul
|
||||||
|
class="block"
|
||||||
|
data-testid="welcome-menu-container"
|
||||||
|
style="width: 320px;"
|
||||||
|
>
|
||||||
|
<li
|
||||||
|
class="flex grid-12"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="Icon box col-1 material focusable"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
data-icon-name="view_list"
|
||||||
|
>
|
||||||
|
view_list
|
||||||
|
</span>
|
||||||
|
</i>
|
||||||
|
<a
|
||||||
|
class="box col-10"
|
||||||
|
>
|
||||||
|
Browse Clusters in Catalog
|
||||||
|
</a>
|
||||||
|
<i
|
||||||
|
class="Icon box col-1 material focusable"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
data-icon-name="navigate_next"
|
||||||
|
>
|
||||||
|
navigate_next
|
||||||
|
</span>
|
||||||
|
</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<div
|
||||||
|
class="HotbarMenu flex column"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="HotbarItems flex column gaps"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="z-index: 12; position: absolute;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="HotbarIcon contextMenuAvailable"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="Avatar rounded disabled avatar"
|
||||||
|
id="hotbarIcon-hotbar-icon-catalog-entity"
|
||||||
|
style="width: 40px; height: 40px; background: rgb(5, 1, 130);"
|
||||||
|
>
|
||||||
|
Ca
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="1"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="2"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="3"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="4"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="5"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="6"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="7"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="8"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="9"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="10"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="HotbarCell isDraggingOwner animateDown"
|
||||||
|
index="11"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="HotbarSelector"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="Icon material interactive focusable"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
data-icon-name="arrow_left"
|
||||||
|
>
|
||||||
|
arrow_left
|
||||||
|
</span>
|
||||||
|
</i>
|
||||||
|
<div
|
||||||
|
class="HotbarIndex"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="badge Badge small clickable"
|
||||||
|
id="hotbarIndex"
|
||||||
|
>
|
||||||
|
1
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<i
|
||||||
|
class="Icon material interactive focusable"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="icon"
|
||||||
|
data-icon-name="arrow_right"
|
||||||
|
>
|
||||||
|
arrow_right
|
||||||
|
</span>
|
||||||
|
</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="StatusBar"
|
||||||
|
data-testid="status-bar"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="leftSide"
|
||||||
|
data-testid="status-bar-left"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="rightSide"
|
||||||
|
data-testid="status-bar-right"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
`;
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { AsyncFnMock } from "@async-fn/jest";
|
||||||
|
import asyncFn from "@async-fn/jest";
|
||||||
|
import { getApplicationBuilder } from "../../../../renderer/components/test-utils/get-application-builder";
|
||||||
|
import type { ApplicationBuilder } from "../../../../renderer/components/test-utils/get-application-builder";
|
||||||
|
import type { CheckForPlatformUpdates } from "../../main/check-for-updates/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||||
|
import checkForPlatformUpdatesInjectable from "../../main/check-for-updates/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||||
|
import type { RenderResult } from "@testing-library/react";
|
||||||
|
import showMessagePopupInjectable from "../../../../main/electron-app/features/show-message-popup.injectable";
|
||||||
|
import type { ShowMessagePopup } from "../../../../main/electron-app/features/show-message-popup.injectable";
|
||||||
|
import electronUpdaterIsActiveInjectable
|
||||||
|
from "../../../../main/electron-app/features/electron-updater-is-active.injectable";
|
||||||
|
import publishIsConfiguredInjectable
|
||||||
|
from "../../main/updating-is-enabled/publish-is-configured/publish-is-configured.injectable";
|
||||||
|
|
||||||
|
describe("installing update using application menu", () => {
|
||||||
|
let applicationBuilder: ApplicationBuilder;
|
||||||
|
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
|
||||||
|
let showMessagePopupMock: AsyncFnMock<ShowMessagePopup>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
applicationBuilder = getApplicationBuilder();
|
||||||
|
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||||
|
checkForPlatformUpdatesMock = asyncFn();
|
||||||
|
showMessagePopupMock = asyncFn();
|
||||||
|
|
||||||
|
mainDi.override(
|
||||||
|
checkForPlatformUpdatesInjectable,
|
||||||
|
() => checkForPlatformUpdatesMock,
|
||||||
|
);
|
||||||
|
|
||||||
|
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||||
|
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||||
|
|
||||||
|
mainDi.override(
|
||||||
|
showMessagePopupInjectable,
|
||||||
|
() => showMessagePopupMock,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when started", () => {
|
||||||
|
let rendered: RenderResult;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
rendered = await applicationBuilder.render();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders", () => {
|
||||||
|
expect(rendered.baseElement).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when user checks for updates using application menu", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
applicationBuilder.applicationMenu.click(
|
||||||
|
"root",
|
||||||
|
"mac",
|
||||||
|
"check-for-updates",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
describe("when no new update is discovered", () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await checkForPlatformUpdatesMock.resolve({
|
||||||
|
updateWasDiscovered: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("it displays a popup", () => {
|
||||||
|
expect(showMessagePopupMock).toHaveBeenCalledWith(
|
||||||
|
"No Updates Available",
|
||||||
|
"You're all good",
|
||||||
|
"You've got the latest version of Lens,\nthanks for staying on the ball.",
|
||||||
|
{ "textWidth": 300 },
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -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 showMessagePopupInjectable from "../../../../../main/electron-app/features/show-message-popup.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 showMessagePopup = di.inject(showMessagePopupInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
kind: "clickable-menu-item" as const,
|
kind: "clickable-menu-item" as const,
|
||||||
@ -31,11 +29,21 @@ 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 {
|
||||||
|
showMessagePopup(
|
||||||
|
"No Updates Available",
|
||||||
|
"You're all good",
|
||||||
|
"You've got the latest version of Lens,\nthanks for staying on the ball.",
|
||||||
|
{
|
||||||
|
textWidth: 300,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { ApplicationBuilder } from "../../../../renderer/components/test-utils/get-application-builder";
|
|
||||||
import { getApplicationBuilder } from "../../../../renderer/components/test-utils/get-application-builder";
|
import { getApplicationBuilder } from "../../../../renderer/components/test-utils/get-application-builder";
|
||||||
|
import type { ApplicationBuilder } from "../../../../renderer/components/test-utils/get-application-builder";
|
||||||
import type { RenderResult } from "@testing-library/react";
|
import type { RenderResult } from "@testing-library/react";
|
||||||
import electronUpdaterIsActiveInjectable from "../../../../main/electron-app/features/electron-updater-is-active.injectable";
|
import electronUpdaterIsActiveInjectable from "../../../../main/electron-app/features/electron-updater-is-active.injectable";
|
||||||
import publishIsConfiguredInjectable from "../../main/updating-is-enabled/publish-is-configured/publish-is-configured.injectable";
|
import publishIsConfiguredInjectable from "../../main/updating-is-enabled/publish-is-configured/publish-is-configured.injectable";
|
||||||
@ -15,11 +15,14 @@ import type { DownloadPlatformUpdate } from "../../main/download-update/download
|
|||||||
import downloadPlatformUpdateInjectable from "../../main/download-update/download-platform-update/download-platform-update.injectable";
|
import downloadPlatformUpdateInjectable from "../../main/download-update/download-platform-update/download-platform-update.injectable";
|
||||||
import type { LensWindow } from "../../../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
|
import type { LensWindow } from "../../../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
|
||||||
import getCurrentApplicationWindowInjectable from "../../../../main/start-main-application/lens-window/application-window/get-current-application-window.injectable";
|
import getCurrentApplicationWindowInjectable from "../../../../main/start-main-application/lens-window/application-window/get-current-application-window.injectable";
|
||||||
|
import showMessagePopupInjectable from "../../../../main/electron-app/features/show-message-popup.injectable";
|
||||||
|
import type { ShowMessagePopup } from "../../../../main/electron-app/features/show-message-popup.injectable";
|
||||||
|
|
||||||
describe("installing update using tray", () => {
|
describe("installing update using tray", () => {
|
||||||
let builder: ApplicationBuilder;
|
let builder: ApplicationBuilder;
|
||||||
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
|
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
|
||||||
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
|
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
|
||||||
|
let showMessagePopupMock: AsyncFnMock<ShowMessagePopup>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
builder = getApplicationBuilder();
|
builder = getApplicationBuilder();
|
||||||
@ -27,6 +30,7 @@ describe("installing update using tray", () => {
|
|||||||
builder.beforeApplicationStart(({ mainDi }) => {
|
builder.beforeApplicationStart(({ mainDi }) => {
|
||||||
checkForPlatformUpdatesMock = asyncFn();
|
checkForPlatformUpdatesMock = asyncFn();
|
||||||
downloadPlatformUpdateMock = asyncFn();
|
downloadPlatformUpdateMock = asyncFn();
|
||||||
|
showMessagePopupMock = asyncFn();
|
||||||
|
|
||||||
mainDi.override(
|
mainDi.override(
|
||||||
checkForPlatformUpdatesInjectable,
|
checkForPlatformUpdatesInjectable,
|
||||||
@ -40,6 +44,12 @@ describe("installing update using tray", () => {
|
|||||||
|
|
||||||
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||||
mainDi.override(publishIsConfiguredInjectable, () => true);
|
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||||
|
|
||||||
|
mainDi.override(
|
||||||
|
showMessagePopupInjectable,
|
||||||
|
() => showMessagePopupMock,
|
||||||
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -164,6 +174,15 @@ describe("installing update using tray", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("it displays a popup", () => {
|
||||||
|
expect(showMessagePopupMock).toHaveBeenCalledWith(
|
||||||
|
"No Updates Available",
|
||||||
|
"You're all good",
|
||||||
|
"You've got the latest version of Lens,\nthanks for staying on the ball.",
|
||||||
|
{ "textWidth": 300 },
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("user cannot install update", () => {
|
it("user cannot install update", () => {
|
||||||
expect(builder.tray.get("install-update")).toBeNull();
|
expect(builder.tray.get("install-update")).toBeNull();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 showMessagePopupInjectable from "../../../../../../main/electron-app/features/show-message-popup.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 showMessagePopup = di.inject(showMessagePopupInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: "check-for-updates",
|
id: "check-for-updates",
|
||||||
@ -63,6 +65,15 @@ const checkForUpdatesTrayItemInjectable = getInjectable({
|
|||||||
|
|
||||||
if (updateIsReadyToBeInstalled) {
|
if (updateIsReadyToBeInstalled) {
|
||||||
await showApplicationWindow();
|
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,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user