Skip to content

[ATL-1294] At first ide startup invoke installation of arduino:avr #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ContextMenuRenderer,
FrontendApplication,
FrontendApplicationContribution,
LocalStorageService,
OpenerService,
StatusBar,
StatusBarAlignment,
Expand Down Expand Up @@ -79,6 +80,8 @@ import { FileChangeType } from '@theia/filesystem/lib/browser';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';

const INIT_AVR_PACKAGES = 'initializedAvrPackages';

@injectable()
export class ArduinoFrontendContribution
implements
Expand Down Expand Up @@ -199,13 +202,26 @@ export class ArduinoFrontendContribution
@inject(FrontendApplicationStateService)
protected readonly appStateService: FrontendApplicationStateService;

@inject(LocalStorageService)
protected readonly localStorageService: LocalStorageService;

protected invalidConfigPopup:
| Promise<void | 'No' | 'Yes' | undefined>
| undefined;
protected toDisposeOnStop = new DisposableCollection();

@postConstruct()
protected async init(): Promise<void> {
const notFirstStartup = await this.localStorageService.getData(
INIT_AVR_PACKAGES
);
if (!notFirstStartup) {
await this.localStorageService.setData(INIT_AVR_PACKAGES, true);
const avrPackage = await this.boardsService.getBoardPackage({
id: 'arduino:avr',
});
avrPackage && (await this.boardsService.install({ item: avrPackage }));
}
if (!window.navigator.onLine) {
// tslint:disable-next-line:max-line-length
this.messageService.warn(
Expand Down