Support forward command [6/n]
Summary: Support the adb forward command Reviewed By: jameslawson Differential Revision: D31055957 fbshipit-source-id: bc0593320d0e187ddfc8120c1684746f9e9c4cf5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8cf182cc26
commit
11a27f9e1a
@@ -233,6 +233,15 @@ export default class BaseDevice {
|
||||
return this.flipperServer.exec('metro-command', this.serial, command);
|
||||
}
|
||||
|
||||
async forwardPort(local: string, remote: string): Promise<void> {
|
||||
return this.flipperServer.exec(
|
||||
'device-forward-port',
|
||||
this.serial,
|
||||
local,
|
||||
remote,
|
||||
);
|
||||
}
|
||||
|
||||
supportsPlugin(plugin: PluginDefinition | PluginDetails) {
|
||||
let pluginDetails: PluginDetails;
|
||||
if (plugin instanceof _SandyPluginDefinition) {
|
||||
|
||||
@@ -258,6 +258,8 @@ export class FlipperServerImpl implements FlipperServer {
|
||||
}
|
||||
device.sendCommand(command);
|
||||
},
|
||||
'device-forward-port': async (serial, local, remote) =>
|
||||
this.getDevice(serial).forwardPort(local, remote),
|
||||
};
|
||||
|
||||
registerDevice(device: ServerDevice) {
|
||||
|
||||
@@ -69,4 +69,8 @@ export abstract class ServerDevice {
|
||||
async executeShell(_command: string): Promise<string> {
|
||||
throw new Error('executeShell not implemented on BaseDevice');
|
||||
}
|
||||
|
||||
async forwardPort(_local: string, _remote: string): Promise<void> {
|
||||
throw new Error('forwardPort not implemented on BaseDevice');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,6 +264,10 @@ export default class AndroidDevice extends ServerDevice {
|
||||
return destination;
|
||||
}
|
||||
|
||||
async forwardPort(local: string, remote: string): Promise<void> {
|
||||
return this.adb.forward(this.serial, local, remote);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
if (this.recordingProcess) {
|
||||
this.stopScreenCapture();
|
||||
|
||||
@@ -83,6 +83,11 @@ export type FlipperServerCommands = {
|
||||
) => Promise<void>;
|
||||
'device-stop-screencapture': (serial: string) => Promise<string>; // file path
|
||||
'device-shell-exec': (serial: string, command: string) => Promise<string>;
|
||||
'device-forward-port': (
|
||||
serial: string,
|
||||
local: string,
|
||||
remote: string,
|
||||
) => Promise<void>;
|
||||
'metro-command': (serial: string, command: string) => Promise<void>;
|
||||
};
|
||||
|
||||
|
||||
1
desktop/types/adbkit.d.ts
vendored
1
desktop/types/adbkit.d.ts
vendored
@@ -69,6 +69,7 @@ declare module 'adbkit' {
|
||||
getProperties: (serial: string) => Promise<{[key: string]: string}>;
|
||||
trackDevices: () => Promise<DeviceTracker>;
|
||||
kill: () => Promise<boolean>;
|
||||
forward: (serial: string, local: string, remote: string) => Promise<void>;
|
||||
}
|
||||
export function createClient(config: {port: number; host: string}): Client;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user