Skip to content

Commit 481497e

Browse files
authored
Disable autodownload of updates on startup (#860)
1 parent 0207778 commit 481497e

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

arduino-ide-extension/src/electron-main/arduino-electron-main-module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
IDEUpdaterClient,
1919
IDEUpdaterPath,
2020
} from '../common/protocol/ide-updater';
21-
import { IDEUpdaterImpl } from '../node/ide-updater/ide-updater-impl';
21+
import { IDEUpdaterImpl } from './ide-updater/ide-updater-impl';
2222

2323
export default new ContainerModule((bind, unbind, isBound, rebind) => {
2424
bind(ElectronMainApplication).toSelf().inSingletonScope();

arduino-ide-extension/src/node/ide-updater/ide-updater-impl.ts renamed to arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts

+21-22
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class IDEUpdaterImpl implements IDEUpdater {
1818
protected clients: Array<IDEUpdaterClient> = [];
1919

2020
init(channel: UpdateChannel) {
21+
this.updater.autoDownload = false;
2122
this.updater.channel = channel;
2223
this.updater.setFeedURL({
2324
provider: 'generic',
@@ -27,35 +28,33 @@ export class IDEUpdaterImpl implements IDEUpdater {
2728
channel,
2829
});
2930

30-
this.updater.on('checking-for-update', (e) =>
31-
this.clients.forEach((c) => c.notifyCheckingForUpdate(e))
32-
);
33-
this.updater.on('update-available', (e) =>
34-
this.clients.forEach((c) => c.notifyUpdateAvailable(e))
35-
);
36-
this.updater.on('update-not-available', (e) =>
37-
this.clients.forEach((c) => c.notifyUpdateNotAvailable(e))
38-
);
39-
this.updater.on('download-progress', (e) =>
40-
this.clients.forEach((c) => c.notifyDownloadProgressChanged(e))
41-
);
42-
this.updater.on('update-downloaded', (e) =>
43-
this.clients.forEach((c) => c.notifyDownloadFinished(e))
44-
);
45-
this.updater.on('error', (e) =>
46-
this.clients.forEach((c) => c.notifyError(e))
47-
);
31+
this.updater.on('checking-for-update', (e) => {
32+
this.clients.forEach((c) => c.notifyCheckingForUpdate(e));
33+
});
34+
this.updater.on('update-available', (e) => {
35+
this.clients.forEach((c) => c.notifyUpdateAvailable(e));
36+
});
37+
this.updater.on('update-not-available', (e) => {
38+
this.clients.forEach((c) => c.notifyUpdateNotAvailable(e));
39+
});
40+
this.updater.on('download-progress', (e) => {
41+
this.clients.forEach((c) => c.notifyDownloadProgressChanged(e));
42+
});
43+
this.updater.on('update-downloaded', (e) => {
44+
this.clients.forEach((c) => c.notifyDownloadFinished(e));
45+
});
46+
this.updater.on('error', (e) => {
47+
this.clients.forEach((c) => c.notifyError(e));
48+
});
4849
}
4950

5051
setClient(client: IDEUpdaterClient | undefined): void {
5152
if (client) this.clients.push(client);
5253
}
5354

5455
async checkForUpdates(): Promise<UpdateInfo | void> {
55-
const {
56-
updateInfo,
57-
cancellationToken,
58-
} = await this.updater.checkForUpdates();
56+
const { updateInfo, cancellationToken } =
57+
await this.updater.checkForUpdates();
5958

6059
this.cancellationToken = cancellationToken;
6160
if (this.updater.currentVersion.compare(updateInfo.version) === -1) {

0 commit comments

Comments
 (0)