Suport device-open-app command
Summary: It is an escape hatch for testing iOS Sample app if `navigate('/')` cannot be made to work easily (D51394323)
Reviewed By: lblasa
Differential Revision: D51466697
fbshipit-source-id: fd6c2f37504807b4b634b85cb10e837523dadba8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
387d546e77
commit
fb37f27ff5
@@ -288,6 +288,7 @@ export type FlipperServerCommands = {
|
|||||||
serial: string,
|
serial: string,
|
||||||
appBundlePath: string,
|
appBundlePath: string,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
|
'device-open-app': (serial: string, name: string) => Promise<void>;
|
||||||
'device-forward-port': (
|
'device-forward-port': (
|
||||||
serial: string,
|
serial: string,
|
||||||
local: string,
|
local: string,
|
||||||
|
|||||||
@@ -365,6 +365,9 @@ export class FlipperServerImpl implements FlipperServer {
|
|||||||
'device-install-app': async (serial, bundlePath) => {
|
'device-install-app': async (serial, bundlePath) => {
|
||||||
return this.devices.get(serial)?.installApp(bundlePath);
|
return this.devices.get(serial)?.installApp(bundlePath);
|
||||||
},
|
},
|
||||||
|
'device-open-app': async (serial, name) => {
|
||||||
|
return this.devices.get(serial)?.openApp(name);
|
||||||
|
},
|
||||||
'get-server-state': async () => ({
|
'get-server-state': async () => ({
|
||||||
state: this.state,
|
state: this.state,
|
||||||
error: this.stateError,
|
error: this.stateError,
|
||||||
|
|||||||
@@ -82,4 +82,8 @@ export abstract class ServerDevice {
|
|||||||
async installApp(_appBundlePath: string): Promise<void> {
|
async installApp(_appBundlePath: string): Promise<void> {
|
||||||
throw new Error('installApp not implemented');
|
throw new Error('installApp not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openApp(_name: string): Promise<void> {
|
||||||
|
throw new Error('openApp not implemented');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export interface IOSBridge {
|
|||||||
ipaPath: string,
|
ipaPath: string,
|
||||||
tempPath: string,
|
tempPath: string,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
|
openApp: (serial: string, name: string) => Promise<void>;
|
||||||
getInstalledApps: (serial: string) => Promise<IOSInstalledAppDescriptor[]>;
|
getInstalledApps: (serial: string) => Promise<IOSInstalledAppDescriptor[]>;
|
||||||
ls: (serial: string, appBundleId: string, path: string) => Promise<string[]>;
|
ls: (serial: string, appBundleId: string, path: string) => Promise<string[]>;
|
||||||
pull: (
|
pull: (
|
||||||
@@ -149,6 +150,11 @@ export class IDBBridge implements IOSBridge {
|
|||||||
await this._execIdb(`install ${ipaPath} --udid ${serial}`);
|
await this._execIdb(`install ${ipaPath} --udid ${serial}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openApp(serial: string, name: string): Promise<void> {
|
||||||
|
console.log(`Opening app via IDB ${name} ${serial}`);
|
||||||
|
await this._execIdb(`launch ${name} --udid ${serial} -f`);
|
||||||
|
}
|
||||||
|
|
||||||
async getActiveDevices(bootedOnly: boolean): Promise<DeviceTarget[]> {
|
async getActiveDevices(bootedOnly: boolean): Promise<DeviceTarget[]> {
|
||||||
return iosUtil
|
return iosUtil
|
||||||
.targets(this.idbPath, this.enablePhysicalDevices, bootedOnly)
|
.targets(this.idbPath, this.enablePhysicalDevices, bootedOnly)
|
||||||
@@ -217,6 +223,10 @@ export class SimctlBridge implements IOSBridge {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openApp(): Promise<void> {
|
||||||
|
throw new Error('openApp is not implemented for SimctlBridge');
|
||||||
|
}
|
||||||
|
|
||||||
async installApp(
|
async installApp(
|
||||||
serial: string,
|
serial: string,
|
||||||
ipaPath: string,
|
ipaPath: string,
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ export default class IOSDevice
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openApp(name: string): Promise<void> {
|
||||||
|
return this.iOSBridge.openApp(this.serial, name);
|
||||||
|
}
|
||||||
|
|
||||||
async readFlipperFolderForAllApps(): Promise<DeviceDebugData[]> {
|
async readFlipperFolderForAllApps(): Promise<DeviceDebugData[]> {
|
||||||
console.debug('IOSDevice.readFlipperFolderForAllApps', this.info.serial);
|
console.debug('IOSDevice.readFlipperFolderForAllApps', this.info.serial);
|
||||||
const installedApps = await this.iOSBridge.getInstalledApps(
|
const installedApps = await this.iOSBridge.getInstalledApps(
|
||||||
|
|||||||
Reference in New Issue
Block a user