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

Doesn't work on Windows #39

Open
girishbr opened this issue Jun 11, 2018 · 17 comments
Open

Doesn't work on Windows #39

girishbr opened this issue Jun 11, 2018 · 17 comments

Comments

@girishbr
Copy link

I copied your code to my app.

For whatever reason, electron on windows doesn't pick up new releases.
At https://github.com/intelligrate/query-cloud-api/releases, I've two releases.
Whilst running 1.0 release,
"build": { "publish": [ { "provider": "github", "owner": "intelligrate", "repo": "query-cloud-api" } ],
I expect, auto-updater to prompt and pick up 2.0.

https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L268

That doesn't happen.

@iffy
Copy link
Owner

iffy commented Jun 11, 2018

@girishbr Have you tried forking the repo and testing before adding your own code? From what I can see, you have all the update listeners calling sendStatusToWindow but don't have that function defined anywhere.

Instead of using this block of code: https://github.com/iffy/electron-updater-example/blob/master/main.js#L46 (which is not required for updates to work)

Choose one of the two options listed here: https://github.com/iffy/electron-updater-example/blob/master/main.js#L103

@girishbr
Copy link
Author

girishbr commented Jun 11, 2018

@iffy thank you for the feedback. I forked it here: https://github.com/girishbr/electron-updater-example/. Now, I understand how your code works.

I moved it all to about.html
https://github.com/intelligrate/query-cloud-api/blob/master/about.html#L18

ipcRenderer.on('message', function(event, text) {
        var container = document.getElementById('messages');
        var message = document.createElement('div');
        message.innerHTML = text;
        container.appendChild(message);
    })

So, when about.html finishes loading
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L169, I call autoUpdater.checkForUpdatesAndNotify

And on various events like 'checking-for-update', 'update-available', etc, the message is sent to about.html via
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L174

                        function sendStatusToWindow(text) {
                            log.info(text);
                            aboutWin.webContents.send('message', text);
                        }

This closely mimics what I forked. But, it won't work still.

@girishbr
Copy link
Author

Aah! I've to choose one of the two options. My bad. Will check it again.

@iffy
Copy link
Owner

iffy commented Jun 11, 2018

@girishbr k, let me know if it works

@girishbr
Copy link
Author

girishbr commented Jun 11, 2018

Took the easy route with just autoUpdater.checkForUpdatesAndNotify(); right here.
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L309.

  1. Published version 2. Downloaded it
  2. Changed version 2 to version 3. Published it again and made it public.
  3. Ran version 2 from my PC again and closed it expecting it to update.
  4. Ran version 2 again to see the version in about https://github.com/intelligrate/query-cloud-api/blob/master/about.html#L15 - still version 2.

Your code is solid. But, I believe I'm making a fundamental mistake somewhere.

@iffy
Copy link
Owner

iffy commented Jun 11, 2018

I only see v0.0.3, v0.0.1, v0.0.2 in your list of releases: https://github.com/intelligrate/query-cloud-api/releases And v0.0.2 was released 3 days ago?

Maybe your v2 that you're running is not a version with the new code?

@girishbr
Copy link
Author

that's weird! This's what I see.
image

@iffy
Copy link
Owner

iffy commented Jun 11, 2018

Maybe make 0.0.4 and 0.0.5 (both publicly released -- not drafts) to avoid potential name conflicts?

@girishbr
Copy link
Author

Did that. Deleted all the releases.
Just have only one line for checkForUpdatesAndNotify()
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L310

Created version 0.0.1, pushed, published, installed.
Changed package.json to 0.0.2, pushed, published.

Opened app(v0.0.1) expecting an updation to 0.0.2. Didn't happen.

@iffy
Copy link
Owner

iffy commented Jun 12, 2018

@girishbr I'm not sure how the UI works on Windows, but when using checkForUpdatesAndNotify on my mac, I have to launch the app, then wait for it to download the new version (the update notification doesn't appear immediately), then I get a notification, then I have to quit the application and restart it to see the new version. But I'm assuming you're waiting for a bit after starting the app.

Hmm... I'm not sure what the problem is from looking at your code and GitHub releases.

@girishbr
Copy link
Author

girishbr commented Jun 12, 2018

@iffy Thank you for your feedback. I finally got it to work.
Seems like I cannot club autoUpdater call with the main window call. Please look at the comments.

app.on('ready', () => {
    const menu = Menu.buildFromTemplate(template);
    Menu.setApplicationMenu(menu);
    mainWindow = new BrowserWindow({
        width: 1200,
        height: 800,
        minWidth: 1200,
        minHeight: 800,
        icon: appIcon
    });
    mainWindow.loadURL('file://' + __dirname + '/webapp/index.html');

      if (process.env.ACTIVATE_DEBUG) {
            mainWindow.webContents.openDevTools({
                mode: 'detach'
            });
       }

// autoUpdater.checkForUpdatesAndNotify();  
// If auto Updater is called here, updation won't work. 
// It has to be called explicitly in a separate event handler 
// like it's done below.

})

//has to be here only - although both events are "ready"
app.on('ready', function()  {
  autoUpdater.checkForUpdatesAndNotify();
});

something to do with ES6 syntax?

@iffy
Copy link
Owner

iffy commented Jun 12, 2018

I doubt it's some ES6 syntax thing. That seems really odd that it would work in its own handler but not in one with other stuff in it. How long do you have to wait for the notification to appear in the working version?

@girishbr
Copy link
Author

It doesn't happen automatically. It happens only when I exit. And that too only with an explicit exit (ctrl + q) not a window close.
I am planning on bundling it up into a menu option "Update and Restart".

@iffy
Copy link
Owner

iffy commented Oct 3, 2018

@girishbr is this resolved? Can I close this issue?

@JLueke
Copy link

JLueke commented Oct 18, 2018

I just forked the repo and tried it. I only changed owner. No codesigning for windows (neither for mac).
The windows app detects that their is an update available "Update available", but soon after it just says "Update downloaded". Their is no progress bar in between.
Restarting the app doesn't change anything.

@JLueke
Copy link

JLueke commented Oct 19, 2018

The auto-updater currently doesn't work.
There's is a temporary solution until the PR is accepted.
Worked for me.

@kittaakos

This comment has been minimized.

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

No branches or pull requests

4 participants