Skip to content
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
6 changes: 4 additions & 2 deletions arduino-ide-extension/src/browser/notification-center.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class NotificationCenter
item: BoardsPackage;
}>();
private readonly libraryDidInstallEmitter = new Emitter<{
item: LibraryPackage;
item: LibraryPackage | 'zip-install';
}>();
private readonly libraryDidUninstallEmitter = new Emitter<{
item: LibraryPackage;
Expand Down Expand Up @@ -156,7 +156,9 @@ export class NotificationCenter
this.platformDidUninstallEmitter.fire(event);
}

notifyLibraryDidInstall(event: { item: LibraryPackage }): void {
notifyLibraryDidInstall(event: {
item: LibraryPackage | 'zip-install';
}): void {
this.libraryDidInstallEmitter.fire(event);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export interface NotificationServiceClient {
notifyPlatformDidUninstall(event: { item: BoardsPackage }): void;

// Libraries
notifyLibraryDidInstall(event: { item: LibraryPackage }): void;
notifyLibraryDidInstall(event: {
item: LibraryPackage | 'zip-install';
}): void;
notifyLibraryDidUninstall(event: { item: LibraryPackage }): void;

// Boards discovery
Expand Down
34 changes: 19 additions & 15 deletions arduino-ide-extension/src/node/library-service-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,26 @@ export class LibraryServiceImpl

// stop the board discovery
await this.boardDiscovery.stop();

const resp = client.zipLibraryInstall(req);
resp.on(
'data',
ExecuteWithProgress.createDataCallback({
progressId,
responseService: this.responseService,
})
);
await new Promise<void>((resolve, reject) => {
resp.on('end', () => {
this.boardDiscovery.start(); // TODO: remove discovery dependency from boards service. See https://github.com/arduino/arduino-ide/pull/1107 why this is here.
resolve();
try {
const resp = client.zipLibraryInstall(req);
resp.on(
'data',
ExecuteWithProgress.createDataCallback({
progressId,
responseService: this.responseService,
})
);
await new Promise<void>((resolve, reject) => {
resp.on('end', resolve);
resp.on('error', reject);
});
resp.on('error', reject);
});
await this.refresh(); // let the CLI re-scan the libraries
this.notificationServer.notifyLibraryDidInstall({
item: 'zip-install',
});
} finally {
this.boardDiscovery.start(); // TODO: remove discovery dependency from boards service. See https://github.com/arduino/arduino-ide/pull/1107 why this is here.
}
}

async uninstall(options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export class NotificationServiceServerImpl
this.clients.forEach((client) => client.notifyPlatformDidUninstall(event));
}

notifyLibraryDidInstall(event: { item: LibraryPackage }): void {
notifyLibraryDidInstall(event: {
item: LibraryPackage | 'zip-install';
}): void {
this.clients.forEach((client) => client.notifyLibraryDidInstall(event));
}

Expand Down