Skip to content

Commit 09534c6

Browse files
clean up
1 parent 189a6f2 commit 09534c6

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

arduino-ide-extension/src/browser/boards/boards-service-provider.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
6565
protected _availablePorts: Port[] = [];
6666
protected _availableBoards: AvailableBoard[] = [];
6767

68-
private uploadInProgress = false;
68+
private uploadAttemptInProgress = false;
6969

7070
private lastItemRemovedForUpload: { board: Board; port: Port } | undefined;
7171
// "lastPersistingUploadPort", is a port created during an upload, that persisted after
@@ -87,8 +87,8 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
8787
private readonly _reconciled = new Deferred<void>();
8888

8989
onStart(): void {
90-
this.notificationCenter.onUploadInProgress(
91-
this.onUploadNotificationReceived.bind(this)
90+
this.notificationCenter.onUploadAttemptInProgress(
91+
this.onUploadAttemptEventReceived.bind(this)
9292
);
9393
this.notificationCenter.onAttachedBoardsDidChange(
9494
this.notifyAttachedBoardsChanged.bind(this)
@@ -121,8 +121,8 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
121121
return this._reconciled.promise;
122122
}
123123

124-
private onUploadNotificationReceived(uploadInProgress: boolean): void {
125-
this.uploadInProgress = uploadInProgress;
124+
private onUploadAttemptEventReceived(uploadAttemptInProgress: boolean): void {
125+
this.uploadAttemptInProgress = uploadAttemptInProgress;
126126
}
127127

128128
private checkForItemRemoved(event: AttachedBoardsChangeEvent): void {
@@ -192,7 +192,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
192192
this.logger.info('------------------------------------------');
193193
}
194194

195-
if (this.uploadInProgress) {
195+
if (this.uploadAttemptInProgress) {
196196
this.checkForItemRemoved(event);
197197
} else {
198198
this.checkForPersistingPort(event);
@@ -202,7 +202,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
202202
this._availablePorts = event.newState.ports;
203203
this.onAvailablePortsChangedEmitter.fire(this._availablePorts);
204204
this.reconcileAvailableBoards().then(() => {
205-
if (!this.uploadInProgress) {
205+
if (!this.uploadAttemptInProgress) {
206206
this.tryReconnect();
207207
}
208208
});

arduino-ide-extension/src/browser/contributions/upload-sketch.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ export class UploadSketch extends CoreServiceContribution {
195195
// uploadInProgress will be set to false whether the upload fails or not
196196
this.uploadInProgress = true;
197197
this.onDidChangeEmitter.fire();
198-
this.notificationCenter.notifyUploadInProgress(this.uploadInProgress);
199198
this.clearVisibleNotification();
199+
this.notificationCenter.notifyUploadAttemptInProgress(
200+
this.uploadInProgress
201+
);
200202

201203
const verifyOptions =
202204
await this.commandService.executeCommand<CoreService.Options.Compile>(
@@ -249,7 +251,9 @@ export class UploadSketch extends CoreServiceContribution {
249251
} finally {
250252
this.uploadInProgress = false;
251253
this.onDidChangeEmitter.fire();
252-
this.notificationCenter.notifyUploadInProgress(this.uploadInProgress);
254+
this.notificationCenter.notifyUploadAttemptInProgress(
255+
this.uploadInProgress
256+
);
253257
}
254258
}
255259

arduino-ide-extension/src/browser/notification-center.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class NotificationCenter
6666
}>();
6767
private readonly onAppStateDidChangeEmitter =
6868
new Emitter<FrontendApplicationState>();
69-
private readonly onUploadInProgressEmitter = new Emitter<boolean>();
69+
private readonly onUploadAttemptInProgressEmitter = new Emitter<boolean>();
7070

7171
protected readonly toDispose = new DisposableCollection(
7272
this.indexWillUpdateEmitter,
@@ -81,7 +81,7 @@ export class NotificationCenter
8181
this.libraryDidInstallEmitter,
8282
this.libraryDidUninstallEmitter,
8383
this.attachedBoardsDidChangeEmitter,
84-
this.onUploadInProgressEmitter
84+
this.onUploadAttemptInProgressEmitter
8585
);
8686

8787
readonly onIndexDidUpdate = this.indexDidUpdateEmitter.event;
@@ -99,7 +99,8 @@ export class NotificationCenter
9999
this.attachedBoardsDidChangeEmitter.event;
100100
readonly onRecentSketchesDidChange = this.recentSketchesChangedEmitter.event;
101101
readonly onAppStateDidChange = this.onAppStateDidChangeEmitter.event;
102-
readonly onUploadInProgress = this.onUploadInProgressEmitter.event;
102+
readonly onUploadAttemptInProgress =
103+
this.onUploadAttemptInProgressEmitter.event;
103104

104105
@postConstruct()
105106
protected init(): void {
@@ -173,7 +174,7 @@ export class NotificationCenter
173174
this.recentSketchesChangedEmitter.fire(event);
174175
}
175176

176-
notifyUploadInProgress(event: boolean): void {
177-
this.onUploadInProgressEmitter.fire(event);
177+
notifyUploadAttemptInProgress(event: boolean): void {
178+
this.onUploadAttemptInProgressEmitter.fire(event);
178179
}
179180
}

arduino-ide-extension/src/common/protocol/notification-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface NotificationServiceClient {
2828
notifyLibraryDidUninstall(event: { item: LibraryPackage }): void;
2929
notifyAttachedBoardsDidChange(event: AttachedBoardsChangeEvent): void;
3030
notifyRecentSketchesDidChange(event: { sketches: Sketch[] }): void;
31-
notifyUploadInProgress(event: boolean): void;
31+
notifyUploadAttemptInProgress(event: boolean): void;
3232
}
3333

3434
export const NotificationServicePath = '/services/notification-service';

arduino-ide-extension/src/node/notification-service-server.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ export class NotificationServiceServerImpl
8282
);
8383
}
8484

85-
notifyUploadInProgress(event: boolean): void {
86-
this.clients.forEach((client) => client.notifyUploadInProgress(event));
85+
notifyUploadAttemptInProgress(event: boolean): void {
86+
this.clients.forEach((client) =>
87+
client.notifyUploadAttemptInProgress(event)
88+
);
8789
}
8890

8991
setClient(client: NotificationServiceClient): void {

0 commit comments

Comments
 (0)