Skip to content

Commit

Permalink
Implement reboot functionality (#680)
Browse files Browse the repository at this point in the history
This PR add a possibility to reboot the reboot device, metro and
devtools processes without triggering clean build. It was previously
only possible by closing and reopening the IDE panel itself.

This also will provide necessary functionality for  #663

### How Has This Been Tested: 

- run an application and pick "Reboot IDE" option from reload dropdown
menu
  • Loading branch information
filip131311 authored Nov 22, 2024
1 parent 95a907f commit 1163d20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/vscode-extension/src/project/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,15 @@ export class Project

public async reload(type: ReloadAction): Promise<boolean> {
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);
await this.selectDevice(deviceInfo);
return true;
}

const success = (await this.deviceSession?.perform(type)) ?? false;
if (success) {
this.updateProjectState({ status: "running" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +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 IDE": () => project.reload("reboot"),
"Clean rebuild": () => project.restart("all"),
}}>
<span className="codicon codicon-refresh" />
Expand Down

0 comments on commit 1163d20

Please sign in to comment.