Skip to content

Commit

Permalink
SDA-4406 - auto-update silent download (#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranNiranjan committed Dec 12, 2023
1 parent 71e70df commit e66913c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/auto-update-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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) => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e66913c

Please sign in to comment.