Skip to content

#193, #324, #327, #717, #851 Replaced the splash screen with a preload #1287

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 3 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"--no-app-auto-install",
"--plugins=local-dir:../plugins",
"--hosted-plugin-inspect=9339",
"--nosplash",
"--content-trace",
"--open-devtools"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CommandRegistry } from '@theia/core/lib/common/command';
import { certificateList, sanifyCertString } from './utils';
import { ArduinoFirmwareUploader } from '../../../common/protocol/arduino-firmware-uploader';
import { nls } from '@theia/core/lib/common';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';

@injectable()
export class UploadCertificateDialogWidget extends ReactWidget {
Expand All @@ -37,6 +38,9 @@ export class UploadCertificateDialogWidget extends ReactWidget {
@inject(ArduinoFirmwareUploader)
protected readonly arduinoFirmwareUploader: ArduinoFirmwareUploader;

@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;

protected certificates: string[] = [];
protected updatableFqbns: string[] = [];
protected availableBoards: AvailableBoard[] = [];
Expand Down Expand Up @@ -66,10 +70,12 @@ export class UploadCertificateDialogWidget extends ReactWidget {
}
});

this.arduinoFirmwareUploader.updatableBoards().then((fqbns) => {
this.updatableFqbns = fqbns;
this.update();
});
this.appStateService.reachedState('ready').then(() =>
this.arduinoFirmwareUploader.updatableBoards().then((fqbns) => {
this.updatableFqbns = fqbns;
this.update();
})
);

this.boardsServiceClient.onAvailableBoardsChanged((availableBoards) => {
this.availableBoards = availableBoards;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ export class SettingsService {

@postConstruct()
protected async init(): Promise<void> {
const settings = await this.loadSettings();
this._settings = deepClone(settings);
this.ready.resolve();
this.appStateService.reachedState('ready').then(async () => {
const settings = await this.loadSettings();
this._settings = deepClone(settings);
this.ready.resolve();
});
}

protected async loadSettings(): Promise<Settings> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
import * as React from '@theia/core/shared/react';
import * as ReactDOM from '@theia/core/shared/react-dom';
import { injectable } from '@theia/core/shared/inversify';
import {
inject,
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import { NotificationCenterComponent } from './notification-center-component';
import { NotificationToastsComponent } from './notification-toasts-component';
import { NotificationsRenderer as TheiaNotificationsRenderer } from '@theia/messages/lib/browser/notifications-renderer';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';

@injectable()
export class NotificationsRenderer extends TheiaNotificationsRenderer {
@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;

@postConstruct()
protected override init(): void {
// Unlike Theia, IDE2 renders the notification area only when the app is ready.
this.appStateService.reachedState('ready').then(() => {
this.createOverlayContainer();
this.render();
});
}

protected override render(): void {
ReactDOM.render(
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import {
ElectronMainWindowServiceExt,
electronMainWindowServiceExtPath,
} from '../../../electron-common/electron-main-window-service-ext';
import {
SplashService,
splashServicePath,
} from '../../../electron-common/splash-service';
import { ElectronWindowService } from './electron-window-service';

export default new ContainerModule((bind, unbind, isBound, rebind) => {
Expand All @@ -24,9 +20,4 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
)
)
.inSingletonScope();
bind(SplashService)
.toDynamicValue(({ container }) =>
ElectronIpcConnectionProvider.createProxy(container, splashServicePath)
)
.inSingletonScope();
});
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import {
inject,
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import {
ConnectionStatus,
ConnectionStatusService,
} from '@theia/core/lib/browser/connection-status-service';
import { ElectronWindowService as TheiaElectronWindowService } from '@theia/core/lib/electron-browser/window/electron-window-service';
import { SplashService } from '../../../electron-common/splash-service';
import { nls } from '@theia/core/lib/common';
import { ElectronWindowService as TheiaElectronWindowService } from '@theia/core/lib/electron-browser/window/electron-window-service';
import {
inject,
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import { WindowServiceExt } from '../../../browser/theia/core/window-service-ext';
import { ElectronMainWindowServiceExt } from '../../../electron-common/electron-main-window-service-ext';

Expand All @@ -23,20 +21,14 @@ export class ElectronWindowService
@inject(ConnectionStatusService)
private readonly connectionStatusService: ConnectionStatusService;

@inject(SplashService)
private readonly splashService: SplashService;

@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;

@inject(ElectronMainWindowServiceExt)
private readonly mainWindowServiceExt: ElectronMainWindowServiceExt;

@postConstruct()
protected override init(): void {
this.appStateService
.reachedAnyState('initialized_layout')
.then(() => this.splashService.requestClose());
// NOOP
// Does not listen on Theia's `window.zoomLevel` changes.
// TODO: IDE2 must switch to the Theia preferences and drop the custom one.
}

protected shouldUnload(): boolean {
Expand Down
5 changes: 0 additions & 5 deletions arduino-ide-extension/src/electron-common/splash-service.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ import {
ElectronMainWindowServiceExt,
electronMainWindowServiceExtPath,
} from '../electron-common/electron-main-window-service-ext';
import {
SplashService,
splashServicePath,
} from '../electron-common/splash-service';
import { ElectronMainWindowServiceExtImpl } from './electron-main-window-service-ext-impl';
import { IDEUpdaterImpl } from './ide-updater/ide-updater-impl';
import { SplashServiceImpl } from './splash/splash-service-impl';
import { ElectronMainApplication } from './theia/electron-main-application';
import { ElectronMainWindowServiceImpl } from './theia/electron-main-window-service';
import { TheiaElectronWindow } from './theia/theia-electron-window';
Expand All @@ -34,17 +29,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(ElectronMainWindowServiceImpl).toSelf().inSingletonScope();
rebind(ElectronMainWindowService).toService(ElectronMainWindowServiceImpl);

bind(SplashServiceImpl).toSelf().inSingletonScope();
bind(SplashService).toService(SplashServiceImpl);
bind(ElectronConnectionHandler)
.toDynamicValue(
(context) =>
new JsonRpcConnectionHandler(splashServicePath, () =>
context.container.get(SplashService)
)
)
.inSingletonScope();

// IDE updater bindings
bind(IDEUpdaterImpl).toSelf().inSingletonScope();
bind(IDEUpdater).toService(IDEUpdaterImpl);
Expand Down
158 changes: 0 additions & 158 deletions arduino-ide-extension/src/electron-main/splash/splash-screen.ts

This file was deleted.

This file was deleted.

Loading