-
Notifications
You must be signed in to change notification settings - Fork 9
Mac: Install update after the last window is closed - fixes #810 #811
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
base: master
Are you sure you want to change the base?
Conversation
|
@jermy-c Let me know whether this works, please. |
Sorry, I was trying to test it with an unsigned build but so far I haven't found any way to test auto-updates with unsigned builds. |
|
Does the old running build have to be signed, or only the downloaded update needs to be signed? |
The old running build has to be signed. The downloaded update is already signed since it's fetched from GitHub. |
|
So, should I just merge this and we test it after 2 releases? Can you please check the source code, whether you think it will break anything? |
jermy-c
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me!
| import { ipcMain } from 'electron/main'; | ||
| import { join } from 'path' | ||
| import electronUpdater from 'electron-updater'; | ||
| import electronUpdater, { UpdateCheckResult } from 'electron-updater'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import electronUpdater, { UpdateCheckResult } from 'electron-updater'; | |
| import electronUpdater, { type UpdateCheckResult } from 'electron-updater'; |
| update = await autoUpdater.checkForUpdatesAndNotify(); | ||
| setInterval(async () => { | ||
| try { | ||
| if (update?.updateInfo.version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (update?.updateInfo.version) { | |
| if (update?.isUpdateAvailable) { |
Why not use isUpdateAvailable ? Is there still a problem on Linux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There definitely was a problem on Linux. I don't remember whether I tried this specific code.
| }); | ||
|
|
||
| async function updateAndRestartNowIfNeeded() { | ||
| if (update?.updateInfo.version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (update?.updateInfo.version) { | |
| if (await update?.downloadPromise) { |
Maybe we should check if the update is downloaded before installing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (update?.updateInfo.version) { | |
| await update?.downloadPromise; | |
| if (update?.updateInfo.version) { |
d2ed3e0 to
3fc49e6
Compare
7d2a658 to
3640c13
Compare
Fixes #810