From d1843fff790594f3e555ad41bb9b20fbd16e855e Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Tue, 30 May 2023 10:59:23 +0200 Subject: [PATCH] fix: relaxed `saveAll` if no Internet connection The previous logic has incorrectly bailed the save when there is no Internet connection. The corrected logic disallows saving files if there is no connection between the frontend and the backend. Ref: cff2c956845e04d320231e8a924d1a47ad016af7 Closes #2079 Signed-off-by: Akos Kitta --- .../src/browser/theia/core/application-shell.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/arduino-ide-extension/src/browser/theia/core/application-shell.ts b/arduino-ide-extension/src/browser/theia/core/application-shell.ts index 9f0ac6b74..379fb0ff5 100644 --- a/arduino-ide-extension/src/browser/theia/core/application-shell.ts +++ b/arduino-ide-extension/src/browser/theia/core/application-shell.ts @@ -8,13 +8,10 @@ import { TabBar, Widget, } from '@theia/core/lib/browser'; -import { - ConnectionStatus, - ConnectionStatusService, -} from '@theia/core/lib/browser/connection-status-service'; import { nls } from '@theia/core/lib/common/nls'; import { MessageService } from '@theia/core/lib/common/message-service'; import { inject, injectable } from '@theia/core/shared/inversify'; +import { ApplicationConnectionStatusContribution } from './connection-status-service'; import { ToolbarAwareTabBar } from './tab-bars'; @injectable() @@ -22,8 +19,8 @@ export class ApplicationShell extends TheiaApplicationShell { @inject(MessageService) private readonly messageService: MessageService; - @inject(ConnectionStatusService) - private readonly connectionStatusService: ConnectionStatusService; + @inject(ApplicationConnectionStatusContribution) + private readonly connectionStatusService: ApplicationConnectionStatusContribution; override async addWidget( widget: Widget, @@ -64,9 +61,8 @@ export class ApplicationShell extends TheiaApplicationShell { } override async saveAll(options?: SaveOptions): Promise { - if ( - this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE - ) { + // When there is no connection between the IDE2 frontend and backend. + if (this.connectionStatusService.offlineStatus === 'backend') { this.messageService.error( nls.localize( 'theia/core/couldNotSave',