From 8cd3e2bdb867be4d2a0fa4e3ccf90557e4c7c16a Mon Sep 17 00:00:00 2001 From: Ashp116 Date: Sat, 11 Oct 2025 01:22:50 -0400 Subject: [PATCH 1/7] UPDATE: Updated electron updater's download notification setting --- packages/electron-updater/src/AppUpdater.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index e69afe62d35..4fc97120ae1 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -12,6 +12,7 @@ import { BlockMap, retry, } from "builder-util-runtime" +import { Notification } from 'electron' import { randomBytes } from "crypto" import { release } from "os" import { EventEmitter } from "events" @@ -365,7 +366,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter } // noinspection JSUnusedGlobalSymbols - checkForUpdatesAndNotify(downloadNotification?: DownloadNotification): Promise { + checkForUpdatesAndNotify(downloadNotification?: Notification | DownloadNotification | false): Promise { return this.checkForUpdates().then(it => { if (!it?.downloadPromise) { if (this._logger.debug != null) { @@ -374,10 +375,17 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter return it } - void it.downloadPromise.then(() => { - const notificationContent = AppUpdater.formatDownloadNotification(it.updateInfo.version, this.app.name, downloadNotification) - new (require("electron").Notification)(notificationContent).show() - }) + if (downloadNotification !== false) { // Stricly conditional check with false to allow for disabling notifications + void it.downloadPromise.then(() => { + if (downloadNotification instanceof Notification) { // Allow custom electron Notification + downloadNotification.show() + } + else { + const notificationContent = AppUpdater.formatDownloadNotification(it.updateInfo.version, this.app.name, downloadNotification) + new (require("electron").Notification)(notificationContent).show() + } + }) + } return it }) From 0f832177de16594f6e013c7001ded1b169428b45 Mon Sep 17 00:00:00 2001 From: Ashp116 Date: Sat, 11 Oct 2025 01:55:41 -0400 Subject: [PATCH 2/7] UPDATE: Added string subsitution for custom electron download notification --- packages/electron-updater/src/AppUpdater.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index 4fc97120ae1..6bdbcfc71b3 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -12,7 +12,7 @@ import { BlockMap, retry, } from "builder-util-runtime" -import { Notification } from 'electron' +import { Notification } from "electron" import { randomBytes } from "crypto" import { release } from "os" import { EventEmitter } from "events" @@ -375,13 +375,19 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter return it } - if (downloadNotification !== false) { // Stricly conditional check with false to allow for disabling notifications + if (downloadNotification !== false) { + // Stricly conditional check with false to allow for disabling notifications void it.downloadPromise.then(() => { - if (downloadNotification instanceof Notification) { // Allow custom electron Notification + const version = it.updateInfo.version + const appName = this.app.name + + if (downloadNotification instanceof Notification) { + // Allow custom electron Notification + downloadNotification.title = downloadNotification.title.replace("{appName}", appName).replace("{version}", version) + downloadNotification.body = downloadNotification.body.replace("{appName}", appName).replace("{version}", version) downloadNotification.show() - } - else { - const notificationContent = AppUpdater.formatDownloadNotification(it.updateInfo.version, this.app.name, downloadNotification) + } else { + const notificationContent = AppUpdater.formatDownloadNotification(version, appName, downloadNotification) new (require("electron").Notification)(notificationContent).show() } }) From 2530b344557d12322da5c3b0298b903fe09aef88 Mon Sep 17 00:00:00 2001 From: Ashp116 Date: Sat, 11 Oct 2025 14:49:48 -0400 Subject: [PATCH 3/7] UPDATE: Added changeset --- .changeset/five-actors-boil.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/five-actors-boil.md diff --git a/.changeset/five-actors-boil.md b/.changeset/five-actors-boil.md new file mode 100644 index 00000000000..d5740d38c8e --- /dev/null +++ b/.changeset/five-actors-boil.md @@ -0,0 +1,5 @@ +--- +"electron-updater": minor +--- + +Enhanced the `checkForUpdatesAndNotify` method to provide more flexible download notification options. The method now accepts custom Electron Notification instances, allows disabling notifications entirely, while maintaining full backward compatibility. From fe636591d19d9e809b82019314c9880c6a096a18 Mon Sep 17 00:00:00 2001 From: Ashp116 Date: Wed, 12 Nov 2025 10:48:05 -0500 Subject: [PATCH 4/7] FIX: electron notification import resolve? --- packages/electron-updater/src/AppUpdater.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index 6bdbcfc71b3..247d5e39d63 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -12,7 +12,6 @@ import { BlockMap, retry, } from "builder-util-runtime" -import { Notification } from "electron" import { randomBytes } from "crypto" import { release } from "os" import { EventEmitter } from "events" @@ -37,6 +36,7 @@ import { DifferentialDownloaderOptions } from "./differentialDownloader/Differen import { GenericDifferentialDownloader } from "./differentialDownloader/GenericDifferentialDownloader" import { DOWNLOAD_PROGRESS, Logger, ResolvedUpdateFileInfo, UPDATE_DOWNLOADED, UpdateCheckResult, UpdateDownloadedEvent, UpdaterSignal } from "./types" import { VerifyUpdateSupport } from "./main" +import { Notification } from "electron/main" export type AppUpdaterEvents = { error: (error: Error, message?: string) => void From 123de8e714f7516d6dba608072b51da1e7197a3b Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Sun, 16 Nov 2025 00:00:13 -0800 Subject: [PATCH 5/7] Change imports in AppUpdater.ts --- packages/electron-updater/src/AppUpdater.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index 247d5e39d63..f348c75017b 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -29,14 +29,13 @@ import { GenericProvider } from "./providers/GenericProvider" import { createClient, isUrlProbablySupportMultiRangeRequests } from "./providerFactory" import { Provider, ProviderPlatform } from "./providers/Provider" import type { TypedEmitter } from "tiny-typed-emitter" -import Session = Electron.Session +import { Session, Notification } from "electron" import type { AuthInfo } from "electron" import { gunzipSync, gzipSync } from "zlib" import { DifferentialDownloaderOptions } from "./differentialDownloader/DifferentialDownloader" import { GenericDifferentialDownloader } from "./differentialDownloader/GenericDifferentialDownloader" import { DOWNLOAD_PROGRESS, Logger, ResolvedUpdateFileInfo, UPDATE_DOWNLOADED, UpdateCheckResult, UpdateDownloadedEvent, UpdaterSignal } from "./types" import { VerifyUpdateSupport } from "./main" -import { Notification } from "electron/main" export type AppUpdaterEvents = { error: (error: Error, message?: string) => void From 709fc28b10e494ba393eb15d6a01bca4ba50f532 Mon Sep 17 00:00:00 2001 From: Ashp116 Date: Sun, 16 Nov 2025 22:53:47 -0500 Subject: [PATCH 6/7] UPDATE: Remove boolean type for download update notifications --- packages/electron-updater/src/AppUpdater.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index f348c75017b..de1f60f709c 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -365,7 +365,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter } // noinspection JSUnusedGlobalSymbols - checkForUpdatesAndNotify(downloadNotification?: Notification | DownloadNotification | false): Promise { + checkForUpdatesAndNotify(downloadNotification?: Notification | DownloadNotification): Promise { return this.checkForUpdates().then(it => { if (!it?.downloadPromise) { if (this._logger.debug != null) { @@ -374,9 +374,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter return it } - if (downloadNotification !== false) { - // Stricly conditional check with false to allow for disabling notifications - void it.downloadPromise.then(() => { + void it.downloadPromise.then(() => { const version = it.updateInfo.version const appName = this.app.name @@ -389,8 +387,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter const notificationContent = AppUpdater.formatDownloadNotification(version, appName, downloadNotification) new (require("electron").Notification)(notificationContent).show() } - }) - } + }); return it }) From de2edfd3325d34255d4eea93b772de1479945f50 Mon Sep 17 00:00:00 2001 From: Ashp116 Date: Sun, 16 Nov 2025 22:56:25 -0500 Subject: [PATCH 7/7] FIX: undefiend typing update download notification --- packages/electron-updater/src/AppUpdater.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index de1f60f709c..40c0af54e78 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -365,7 +365,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter } // noinspection JSUnusedGlobalSymbols - checkForUpdatesAndNotify(downloadNotification?: Notification | DownloadNotification): Promise { + checkForUpdatesAndNotify(downloadNotification: Notification | DownloadNotification): Promise { return this.checkForUpdates().then(it => { if (!it?.downloadPromise) { if (this._logger.debug != null) {