microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
5b782b052bb35ad8372c07dd4c4529a79919fa31

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/android/androidPlatform.ts

33lines · 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, IDesktopPlatform} from "../platformResolver";
6import {IRunOptions} from "../launchArgs";
7import {CommandExecutor} from "../../utils/commands/commandExecutor";
8import {Package} from "../../utils/node/package";
9
10/**
11 * Android specific platform implementation for debugging RN applications.
12 */
13export class AndroidPlatform implements IMobilePlatform {
14 private desktopPlatform: IDesktopPlatform;
15
16 constructor(desktopPlatform: IDesktopPlatform) {
17 this.desktopPlatform = desktopPlatform;
18 }
19
20 public runApp(runOptions: IRunOptions): Q.Promise<void> {
21 return new CommandExecutor(runOptions.projectRoot).spawn(this.desktopPlatform.reactNativeCommandName, ["run-android"]);
22 }
23
24 public enableJSDebuggingMode(runOptions: IRunOptions): Q.Promise<void> {
25 let pkg = new Package(runOptions.projectRoot);
26 return pkg.name()
27 .then(name => {
28 let enableDebugCommand = `adb shell am broadcast -a "com.${name.toLowerCase()}.RELOAD_APP_ACTION" --ez jsproxy true`;
29 let cexec = new CommandExecutor(runOptions.projectRoot);
30 return cexec.execute(enableDebugCommand);
31 });
32 }
33}