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
@@ -365,6 +365,9 @@ export class FlipperServerImpl implements FlipperServer {
|
||||
'device-install-app': async (serial, 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 () => ({
|
||||
state: this.state,
|
||||
error: this.stateError,
|
||||
|
||||
@@ -82,4 +82,8 @@ export abstract class ServerDevice {
|
||||
async installApp(_appBundlePath: string): Promise<void> {
|
||||
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,
|
||||
tempPath: string,
|
||||
) => Promise<void>;
|
||||
openApp: (serial: string, name: string) => Promise<void>;
|
||||
getInstalledApps: (serial: string) => Promise<IOSInstalledAppDescriptor[]>;
|
||||
ls: (serial: string, appBundleId: string, path: string) => Promise<string[]>;
|
||||
pull: (
|
||||
@@ -149,6 +150,11 @@ export class IDBBridge implements IOSBridge {
|
||||
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[]> {
|
||||
return iosUtil
|
||||
.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(
|
||||
serial: 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[]> {
|
||||
console.debug('IOSDevice.readFlipperFolderForAllApps', this.info.serial);
|
||||
const installedApps = await this.iOSBridge.getInstalledApps(
|
||||
|
||||
Reference in New Issue
Block a user