question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make it possible to "auto-downgrade" the application on channel change

See original GitHub issue
  • electron-builder: 11.5.0
  • electron-auto-updater: 1.0.0
  • Target: win32

We have separate release channels based on the configuration of the user (beta|stable). Lets say these are the current versions:

  • beta: 1.2.0-beta.4
  • stable: 1.1.0

Behavior we would like to achieve: When a user from the beta channel wants to go back to the stable channel the application should auto-update (downgrade) to the latest stable version.

Possible solutions:

  1. Always update on channel change (check the current application channel with the requested channel)

GenericProvider.ts

async shouldForceUpdate(): Promise<boolean> {
  const latestChannel = this.channel
  // currentChannel how to get this?
  return latestChannel != currentChannel
}

AppUpdater.ts

const forceUpdate = await client.shouldForceUpdate()
if (!forceUpdate && !isVersionGreaterThan(latestVersion, currentVersion)) {
  this.updateAvailable = false
  if (this.logger != null) {
    this.logger.info(`Update for version ${versionInfo.version} is not available`)
  }
  this.emit("update-not-available")
  return {
    versionInfo: versionInfo,
  }
}

and small updates on all the other Providers + interface Provider

  1. Add a configuration option like updateOnVersionChange or canDowngrade (better name suggestions are welcome) that will auto-update the application if latestVersion != currentVersion.

AppUpdater.ts

if ((updateOnVersionChange && latestVersion == currentVersion) || (!updateOnVersionChange && !isVersionGreaterThan(latestVersion, currentVersion))) {
  this.updateAvailable = false
  if (this.logger != null) {
    this.logger.info(`Update for version ${versionInfo.version} is not available`)
  }
  this.emit("update-not-available")
  return {
    versionInfo: versionInfo,
  }
}

Let me know if we could integrate any of these solutions with a pull request or if you have an even better proposal to achieve this “downgrade” on channel change behavior.

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
develarcommented, Apr 16, 2017

allowDowngrade option is added. Defaults to true if application version contains prerelease components (e.g. 0.12.1-alpha.1, here alpha is a prerelease component), otherwise false. So, if version are not equal — we just update to versions in the update info. If you set channel or somehow else set lower version in the update info — it is your developer decision 😃 No need to implement at little bit complex channel check.

2reactions
tvanrocommented, Jan 25, 2017

It would only be for GenericProvider and we could compare the (current application) channel inside resources/app-update.yml with the channel that is set inside autoUpdater.setFeedURL.

So for example we have this inside app-update.yml:

provider: generic
url: 'https://releases.test.com'
channel: beta

And we update the autoUpdater like this:

autoUpdater.setFeedURL({ provider: "generic", url: "https://releases.test.com", channel: "stable" });

This would be a solution that only affects the GenericProvider.

The other solution would be to add a configuration option like updateOnVersionChange or canDowngrade (see above).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to downgrade Android Auto and rollback to a ... - YouTube
Apps like CarStream, Fermata Auto and AA Mirror may not work with the latest version of Android Auto. To fix the issue you...
Read more >
How To Downgrade Any App On Android! (2020) - YouTube
MY MUSIC: https://soundcloud.com/SimpleAlpacaGET SUPER CHEAP PHONES HERE: https://goo.gl/XDvaQrSUB TO MY SECOND CHANNEL !
Read more >
Change the Microsoft 365 Apps update channel for devices in ...
This article gives step-by-step instructions for changing the update channel for Microsoft 365 Apps.
Read more >
Android: How to Downgrade an App - Technipages
Fortunately, there is a way to downgrade an app if you need to. From the Home screen, select “Settings” > “Apps“. Choose the...
Read more >
On-device upgrade and downgrade - Roku Developer
To downgrade a plan, channels similalry check the expiration date of the current plan being and then mark it for cancellation. A new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found