Skip to content

Commit

Permalink
Refactor show devMenu command (#2242)
Browse files Browse the repository at this point in the history
* Refactor show devMenu command

* Refactor reload command
  • Loading branch information
lexie011 authored Nov 15, 2024
1 parent 1bdb1e3 commit e1d0a2f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
3 changes: 0 additions & 3 deletions src/extension/commands/reloadApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ export class ReloadApp extends Command {
);

async baseFn(): Promise<void> {
await this.reloadApp();
}
public async reloadApp(): Promise<void> {
assert(this.project);
await sendMessageToMetro("reload", this.project);
}
Expand Down
26 changes: 2 additions & 24 deletions src/extension/commands/showDevMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import * as assert from "assert";
import * as nls from "vscode-nls";
import { ErrorHelper } from "../../common/error/errorHelper";
import { InternalErrorCode } from "../../common/error/internalErrorCode";
import { PlatformType } from "../launchArgs";
import { AndroidPlatform } from "../android/androidPlatform";
import { IOSPlatform } from "../ios/iOSPlatform";
import { getRunOptions } from "./util";
import { sendMessageToMetro } from "./util";
import { Command } from "./util/command";

nls.config({
Expand All @@ -28,25 +25,6 @@ export class ShowDevMenu extends Command {

async baseFn(): Promise<void> {
assert(this.project);

const androidPlatform = new AndroidPlatform(
getRunOptions(this.project, PlatformType.Android),
{
packager: this.project.getPackager(),
},
) as AndroidPlatform;

androidPlatform.showDevMenu().catch(() => {});

if (process.platform === "darwin") {
const iosPlatform = new IOSPlatform(getRunOptions(this.project, PlatformType.iOS), {
packager: this.project.getPackager(),
});

iosPlatform.showDevMenu(this.project).catch(() => {});
}
if (process.platform === "win32") {
// TODO: implement Show DevMenu command for RNW
}
await sendMessageToMetro("devMenu", this.project);
}
}

0 comments on commit e1d0a2f

Please sign in to comment.