SDA-4406 - auto-update silent download (#2029)

This commit is contained in:
Kiran Niranjan 2023-12-12 14:10:58 +05:30 committed by GitHub
parent 71e70df12f
commit e66913c556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ export enum ChannelConfigLocation {
ACP = 'ACP',
REGISTRY = 'REGISTRY',
}
const DOWNLOAD_PROGRESS_BANNER_DELAY = 1000 * 10; // 10 sec
const AUTO_UPDATE_REASON = 'autoUpdate';
@ -37,6 +38,7 @@ export class AutoUpdate {
private installVariant: string | undefined = undefined;
private channelConfigLocation: ChannelConfigLocation =
ChannelConfigLocation.LOCALFILE;
private downloadProgressDelayTimer: NodeJS.Timeout | null = null;
constructor() {
this.getGenericServerOptions().then((opts) => {
@ -199,11 +201,16 @@ export class AutoUpdate {
break;
case 'download-progress':
if (!this.didPublishDownloadProgress) {
mainWebContents.send('display-client-banner', eventData);
this.downloadProgressDelayTimer = setTimeout(() => {
mainWebContents.send('display-client-banner', eventData);
}, DOWNLOAD_PROGRESS_BANNER_DELAY);
this.didPublishDownloadProgress = true;
}
break;
case 'update-downloaded':
if (this.downloadProgressDelayTimer) {
clearTimeout(this.downloadProgressDelayTimer);
}
this.isUpdateAvailable = true;
mainWebContents.send('display-client-banner', eventData);
if (isMac) {