mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-27 13:16:43 +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;
|
item: BoardsPackage;
|
||||||
}>();
|
}>();
|
||||||
private readonly libraryDidInstallEmitter = new Emitter<{
|
private readonly libraryDidInstallEmitter = new Emitter<{
|
||||||
item: LibraryPackage;
|
item: LibraryPackage | 'zip-install';
|
||||||
}>();
|
}>();
|
||||||
private readonly libraryDidUninstallEmitter = new Emitter<{
|
private readonly libraryDidUninstallEmitter = new Emitter<{
|
||||||
item: LibraryPackage;
|
item: LibraryPackage;
|
||||||
@ -156,7 +156,9 @@ export class NotificationCenter
|
|||||||
this.platformDidUninstallEmitter.fire(event);
|
this.platformDidUninstallEmitter.fire(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyLibraryDidInstall(event: { item: LibraryPackage }): void {
|
notifyLibraryDidInstall(event: {
|
||||||
|
item: LibraryPackage | 'zip-install';
|
||||||
|
}): void {
|
||||||
this.libraryDidInstallEmitter.fire(event);
|
this.libraryDidInstallEmitter.fire(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,9 @@ export interface NotificationServiceClient {
|
|||||||
notifyPlatformDidUninstall(event: { item: BoardsPackage }): void;
|
notifyPlatformDidUninstall(event: { item: BoardsPackage }): void;
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
notifyLibraryDidInstall(event: { item: LibraryPackage }): void;
|
notifyLibraryDidInstall(event: {
|
||||||
|
item: LibraryPackage | 'zip-install';
|
||||||
|
}): void;
|
||||||
notifyLibraryDidUninstall(event: { item: LibraryPackage }): void;
|
notifyLibraryDidUninstall(event: { item: LibraryPackage }): void;
|
||||||
|
|
||||||
// Boards discovery
|
// Boards discovery
|
||||||
|
@ -373,22 +373,26 @@ export class LibraryServiceImpl
|
|||||||
|
|
||||||
// stop the board discovery
|
// stop the board discovery
|
||||||
await this.boardDiscovery.stop();
|
await this.boardDiscovery.stop();
|
||||||
|
try {
|
||||||
const resp = client.zipLibraryInstall(req);
|
const resp = client.zipLibraryInstall(req);
|
||||||
resp.on(
|
resp.on(
|
||||||
'data',
|
'data',
|
||||||
ExecuteWithProgress.createDataCallback({
|
ExecuteWithProgress.createDataCallback({
|
||||||
progressId,
|
progressId,
|
||||||
responseService: this.responseService,
|
responseService: this.responseService,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
resp.on('end', () => {
|
resp.on('end', resolve);
|
||||||
this.boardDiscovery.start(); // TODO: remove discovery dependency from boards service. See https://github.com/arduino/arduino-ide/pull/1107 why this is here.
|
resp.on('error', reject);
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
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: {
|
async uninstall(options: {
|
||||||
|
@ -59,7 +59,9 @@ export class NotificationServiceServerImpl
|
|||||||
this.clients.forEach((client) => client.notifyPlatformDidUninstall(event));
|
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));
|
this.clients.forEach((client) => client.notifyLibraryDidInstall(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user