mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
broadcast update available only after downloading update
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
e837e6f1db
commit
2ae30cb285
@ -39,10 +39,10 @@ export const startUpdateChecking = once(function (interval = 1000 * 60 * 60 * 24
|
|||||||
autoUpdater.autoInstallOnAppQuit = false;
|
autoUpdater.autoInstallOnAppQuit = false;
|
||||||
|
|
||||||
autoUpdater
|
autoUpdater
|
||||||
.on("update-available", (args: UpdateInfo) => {
|
.on("update-available", (info: UpdateInfo) => {
|
||||||
if (autoUpdater.autoInstallOnAppQuit) {
|
if (autoUpdater.autoInstallOnAppQuit) {
|
||||||
// a previous auto-update loop was completed with YES+LATER, check if same version
|
// a previous auto-update loop was completed with YES+LATER, check if same version
|
||||||
if (installVersion === args.version) {
|
if (installVersion === info.version) {
|
||||||
// same version, don't broadcast
|
// same version, don't broadcast
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -54,10 +54,14 @@ export const startUpdateChecking = once(function (interval = 1000 * 60 * 60 * 24
|
|||||||
* didn't ask for.
|
* didn't ask for.
|
||||||
*/
|
*/
|
||||||
autoUpdater.autoInstallOnAppQuit = false;
|
autoUpdater.autoInstallOnAppQuit = false;
|
||||||
installVersion = args.version;
|
installVersion = info.version;
|
||||||
|
|
||||||
|
autoUpdater.downloadUpdate()
|
||||||
|
.catch(error => logger.error(`${AutoUpdateLogPrefix}: failed to download update`, { error: String(error) }));
|
||||||
|
})
|
||||||
|
.on("update-downloaded", (info: UpdateInfo) => {
|
||||||
try {
|
try {
|
||||||
const backchannel = `auto-update:${args.version}`;
|
const backchannel = `auto-update:${info.version}`;
|
||||||
|
|
||||||
ipcMain.removeAllListeners(backchannel); // only one handler should be present
|
ipcMain.removeAllListeners(backchannel); // only one handler should be present
|
||||||
|
|
||||||
@ -68,8 +72,8 @@ export const startUpdateChecking = once(function (interval = 1000 * 60 * 60 * 24
|
|||||||
listener: handleAutoUpdateBackChannel,
|
listener: handleAutoUpdateBackChannel,
|
||||||
verifier: areArgsUpdateAvailableToBackchannel,
|
verifier: areArgsUpdateAvailableToBackchannel,
|
||||||
});
|
});
|
||||||
logger.info(`${AutoUpdateLogPrefix}: broadcasting update available`, { backchannel, version: args.version });
|
logger.info(`${AutoUpdateLogPrefix}: broadcasting update available`, { backchannel, version: info.version });
|
||||||
broadcastMessage(UpdateAvailableChannel, backchannel, args);
|
broadcastMessage(UpdateAvailableChannel, backchannel, info);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`${AutoUpdateLogPrefix}: broadcasting failed`, { error });
|
logger.error(`${AutoUpdateLogPrefix}: broadcasting failed`, { error });
|
||||||
installVersion = undefined;
|
installVersion = undefined;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user