Skip to content

Commit 90046c9

Browse files
author
Alberto Iannaccone
committed
at first ide startup invoke installation of arduino:avr
1 parent 835e991 commit 90046c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ContextMenuRenderer,
1212
FrontendApplication,
1313
FrontendApplicationContribution,
14+
LocalStorageService,
1415
OpenerService,
1516
StatusBar,
1617
StatusBarAlignment,
@@ -79,6 +80,8 @@ import { FileChangeType } from '@theia/filesystem/lib/browser';
7980
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
8081
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
8182

83+
const INIT_AVR_PACKAGES = 'initializedAvrPackages';
84+
8285
@injectable()
8386
export class ArduinoFrontendContribution
8487
implements
@@ -199,13 +202,26 @@ export class ArduinoFrontendContribution
199202
@inject(FrontendApplicationStateService)
200203
protected readonly appStateService: FrontendApplicationStateService;
201204

205+
@inject(LocalStorageService)
206+
protected readonly localStorageService: LocalStorageService;
207+
202208
protected invalidConfigPopup:
203209
| Promise<void | 'No' | 'Yes' | undefined>
204210
| undefined;
205211
protected toDisposeOnStop = new DisposableCollection();
206212

207213
@postConstruct()
208214
protected async init(): Promise<void> {
215+
const notFirstStartup = await this.localStorageService.getData(
216+
INIT_AVR_PACKAGES
217+
);
218+
if (!notFirstStartup) {
219+
await this.localStorageService.setData(INIT_AVR_PACKAGES, true);
220+
const avrPackage = await this.boardsService.getBoardPackage({
221+
id: 'arduino:avr',
222+
});
223+
avrPackage && (await this.boardsService.install({ item: avrPackage }));
224+
}
209225
if (!window.navigator.onLine) {
210226
// tslint:disable-next-line:max-line-length
211227
this.messageService.warn(

0 commit comments

Comments
 (0)