mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-25 20:26:38 +00:00
fix: update Examples and Include Library menu after ZIP install
Closes #659 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
287b2e3f41
commit
b2bf368db9
@ -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;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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: {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user