microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2d2a33644976c159bb50bad9df3cb949f150a8ec

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/android/androidPlatform.ts

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