desktop: fix auto updater events not sent to app

This commit is contained in:
Abdullah Atta
2023-09-19 16:01:50 +05:00
committed by Abdullah Atta
parent a7011f0d6b
commit 042ac0d338
4 changed files with 32 additions and 25 deletions

View File

@@ -0,0 +1,3 @@
owner: streetwriters
repo: notesnook
provider: github

View File

@@ -191,6 +191,7 @@
"allowNativeWayland": true
},
"extraResources": [
"app-update.yml",
"./assets/**"
],
"extraMetadata": {

View File

@@ -90,6 +90,7 @@ async function createWindow() {
}
});
createIPCHandler({ router, windows: [mainWindow] });
globalThis.window = mainWindow;
mainWindowState.manage(mainWindow);
@@ -105,7 +106,6 @@ async function createWindow() {
await AssetManager.loadIcons();
setupDesktopIntegration();
createIPCHandler({ router, windows: [mainWindow] });
mainWindow.webContents.session.setSpellCheckerDictionaryDownloadURL(
"http://dictionaries.notesnook.com/"

View File

@@ -21,11 +21,13 @@ import { createTRPCProxyClient } from "@trpc/client";
import { ipcLink } from "electron-trpc/renderer";
import type { AppRouter } from "@notesnook/desktop";
import { AppEventManager, AppEvents } from "../app-events";
import { checkForUpdate } from "../../utils/updater";
export const desktop = createTRPCProxyClient<AppRouter>({
links: [ipcLink()]
});
document.addEventListener("readystatechange", async () => {
desktop.updater.onChecking.subscribe(
undefined,
attachListener(AppEvents.checkingForUpdate)
@@ -55,6 +57,7 @@ desktop.updater.onError.subscribe(
undefined,
attachListener(AppEvents.updateError)
);
});
function attachListener(event: string) {
return {