mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-12 03:39:27 +00:00
TMP check updates on start and download
This commit is contained in:
@@ -63,7 +63,7 @@
|
|||||||
"css-element-queries": "^1.2.0",
|
"css-element-queries": "^1.2.0",
|
||||||
"dateformat": "^3.0.3",
|
"dateformat": "^3.0.3",
|
||||||
"deepmerge": "2.0.1",
|
"deepmerge": "2.0.1",
|
||||||
"electron-updater": "^4.6.1",
|
"electron-updater": "^4.6.2",
|
||||||
"fuzzy": "^0.1.3",
|
"fuzzy": "^0.1.3",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"google-protobuf": "^3.11.4",
|
"google-protobuf": "^3.11.4",
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ import { ArduinoPreferences } from './arduino-preferences';
|
|||||||
import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl';
|
import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl';
|
||||||
import { SaveAsSketch } from './contributions/save-as-sketch';
|
import { SaveAsSketch } from './contributions/save-as-sketch';
|
||||||
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
|
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
|
||||||
|
import { IDEUpdaterCommands } from './ide-updater/ide-updater-commands';
|
||||||
|
|
||||||
const INIT_LIBS_AND_PACKAGES = 'initializedLibsAndPackages';
|
const INIT_LIBS_AND_PACKAGES = 'initializedLibsAndPackages';
|
||||||
|
|
||||||
@@ -158,6 +159,9 @@ export class ArduinoFrontendContribution
|
|||||||
@inject(LocalStorageService)
|
@inject(LocalStorageService)
|
||||||
protected readonly localStorageService: LocalStorageService;
|
protected readonly localStorageService: LocalStorageService;
|
||||||
|
|
||||||
|
@inject(IDEUpdaterCommands)
|
||||||
|
protected readonly updater: IDEUpdaterCommands;
|
||||||
|
|
||||||
protected invalidConfigPopup:
|
protected invalidConfigPopup:
|
||||||
| Promise<void | 'No' | 'Yes' | undefined>
|
| Promise<void | 'No' | 'Yes' | undefined>
|
||||||
| undefined;
|
| undefined;
|
||||||
@@ -267,6 +271,22 @@ export class ArduinoFrontendContribution
|
|||||||
viewContribution.initializeLayout(app);
|
viewContribution.initializeLayout(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updater.checkForUpdates().then((updateInfo) => {
|
||||||
|
if (!updateInfo) return;
|
||||||
|
this.messageService
|
||||||
|
.info(
|
||||||
|
`new version available: ${updateInfo.version}`,
|
||||||
|
'ok install it',
|
||||||
|
'nope, thanks'
|
||||||
|
)
|
||||||
|
.then((result) => {
|
||||||
|
if (result === 'ok install it') {
|
||||||
|
this.updater.downloadUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const start = async ({ selectedBoard }: BoardsConfig.Config) => {
|
const start = async ({ selectedBoard }: BoardsConfig.Config) => {
|
||||||
if (selectedBoard) {
|
if (selectedBoard) {
|
||||||
const { name, fqbn } = selectedBoard;
|
const { name, fqbn } = selectedBoard;
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import {
|
|||||||
MessageService,
|
MessageService,
|
||||||
} from '@theia/core';
|
} from '@theia/core';
|
||||||
import { injectable, inject } from 'inversify';
|
import { injectable, inject } from 'inversify';
|
||||||
import { IDEUpdaterService } from '../../common/protocol/ide-updater-service';
|
import {
|
||||||
|
IDEUpdaterService,
|
||||||
|
UpdateInfo,
|
||||||
|
} from '../../common/protocol/ide-updater-service';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class IDEUpdaterCommands implements CommandContribution {
|
export class IDEUpdaterCommands implements CommandContribution {
|
||||||
@@ -31,9 +34,8 @@ export class IDEUpdaterCommands implements CommandContribution {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkForUpdates() {
|
async checkForUpdates(): Promise<UpdateInfo | void> {
|
||||||
const info = await this.updater.checkForUpdates();
|
return await this.updater.checkForUpdates();
|
||||||
this.messageService.info(`version ${info.version} available`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadUpdate() {
|
downloadUpdate() {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export const IDEUpdaterServicePath = '/services/ide-updater';
|
|||||||
export const IDEUpdaterService = Symbol('IDEUpdaterService');
|
export const IDEUpdaterService = Symbol('IDEUpdaterService');
|
||||||
export interface IDEUpdaterService
|
export interface IDEUpdaterService
|
||||||
extends JsonRpcServer<IDEUpdaterServiceClient> {
|
extends JsonRpcServer<IDEUpdaterServiceClient> {
|
||||||
checkForUpdates(): Promise<UpdateInfo>;
|
checkForUpdates(): Promise<UpdateInfo | void>;
|
||||||
downloadUpdate(): Promise<void>;
|
downloadUpdate(): Promise<void>;
|
||||||
quitAndInstall(): void;
|
quitAndInstall(): void;
|
||||||
stopDownload(): void;
|
stopDownload(): void;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export class IDEUpdaterServiceImpl implements IDEUpdaterService {
|
|||||||
channel: 'beta',
|
channel: 'beta',
|
||||||
};
|
};
|
||||||
|
|
||||||
this.cancellationToken = new CancellationToken();
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
this.updater = new NsisUpdater(options);
|
this.updater = new NsisUpdater(options);
|
||||||
} else if (process.platform === 'darwin') {
|
} else if (process.platform === 'darwin') {
|
||||||
@@ -63,13 +62,18 @@ export class IDEUpdaterServiceImpl implements IDEUpdaterService {
|
|||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkForUpdates(): Promise<UpdateInfo> {
|
async checkForUpdates(): Promise<UpdateInfo | void> {
|
||||||
const { updateInfo } = await this.updater.checkForUpdates();
|
const { updateInfo, cancellationToken } =
|
||||||
return updateInfo;
|
await this.updater.checkForUpdates();
|
||||||
|
this.cancellationToken = cancellationToken;
|
||||||
|
if (this.updater.currentVersion.compare(updateInfo.version) === -1) {
|
||||||
|
return updateInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async downloadUpdate(): Promise<void> {
|
async downloadUpdate(): Promise<void> {
|
||||||
await this.updater.downloadUpdate(this.cancellationToken);
|
const result = await this.updater.downloadUpdate(this.cancellationToken);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
stopDownload(): void {
|
stopDownload(): void {
|
||||||
|
|||||||
18
yarn.lock
18
yarn.lock
@@ -4656,10 +4656,10 @@ buffers@~0.1.1:
|
|||||||
resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb"
|
resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb"
|
||||||
integrity sha1-skV5w77U1tOWru5tmorn9Ugqt7s=
|
integrity sha1-skV5w77U1tOWru5tmorn9Ugqt7s=
|
||||||
|
|
||||||
builder-util-runtime@8.9.1:
|
builder-util-runtime@8.9.2:
|
||||||
version "8.9.1"
|
version "8.9.2"
|
||||||
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.9.1.tgz#25f066b3fbc20b3e6236a9b956b1ebb0e33ff66a"
|
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.9.2.tgz#a9669ae5b5dcabfe411ded26678e7ae997246c28"
|
||||||
integrity sha512-c8a8J3wK6BIVLW7ls+7TRK9igspTbzWmUqxFbgK0m40Ggm6efUbxtWVCGIjc+dtchyr5qAMAUL6iEGRdS/6vwg==
|
integrity sha512-rhuKm5vh7E0aAmT6i8aoSfEjxzdYEFX7zDApK+eNgOhjofnWb74d9SRJv0H/8nsgOkos0TZ4zxW0P8J4N7xQ2A==
|
||||||
dependencies:
|
dependencies:
|
||||||
debug "^4.3.2"
|
debug "^4.3.2"
|
||||||
sax "^1.2.4"
|
sax "^1.2.4"
|
||||||
@@ -6309,13 +6309,13 @@ electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.649:
|
|||||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.695.tgz#955f419cf99137226180cc4cca2e59015a4e248d"
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.695.tgz#955f419cf99137226180cc4cca2e59015a4e248d"
|
||||||
integrity sha512-lz66RliUqLHU1Ojxx1A4QUxKydjiQ79Y4dZyPobs2Dmxj5aVL2TM3KoQ2Gs7HS703Bfny+ukI3KOxwAB0xceHQ==
|
integrity sha512-lz66RliUqLHU1Ojxx1A4QUxKydjiQ79Y4dZyPobs2Dmxj5aVL2TM3KoQ2Gs7HS703Bfny+ukI3KOxwAB0xceHQ==
|
||||||
|
|
||||||
electron-updater@^4.6.1:
|
electron-updater@^4.6.2:
|
||||||
version "4.6.1"
|
version "4.6.5"
|
||||||
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.6.1.tgz#80ca805c4f51b2e682aac29d18fed75d6a533d32"
|
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.6.5.tgz#e9a75458bbfd6bb41a58a829839e150ad2eb2d3d"
|
||||||
integrity sha512-YsU1mHqXLrXXmBMsxhxy24PrbaB8rnpZDPmFa2gOkTYk/Ch13+R0fjsRSpPYvqtskVVY0ux8fu+HnUkVkqc7og==
|
integrity sha512-kdTly8O9mSZfm9fslc1mnCY+mYOeaYRy7ERa2Fed240u01BKll3aiupzkd07qKw69KvhBSzuHroIW3mF0D8DWA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/semver" "^7.3.6"
|
"@types/semver" "^7.3.6"
|
||||||
builder-util-runtime "8.9.1"
|
builder-util-runtime "8.9.2"
|
||||||
fs-extra "^10.0.0"
|
fs-extra "^10.0.0"
|
||||||
js-yaml "^4.1.0"
|
js-yaml "^4.1.0"
|
||||||
lazy-val "^1.0.5"
|
lazy-val "^1.0.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user