Add FLIPPER_PORTS env var to desktop app

Summary:
Part 3 and final part of adding customizable ports. To use this, the iOS / Android apps have to also be started with the same custom ports.

Example usage: `FLIPPER_PORTS=8189,8188 yarn start`

Reviewed By: passy

Differential Revision: D13801761

fbshipit-source-id: 3dd80a3001ed0855e54cc568fa94eb6fac5fc7f1
This commit is contained in:
John Knox
2019-01-25 06:29:05 -08:00
committed by Facebook Github Bot
parent e558d8a01a
commit dbb723f8a5
9 changed files with 124 additions and 27 deletions

View File

@@ -6,11 +6,11 @@
*/
import type {DeviceType, DeviceShell} from './BaseDevice.js';
import type {Store} from '../reducers/index';
import {Priority} from 'adbkit-logcat-fb';
import child_process from 'child_process';
import BaseDevice from './BaseDevice.js';
import {SECURE_PORT, INSECURE_PORT} from '../server';
type ADBClient = any;
@@ -69,16 +69,14 @@ export default class AndroidDevice extends BaseDevice {
return ['date', 'pid', 'tid', 'tag', 'message', 'type', 'time'];
}
reverse(): Promise<void> {
return this.adb
.reverse(this.serial, `tcp:${SECURE_PORT}`, `tcp:${SECURE_PORT}`)
.then(() =>
this.adb.reverse(
this.serial,
`tcp:${INSECURE_PORT}`,
`tcp:${INSECURE_PORT}`,
),
);
reverse(ports: [number]): Promise<void> {
return Promise.all(
ports.map(port =>
this.adb.reverse(this.serial, `tcp:${port}`, `tcp:${port}`),
),
).then(() => {
return;
});
}
spawnShell(): DeviceShell {