The ElectronNET AutoUpdater seems to be posting notifications to Windows that I haven't asked for. Along with the ones I did ask for, I now have duplicates (from the perspective of my QA people).
To make matters worse the default messages use the internal AppId rather than the display name of the App which just looks unprofessional.
Forgive the redactions, but notice the following:
ElectronNET.API.Electron.AutoUpdater.OnUpdateDownloaded
; the second one "A new update is ready to install" seems to be coming from ElectronNET itself and the subtext includes the AppID rather than the display name for the App.Does anyone know how to overcome these limitations? I'm happy to fork the ElectronNET cli and override some of the build process if that's what's needed but these seem like fairly obvious needs for the platform as a whole.
Maybe I just missed something in the docs?
Answering my own question because I've pulled the ElectronNET code and worked it out.
There are two APIs for checking for updates:
Electron.AutoUpdater.CheckForUpdatesAsync()
and
Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync()
In the latter there is a NotificationOptions
object that can be sent to the pure-Electron end to set the content of the notification. In the ElectronNET bridge the API does not accept the options argument, hence the default message from Electron is displayed.
The workaround here is to call the CheckForUpdatesAsync()
method instead and craft your own notification that you can attach to the OnUpdateDownloaded
event. An example below:
var timer = new Timer( 60_000 ) { AutoReset = true, Enabled = true };
timer.Elapsed += ( _, _ ) => Electron.AutoUpdater.CheckForUpdatesAsync();
Electron.AutoUpdater.OnUpdateDownloaded += upd =>
Electron.Notification.Show(
new NotificationOptions(
"My App",
"A new version is available. Restart to install."
)
);