Disable autodownload of updates on startup (#860)

This commit is contained in:
Francesco Stasi 2022-02-24 11:43:10 +01:00 committed by GitHub
parent 0207778373
commit 481497e384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 23 deletions

View File

@ -18,7 +18,7 @@ import {
IDEUpdaterClient,
IDEUpdaterPath,
} from '../common/protocol/ide-updater';
import { IDEUpdaterImpl } from '../node/ide-updater/ide-updater-impl';
import { IDEUpdaterImpl } from './ide-updater/ide-updater-impl';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(ElectronMainApplication).toSelf().inSingletonScope();

View File

@ -18,6 +18,7 @@ export class IDEUpdaterImpl implements IDEUpdater {
protected clients: Array<IDEUpdaterClient> = [];
init(channel: UpdateChannel) {
this.updater.autoDownload = false;
this.updater.channel = channel;
this.updater.setFeedURL({
provider: 'generic',
@ -27,24 +28,24 @@ export class IDEUpdaterImpl implements IDEUpdater {
channel,
});
this.updater.on('checking-for-update', (e) =>
this.clients.forEach((c) => c.notifyCheckingForUpdate(e))
);
this.updater.on('update-available', (e) =>
this.clients.forEach((c) => c.notifyUpdateAvailable(e))
);
this.updater.on('update-not-available', (e) =>
this.clients.forEach((c) => c.notifyUpdateNotAvailable(e))
);
this.updater.on('download-progress', (e) =>
this.clients.forEach((c) => c.notifyDownloadProgressChanged(e))
);
this.updater.on('update-downloaded', (e) =>
this.clients.forEach((c) => c.notifyDownloadFinished(e))
);
this.updater.on('error', (e) =>
this.clients.forEach((c) => c.notifyError(e))
);
this.updater.on('checking-for-update', (e) => {
this.clients.forEach((c) => c.notifyCheckingForUpdate(e));
});
this.updater.on('update-available', (e) => {
this.clients.forEach((c) => c.notifyUpdateAvailable(e));
});
this.updater.on('update-not-available', (e) => {
this.clients.forEach((c) => c.notifyUpdateNotAvailable(e));
});
this.updater.on('download-progress', (e) => {
this.clients.forEach((c) => c.notifyDownloadProgressChanged(e));
});
this.updater.on('update-downloaded', (e) => {
this.clients.forEach((c) => c.notifyDownloadFinished(e));
});
this.updater.on('error', (e) => {
this.clients.forEach((c) => c.notifyError(e));
});
}
setClient(client: IDEUpdaterClient | undefined): void {
@ -52,10 +53,8 @@ export class IDEUpdaterImpl implements IDEUpdater {
}
async checkForUpdates(): Promise<UpdateInfo | void> {
const {
updateInfo,
cancellationToken,
} = await this.updater.checkForUpdates();
const { updateInfo, cancellationToken } =
await this.updater.checkForUpdates();
this.cancellationToken = cancellationToken;
if (this.updater.currentVersion.compare(updateInfo.version) === -1) {