0

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.

Win11 notification panel

Forgive the redactions, but notice the following:

  • Outlook displays a Group Title and icon; I can't seem to replicate this with ElectronNET always displaying some sort of internally calculated name, not one that I have specified anywhere in any configs. MS Teams and Slack both display nicely so it must be possible in Electron.
  • The first message at 9.40 AM is my one, raise during the event 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?

Richard Hauer
  • 1,298
  • 9
  • 22

1 Answers1

1

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."
        )
    );
Richard Hauer
  • 1,298
  • 9
  • 22