mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
desktop: fix auto updater events not sent to app
This commit is contained in:
committed by
Abdullah Atta
parent
a7011f0d6b
commit
042ac0d338
3
apps/desktop/app-update.yml
Normal file
3
apps/desktop/app-update.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
owner: streetwriters
|
||||||
|
repo: notesnook
|
||||||
|
provider: github
|
||||||
@@ -191,6 +191,7 @@
|
|||||||
"allowNativeWayland": true
|
"allowNativeWayland": true
|
||||||
},
|
},
|
||||||
"extraResources": [
|
"extraResources": [
|
||||||
|
"app-update.yml",
|
||||||
"./assets/**"
|
"./assets/**"
|
||||||
],
|
],
|
||||||
"extraMetadata": {
|
"extraMetadata": {
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ async function createWindow() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
createIPCHandler({ router, windows: [mainWindow] });
|
||||||
globalThis.window = mainWindow;
|
globalThis.window = mainWindow;
|
||||||
mainWindowState.manage(mainWindow);
|
mainWindowState.manage(mainWindow);
|
||||||
|
|
||||||
@@ -105,7 +106,6 @@ async function createWindow() {
|
|||||||
|
|
||||||
await AssetManager.loadIcons();
|
await AssetManager.loadIcons();
|
||||||
setupDesktopIntegration();
|
setupDesktopIntegration();
|
||||||
createIPCHandler({ router, windows: [mainWindow] });
|
|
||||||
|
|
||||||
mainWindow.webContents.session.setSpellCheckerDictionaryDownloadURL(
|
mainWindow.webContents.session.setSpellCheckerDictionaryDownloadURL(
|
||||||
"http://dictionaries.notesnook.com/"
|
"http://dictionaries.notesnook.com/"
|
||||||
|
|||||||
@@ -21,40 +21,43 @@ import { createTRPCProxyClient } from "@trpc/client";
|
|||||||
import { ipcLink } from "electron-trpc/renderer";
|
import { ipcLink } from "electron-trpc/renderer";
|
||||||
import type { AppRouter } from "@notesnook/desktop";
|
import type { AppRouter } from "@notesnook/desktop";
|
||||||
import { AppEventManager, AppEvents } from "../app-events";
|
import { AppEventManager, AppEvents } from "../app-events";
|
||||||
|
import { checkForUpdate } from "../../utils/updater";
|
||||||
|
|
||||||
export const desktop = createTRPCProxyClient<AppRouter>({
|
export const desktop = createTRPCProxyClient<AppRouter>({
|
||||||
links: [ipcLink()]
|
links: [ipcLink()]
|
||||||
});
|
});
|
||||||
|
|
||||||
desktop.updater.onChecking.subscribe(
|
document.addEventListener("readystatechange", async () => {
|
||||||
undefined,
|
desktop.updater.onChecking.subscribe(
|
||||||
attachListener(AppEvents.checkingForUpdate)
|
undefined,
|
||||||
);
|
attachListener(AppEvents.checkingForUpdate)
|
||||||
|
);
|
||||||
|
|
||||||
desktop.updater.onAvailable.subscribe(
|
desktop.updater.onAvailable.subscribe(
|
||||||
undefined,
|
undefined,
|
||||||
attachListener(AppEvents.updateAvailable)
|
attachListener(AppEvents.updateAvailable)
|
||||||
);
|
);
|
||||||
|
|
||||||
desktop.updater.onDownloaded.subscribe(
|
desktop.updater.onDownloaded.subscribe(
|
||||||
undefined,
|
undefined,
|
||||||
attachListener(AppEvents.updateDownloadCompleted)
|
attachListener(AppEvents.updateDownloadCompleted)
|
||||||
);
|
);
|
||||||
|
|
||||||
desktop.updater.onDownloadProgress.subscribe(
|
desktop.updater.onDownloadProgress.subscribe(
|
||||||
undefined,
|
undefined,
|
||||||
attachListener(AppEvents.updateDownloadProgress)
|
attachListener(AppEvents.updateDownloadProgress)
|
||||||
);
|
);
|
||||||
|
|
||||||
desktop.updater.onNotAvailable.subscribe(
|
desktop.updater.onNotAvailable.subscribe(
|
||||||
undefined,
|
undefined,
|
||||||
attachListener(AppEvents.updateNotAvailable)
|
attachListener(AppEvents.updateNotAvailable)
|
||||||
);
|
);
|
||||||
|
|
||||||
desktop.updater.onError.subscribe(
|
desktop.updater.onError.subscribe(
|
||||||
undefined,
|
undefined,
|
||||||
attachListener(AppEvents.updateError)
|
attachListener(AppEvents.updateError)
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
function attachListener(event: string) {
|
function attachListener(event: string) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user