mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Broadcast event when update is complete
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
b6d06c8ca3
commit
3ba60a47b0
@ -3,3 +3,4 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
export const BundledExtensionsLoaded = "extension-loader:bundled-extensions-loaded";
|
||||
export const BundledExtensionsUpdated = "extension-loader:bundled-extensions-updated";
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import ipcRendererInjectable from "../../renderer/app-paths/get-value-from-registered-channel/ipc-renderer/ipc-renderer.injectable";
|
||||
import installFromInputInjectable from "../../renderer/components/+extensions/install-from-input/install-from-input.injectable";
|
||||
import extensionLoaderInjectable from "../extension-loader/extension-loader.injectable";
|
||||
import { BundledExtensionsUpdater } from "./bundled-extensions-updater";
|
||||
@ -12,7 +13,8 @@ const bundledExtensionsUpdaterInjectable = getInjectable({
|
||||
instantiate: (di) =>
|
||||
new BundledExtensionsUpdater({
|
||||
installFromInput: di.inject(installFromInputInjectable),
|
||||
extensions: di.inject(extensionLoaderInjectable).bundledExtensions
|
||||
extensions: di.inject(extensionLoaderInjectable).bundledExtensions,
|
||||
ipcRenderer: di.inject(ipcRendererInjectable),
|
||||
}),
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
|
||||
@ -3,13 +3,14 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { BundledExtensionsLoaded, ipcRendererOn } from "../../common/ipc"
|
||||
import { BundledExtensionsLoaded, BundledExtensionsUpdated, ipcRendererOn } from "../../common/ipc"
|
||||
import { logger } from "../common-api";
|
||||
import type { InstalledExtension } from "../extension-discovery/extension-discovery";
|
||||
import { ExtensionUpdater, UpdaterDependencies } from "./extension-updater";
|
||||
|
||||
interface Dependencies extends UpdaterDependencies {
|
||||
extensions: InstalledExtension[];
|
||||
ipcRenderer: { send: (name: string) => void };
|
||||
}
|
||||
|
||||
export class BundledExtensionsUpdater extends ExtensionUpdater {
|
||||
@ -27,7 +28,11 @@ export class BundledExtensionsUpdater extends ExtensionUpdater {
|
||||
logger.info("[EXTENSIONS-UPDATER]: Bundled extensions update started.");
|
||||
|
||||
const updates = this.dependencies.extensions.map(this.update);
|
||||
await Promise.allSettled(updates);
|
||||
try {
|
||||
await Promise.allSettled(updates);
|
||||
} finally {
|
||||
this.dependencies.ipcRenderer.send(BundledExtensionsUpdated);
|
||||
}
|
||||
|
||||
logger.info("[EXTENSIONS-UPDATER]: Bundled extensions update finished.");
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import { makeObservable, observable } from "mobx";
|
||||
import { app, BrowserWindow, dialog, ipcMain, shell, webContents } from "electron";
|
||||
import windowStateKeeper from "electron-window-state";
|
||||
import { appEventBus } from "../common/app-event-bus/event-bus";
|
||||
import { BundledExtensionsLoaded, ipcMainOn } from "../common/ipc";
|
||||
import { BundledExtensionsUpdated, ipcMainOn } from "../common/ipc";
|
||||
import { delay, iter, Singleton } from "../common/utils";
|
||||
import { ClusterFrameInfo, clusterFrameMap } from "../common/cluster-frames";
|
||||
import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
|
||||
@ -165,7 +165,7 @@ export class WindowManager extends Singleton {
|
||||
|
||||
if (!this.mainWindow) {
|
||||
viewHasLoaded = new Promise<void>(resolve => {
|
||||
ipcMain.once(BundledExtensionsLoaded, () => resolve());
|
||||
ipcMain.once(BundledExtensionsUpdated, () => resolve());
|
||||
});
|
||||
await this.initMainWindow(showSplash);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user