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

Electron Builder AutoUpdater download-progress event is not called on MAC. #1167

Closed
pdabhiargus opened this issue Jan 25, 2017 · 13 comments · May be fixed by qcif/data-curator#563
Closed

Electron Builder AutoUpdater download-progress event is not called on MAC. #1167

pdabhiargus opened this issue Jan 25, 2017 · 13 comments · May be fixed by qcif/data-curator#563

Comments

@pdabhiargus
Copy link

Electron Version: 1.4.3
Electron Builder Version: 11.4.4
Target: macOS 10.12.2
Node Version: 7.2.1
NPM Version: 4.1.1

I am trying to use the electron-auto-updater module on MAC. Everything works all OK expect that the
download-progress event of auto updater never gets called.

I have the same solution for Windows and it works perfectly on it.

@develar
Copy link
Member

develar commented Jan 25, 2017

FYI: electron-auto-updater renamed to electron-updater.

Yes, because under the hood we use native Squirrel.Mac updater and update downloaded by Squirrel.Mac.

@tborychowski
Copy link
Contributor

@develar,
is there a feature-request (or a bug) reported to Squirrel.Mac?
Do you know if that's in progress?
Currently the UX of the autoupdate is crap: use will see that download has started and somewhere between 10 seconds - 5 hours they might see "Download complete" (if they didn't close the app in the mean time).

@develar
Copy link
Member

develar commented Mar 8, 2017

is there a feature-request (or a bug) reported to Squirrel.Mac?

I am not aware about it. You can search / file issue.

If Squirrel.Mac developers will reject this idea — probably I can make a PR to Squirrel.Mac.

@tborychowski
Copy link
Contributor

Thanks. Issue added: Squirrel/Squirrel.Mac#200

@develar
Copy link
Member

develar commented Jun 5, 2017

electron-updater 2.0.0 released (electron-builder 18.5.1+ is recommended to use with this version).

No more any difference compared to windows version.

Wants more? Stay tuned — lzma2 instead of zip or even direct support of DMG as update file is coming.

Be aware — feedback and testing is wanted.

@biroplane
Copy link

what kind of event does the progress fires?
i've tried with both progress and download-progress, but nothing happen.
any chance to have some snippet?!
Thanks!

@danieldbird
Copy link

@biroplane did you find out how to get the download-progress?

@biroplane
Copy link

Nope! still trying

@pdabhiargus
Copy link
Author

@danieldbird @biroplane

I have the following code working all OK on Windows. I have used mainWindow.setProgressBar to show the progress at the taskbar icon. On MAC auto-update works but without progress.

Here is the package.json

{
  "name": "MyApp",
  "version": "2.0.2",
  "author": "Pratik Dabhi",
  "description": "Demo Offline Application",
  "main": "main.js",
  "build": {
    "appId": "MyApp",
    "mac-category-type": "public.app-category.productivity",
    "asar": false,
    "win": {
      "iconUrl": "http://demotest/favicon.ico",
      "certificateFile": "./certs/new.p12",
      "certificatePassword": "test!",
      "publish": {
        "provider": "generic",
        "url": "https://demotest/app/pc"
      }
    },
    "mac": {
      "target": [
        "zip"
      ],
      "publish": {
        "provider": "generic",
        "url": "https://demotest/app/mac"
      },
      "identity": "1234"
    }
  },
  "scripts": {
    "postinstall": "install-app-deps",
    "start": "electron ./app --enable-logging",
    "dev": "NODE_ENV='development' npm run start",
    "distWin": "build --ia32",
    "distMac": "build --mac"
  },
  "keywords": [
    "Demo"
  ],
  "dependencies": {
    "adm-zip": "^0.4.7",
    "async": "^2.1.4",
    "auto-updater": "^1.0.2",
    "electron-auto-updater": "^1.0.0",
    "progress-stream": "^1.2.0",
    "rimraf": "^2.5.4",
    "winston": "^2.3.0"
  },
  "devDependencies": {
    "electron": "^1.4.3",
    "electron-builder": "^11.4.4"
  }
}

Hope this helps you to find some missing pieces.

main.txt

@kraenhansen
Copy link
Contributor

@develar I believe this can be closed now - I can verify that I am observing download-progress events on MacOS as well as Windows.

@pdabhiargus
Copy link
Author

Thanks, this works. Now I can use the download-progress event on MacOS also. I can now show the users a good progress bar on Mac. Very helpful.

@harrypotter033
Copy link

How do I show download progress..?

I have coded something like this, download works and I am able to restart how do I incorporate progress?

`//Single export to check for and apply any available updates.
module.exports = () => {

//Check for GH (Releases)
autoUpdater.checkForUpdates()
//autoUpdater.checkForUpdatesAndNotify(); This Skips if application is not packed.

//Listern for Update found

autoUpdater.on('update-available',(updateInfo)=> {
//prompts user to start download
dialog.showMessageBox({
type: 'info',
title:'Update available',
message:'A new version '+ updateInfo.version+' of Psstracker is available on ' + updateInfo.releaseDate+ ' Do you want to update now?' ,
buttons:['Update','No']

}, buttonIndex => {

// If button 0 (Update), Start Download the update

if (buttonIndex===0) autoUpdater.downloadUpdate()

})

})

//Listen for update Downloaded

autoUpdater.on('update-downloaded',() =>{
// Prompt the user to install the update

dialog.showMessageBox({
type:'info',
title: 'Update Ready',
message: 'Install and restart Now?'

}, buttonIndex => {

//Install and restart if button 0 [Yes]

if (buttonIndex === 0) autoUpdater.quitAndInstall(false,true)

})

})

}`

Please can anyone help ?

@harrypotter033
Copy link

Thanks, this works. Now I can use the download-progress event on MacOS also. I can now show the users a good progress bar on Mac. Very helpful.

How did you made this work sir. please can you help ?

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

Successfully merging a pull request may close this issue.

7 participants