axonops / axonops-workbench-cassandra

AxonOps™ Workbench for Apache Cassandra® - Desktop application for Mac, Windows and Linux
https://axonops.com
Apache License 2.0
8 stars 0 forks source link

[feat]: Support update notifications and auto updates for new releases #434

Open millerjp opened 4 days ago

millerjp commented 4 days ago

We need to have the abilty to notifiy users of updates and then update the app when not shipped via app stores

1 - Only perform update checks in this fashion when not an app store dist 2 - Users can be prompted to install the update (unless they disable this - see below) 3 - There must be a system setting to "auto update" where the app is automatically updated with no prompts 4- System setting to check to enable/disable the "check for updates" as a system setting and first install option

Note - we could have the prompts for update checks and autoupdate as things to set on first app launch

There are a variety of frameworks to do this with a lot of them working directly with GitHub releases (which we use)

https://www.electronjs.org/docs/latest/tutorial/updates#using-updateelectronjsorg

https://www.perplexity.ai/search/i-am-building-a-desktop-app-in-3BvppQ1KTZyPrIHZNjq6nw

We should also consider self-hosting the release notifications to avoid automatically using Github releases

eg https://github.com/ArekSredzki/electron-release-server

IMPORTANT

This is not possible for app store installations so we should only check for autoupdates when the app is downloaded and installed as when installed via Mac, Windows app stores or Snap/Flatpack on windows, it needs to follow their respective update mechanisms. Therefore, before checking for updates its important to detect the install source and behave accordingly eg

const { app } = require('electron');
const isDev = require('electron-is-dev');

function shouldUseCustomUpdater() {
  // Check if the app is not in development and not installed from an app store or Linux package manager
  const isMacAppStore = process.mas;
  const isWindowsStore = process.windowsStore;
  const isSnap = process.env.SNAP || process.env.SNAP_REVISION;
  const isFlatpak = process.env.FLATPAK_ID;

  return !isDev || !isMacAppStore || !isWindowsStore || !isSnap || !isFlatpak;
}

if (shouldUseCustomUpdater()) {
  const updateElectronApp = require('update-electron-app');
  updateElectronApp();
}

Also - we should have a system settings that enables/disables autoupdates and is only available as an option if not installed via the above app stores.

millerjp commented 3 days ago

I am thinking that the defaults for self-install should be that the app just autoupgrades by default.

When app is launched first time we ask the user - couple of checkboxes one auto-upgrade (were we just download and upgrade) and another notify me when upgrades available with the default selected checkboxes as above.

These options are also available as app system settings to enable/disable later.

If auto upgrade is not enabled: when an upgrade is available on app launch we prompt the user to upgrade (where we upgrade and restart) or do it later to skip.

When an upgrade is available we display some visible upgrade notification in the app when the user is using it they know they are not on latest version.

Obviously, there needs to be a function somewhere for the user to click a button and upgrade the app if/when they decide to do it later.

All of this only when not an app store dist.

@mhmdkrmabd we need to make sure when upgrading we are upgrading to the correct versions i.e internal, beta or proper releases based on the one installed.