diff --git a/desktop/flipper-common/src/server-types.tsx b/desktop/flipper-common/src/server-types.tsx index d5962caa1..723f4f99f 100644 --- a/desktop/flipper-common/src/server-types.tsx +++ b/desktop/flipper-common/src/server-types.tsx @@ -288,6 +288,7 @@ export type FlipperServerCommands = { serial: string, appBundlePath: string, ) => Promise; + 'device-open-app': (serial: string, name: string) => Promise; 'device-forward-port': ( serial: string, local: string, diff --git a/desktop/flipper-server-core/src/FlipperServerImpl.tsx b/desktop/flipper-server-core/src/FlipperServerImpl.tsx index 1cef26dae..ef9c437af 100644 --- a/desktop/flipper-server-core/src/FlipperServerImpl.tsx +++ b/desktop/flipper-server-core/src/FlipperServerImpl.tsx @@ -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, diff --git a/desktop/flipper-server-core/src/devices/ServerDevice.tsx b/desktop/flipper-server-core/src/devices/ServerDevice.tsx index 5d65f8454..3366dde02 100644 --- a/desktop/flipper-server-core/src/devices/ServerDevice.tsx +++ b/desktop/flipper-server-core/src/devices/ServerDevice.tsx @@ -82,4 +82,8 @@ export abstract class ServerDevice { async installApp(_appBundlePath: string): Promise { throw new Error('installApp not implemented'); } + + async openApp(_name: string): Promise { + throw new Error('openApp not implemented'); + } } diff --git a/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx b/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx index 1a50a26a8..b6162d1fa 100644 --- a/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx +++ b/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx @@ -63,6 +63,7 @@ export interface IOSBridge { ipaPath: string, tempPath: string, ) => Promise; + openApp: (serial: string, name: string) => Promise; getInstalledApps: (serial: string) => Promise; ls: (serial: string, appBundleId: string, path: string) => Promise; pull: ( @@ -149,6 +150,11 @@ export class IDBBridge implements IOSBridge { await this._execIdb(`install ${ipaPath} --udid ${serial}`); } + async openApp(serial: string, name: string): Promise { + console.log(`Opening app via IDB ${name} ${serial}`); + await this._execIdb(`launch ${name} --udid ${serial} -f`); + } + async getActiveDevices(bootedOnly: boolean): Promise { return iosUtil .targets(this.idbPath, this.enablePhysicalDevices, bootedOnly) @@ -217,6 +223,10 @@ export class SimctlBridge implements IOSBridge { ); } + async openApp(): Promise { + throw new Error('openApp is not implemented for SimctlBridge'); + } + async installApp( serial: string, ipaPath: string, diff --git a/desktop/flipper-server-core/src/devices/ios/IOSDevice.tsx b/desktop/flipper-server-core/src/devices/ios/IOSDevice.tsx index 3e88ad3b8..5ec90b9f4 100644 --- a/desktop/flipper-server-core/src/devices/ios/IOSDevice.tsx +++ b/desktop/flipper-server-core/src/devices/ios/IOSDevice.tsx @@ -140,6 +140,10 @@ export default class IOSDevice ); } + async openApp(name: string): Promise { + return this.iOSBridge.openApp(this.serial, name); + } + async readFlipperFolderForAllApps(): Promise { console.debug('IOSDevice.readFlipperFolderForAllApps', this.info.serial); const installedApps = await this.iOSBridge.getInstalledApps(