From 68439658a634a8499e3039724677004f4ce47fd6 Mon Sep 17 00:00:00 2001 From: filip131311 Date: Thu, 31 Oct 2024 16:59:54 +0100 Subject: [PATCH 1/3] init --- packages/vscode-extension/src/project/project.ts | 8 ++++++++ .../vscode-extension/src/webview/components/UrlBar.tsx | 1 + 2 files changed, 9 insertions(+) diff --git a/packages/vscode-extension/src/project/project.ts b/packages/vscode-extension/src/project/project.ts index fe29982b9..3cf755e8a 100644 --- a/packages/vscode-extension/src/project/project.ts +++ b/packages/vscode-extension/src/project/project.ts @@ -336,6 +336,14 @@ export class Project public async reload(type: ReloadAction): Promise { this.updateProjectState({ status: "starting" }); + + if (type === "reboot") { + const deviceInfo = this.projectState.selectedDevice!; + await this.start(true, false); + await this.selectDevice(deviceInfo); + return true; + } + const success = (await this.deviceSession?.perform(type)) ?? false; if (success) { this.updateProjectState({ status: "running" }); diff --git a/packages/vscode-extension/src/webview/components/UrlBar.tsx b/packages/vscode-extension/src/webview/components/UrlBar.tsx index 73c2e3add..d6fdbe082 100644 --- a/packages/vscode-extension/src/webview/components/UrlBar.tsx +++ b/packages/vscode-extension/src/webview/components/UrlBar.tsx @@ -18,6 +18,7 @@ function ReloadButton({ disabled }: { disabled: boolean }) { "Reload JS": () => project.reload("reloadJs"), "Restart app process": () => project.reload("restartProcess"), "Reinstall app": () => project.reload("reinstall"), + "Reboot": () => project.reload("reboot"), "Clean rebuild": () => project.restart(true), }}> From 8b0c924bc741773b08ee37def0ca5122f268a378 Mon Sep 17 00:00:00 2001 From: filip131311 Date: Thu, 31 Oct 2024 17:02:51 +0100 Subject: [PATCH 2/3] init --- packages/vscode-extension/src/project/project.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vscode-extension/src/project/project.ts b/packages/vscode-extension/src/project/project.ts index 3cf755e8a..9b1c920b1 100644 --- a/packages/vscode-extension/src/project/project.ts +++ b/packages/vscode-extension/src/project/project.ts @@ -337,6 +337,7 @@ export class Project public async reload(type: ReloadAction): Promise { this.updateProjectState({ status: "starting" }); + // this action needs to be handled outside of device session as it resets the device session itself if (type === "reboot") { const deviceInfo = this.projectState.selectedDevice!; await this.start(true, false); From 43a247a5d42c2cb291bef3cb68e0f2c9a1faa96e Mon Sep 17 00:00:00 2001 From: filip131311 Date: Thu, 21 Nov 2024 12:57:51 +0100 Subject: [PATCH 3/3] changes after CR --- packages/vscode-extension/src/webview/components/UrlBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vscode-extension/src/webview/components/UrlBar.tsx b/packages/vscode-extension/src/webview/components/UrlBar.tsx index 9b0c24a65..213865d3a 100644 --- a/packages/vscode-extension/src/webview/components/UrlBar.tsx +++ b/packages/vscode-extension/src/webview/components/UrlBar.tsx @@ -19,7 +19,7 @@ function ReloadButton({ disabled }: { disabled: boolean }) { "Restart app process": () => project.reload("restartProcess"), "Reinstall app": () => project.reload("reinstall"), "Clear Metro cache": () => project.restart("metro"), - "Reboot Simulated Device": () => project.reload("reboot"), + "Reboot IDE": () => project.reload("reboot"), "Clean rebuild": () => project.restart("all"), }}>