Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quitAndInstall not working on macOS with autoInstallOnAppQuit=false #6390

Merged
merged 3 commits into from Nov 9, 2021

Conversation

Nokel81
Copy link
Contributor

@Nokel81 Nokel81 commented Nov 3, 2021

  • Would never call nativeUpdater.checkForUpdates() if not installing on
    quit. Thus neither squirrelDownloadedUpdate was true nor the
    nativeUpdater's event "update-downloaded" be emitted. Leading to
    nothing happening.

  • This commit fixes it by calling the checkForUpdates() in
    MacUpdater.quitAndInstall() when necessary

Signed-off-by: Sebastian Malton sebastian@malton.name

fixes #6389

@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2021

🦋 Changeset detected

Latest commit: 3108cd7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
electron-updater Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

- Would never call nativeUpdater.checkForUpdates() if not installing on
  quit. Thus neither squirrelDownloadedUpdate was true nor the
  nativeUpdater's event "update-downloaded" be emitted. Leading to
  nothing happening.

- This commit fixes it by calling the checkForUpdates() in
  MacUpdater.quitAndInstall() when necessary

Signed-off-by: Sebastian Malton <sebastian@malton.name>
@Nokel81 Nokel81 changed the title Fix quitAndInstall not working on macOS with autoInstallOnAppQuit=false fix: quitAndInstall not working on macOS with autoInstallOnAppQuit=false Nov 3, 2021
Signed-off-by: Sebastian Malton <sebastian@malton.name>
@Rigner
Copy link

Rigner commented Nov 5, 2021

Hey,

We also just found out a fix for that issue, which seems actually better.
Here's the full function:

quitAndInstall(): void {
    if (this.squirrelDownloadedUpdate) {
      // Update already fetched by Squirrel, it's ready to install
      this.nativeUpdater.quitAndInstall()
    } else {
      // Quit and install as soon as Squirrel get the update
      this.nativeUpdater.on("update-downloaded", () => {
        this.nativeUpdater.quitAndInstall()
      })

      // And trigger the update
      if (!this.autoInstallOnAppQuit) {
          this.nativeUpdater.checkForUpdates();
      }
    }

This is a very urgent issue @mmaietta and should be put in pre-release as soon as possible, It's affecting all our userbase.

@Nokel81
Copy link
Contributor Author

Nokel81 commented Nov 5, 2021

Yeah I was really surprised that there was no reported issue about this after I figured out what was going on.

I agree that yours is probably slightly more resilient, will update.

@mmaietta
Copy link
Collaborator

mmaietta commented Nov 8, 2021

Oh man, I'm so behind on my notifications. Will get this in ASAP

@Nokel81, I think you were going to update the PR first?

Signed-off-by: Sebastian Malton <sebastian@malton.name>
@Nokel81
Copy link
Contributor Author

Nokel81 commented Nov 8, 2021

@mmaietta Done

@mmaietta mmaietta merged commit a5e8073 into electron-userland:master Nov 9, 2021
@github-actions github-actions bot mentioned this pull request Nov 9, 2021
@mmaietta
Copy link
Collaborator

mmaietta commented Nov 9, 2021

Released next:
electron-builder@22.14.6
electron-updater@4.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quitAndInstall on macOS doesn't do anything
3 participants