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, IDEUpdaterClient,
IDEUpdaterPath, IDEUpdaterPath,
} from '../common/protocol/ide-updater'; } 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) => { export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(ElectronMainApplication).toSelf().inSingletonScope(); bind(ElectronMainApplication).toSelf().inSingletonScope();

View File

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