microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
4bd0c6691c098818360fd7858937bd9969fa5481

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/debugger/android/androidPlatform.ts

34lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import * as Q from "q";
5import {IMobilePlatform} from "../platformResolver";
6import {IRunOptions} from "../launchArgs";
7import {CommandExecutor} from "../../utils/commands/commandExecutor";
8import {Package} from "../../utils/node/package";
9import {IDesktopPlatform} from "../platformResolver";
10
11/**
12 * Android specific platform implementation for debugging RN applications.
13 */
14export class AndroidPlatform implements IMobilePlatform {
15 private desktopPlatform: IDesktopPlatform;
16
17 constructor(desktopPlatform: IDesktopPlatform) {
18 this.desktopPlatform = desktopPlatform;
19 }
20
21 public runApp(runOptions: IRunOptions): Q.Promise<void> {
22 return new CommandExecutor(runOptions.projectRoot).spawn(this.desktopPlatform.reactNativeCommandName, ["run-android"]);
23 }
24
25 public enableJSDebuggingMode(runOptions: IRunOptions): Q.Promise<void> {
26 let pkg = new Package(runOptions.projectRoot);
27 return pkg.name()
28 .then(name => {
29 let enableDebugCommand = `adb shell am broadcast -a "com.${name.toLowerCase()}.RELOAD_APP_ACTION" --ez jsproxy true`;
30 let cexec = new CommandExecutor(runOptions.projectRoot);
31 return cexec.execute(enableDebugCommand);
32 });
33 }
34}