mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-07 19:36:33 +00:00
Automatically check for updates only once (#863)
* Automatically check for updates only once * set windows version to 2019 on CI
This commit is contained in:
parent
481497e384
commit
baa9b5f7ab
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- os: windows-latest
|
- os: windows-2019
|
||||||
- os: ubuntu-18.04 # https://github.com/arduino/arduino-ide/issues/259
|
- os: ubuntu-18.04 # https://github.com/arduino/arduino-ide/issues/259
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
runs-on: ${{ matrix.config.os }}
|
runs-on: ${{ matrix.config.os }}
|
||||||
|
@ -282,7 +282,7 @@ export class ArduinoFrontendContribution
|
|||||||
this.updaterService.init(
|
this.updaterService.init(
|
||||||
this.arduinoPreferences.get('arduino.ide.updateChannel')
|
this.arduinoPreferences.get('arduino.ide.updateChannel')
|
||||||
);
|
);
|
||||||
this.updater.checkForUpdates().then(async (updateInfo) => {
|
this.updater.checkForUpdates(true).then(async (updateInfo) => {
|
||||||
if (!updateInfo) return;
|
if (!updateInfo) return;
|
||||||
const versionToSkip = await this.localStorageService.getData<string>(
|
const versionToSkip = await this.localStorageService.getData<string>(
|
||||||
SKIP_IDE_VERSION
|
SKIP_IDE_VERSION
|
||||||
|
@ -31,8 +31,8 @@ export class IDEUpdaterCommands implements CommandContribution {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkForUpdates(): Promise<UpdateInfo | void> {
|
async checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void> {
|
||||||
return await this.updater.checkForUpdates();
|
return await this.updater.checkForUpdates(initialCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
async downloadUpdate(): Promise<void> {
|
async downloadUpdate(): Promise<void> {
|
||||||
|
@ -47,7 +47,7 @@ export const IDEUpdaterPath = '/services/ide-updater';
|
|||||||
export const IDEUpdater = Symbol('IDEUpdater');
|
export const IDEUpdater = Symbol('IDEUpdater');
|
||||||
export interface IDEUpdater extends JsonRpcServer<IDEUpdaterClient> {
|
export interface IDEUpdater extends JsonRpcServer<IDEUpdaterClient> {
|
||||||
init(channel: UpdateChannel): void;
|
init(channel: UpdateChannel): void;
|
||||||
checkForUpdates(): Promise<UpdateInfo | void>;
|
checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void>;
|
||||||
downloadUpdate(): Promise<void>;
|
downloadUpdate(): Promise<void>;
|
||||||
quitAndInstall(): void;
|
quitAndInstall(): void;
|
||||||
stopDownload(): void;
|
stopDownload(): void;
|
||||||
|
@ -12,12 +12,13 @@ const IDE_DOWNLOAD_BASE_URL = 'https://downloads.arduino.cc/arduino-ide';
|
|||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class IDEUpdaterImpl implements IDEUpdater {
|
export class IDEUpdaterImpl implements IDEUpdater {
|
||||||
|
private isAlreadyChecked = false;
|
||||||
private updater = autoUpdater;
|
private updater = autoUpdater;
|
||||||
private cancellationToken?: CancellationToken;
|
private cancellationToken?: CancellationToken;
|
||||||
protected theiaFEClient?: IDEUpdaterClient;
|
protected theiaFEClient?: IDEUpdaterClient;
|
||||||
protected clients: Array<IDEUpdaterClient> = [];
|
protected clients: Array<IDEUpdaterClient> = [];
|
||||||
|
|
||||||
init(channel: UpdateChannel) {
|
init(channel: UpdateChannel): void {
|
||||||
this.updater.autoDownload = false;
|
this.updater.autoDownload = false;
|
||||||
this.updater.channel = channel;
|
this.updater.channel = channel;
|
||||||
this.updater.setFeedURL({
|
this.updater.setFeedURL({
|
||||||
@ -52,9 +53,16 @@ export class IDEUpdaterImpl implements IDEUpdater {
|
|||||||
if (client) this.clients.push(client);
|
if (client) this.clients.push(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkForUpdates(): Promise<UpdateInfo | void> {
|
async checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void> {
|
||||||
const { updateInfo, cancellationToken } =
|
if (initialCheck) {
|
||||||
await this.updater.checkForUpdates();
|
if (this.isAlreadyChecked) return Promise.resolve();
|
||||||
|
this.isAlreadyChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
updateInfo,
|
||||||
|
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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user