1import { AppIdResolver } from '../AppIdResolver'; 2import { BaseOpenInCustomProps, PlatformManager } from '../PlatformManager'; 3import { AppleAppIdResolver } from './AppleAppIdResolver'; 4import { AppleDeviceManager } from './AppleDeviceManager'; 5import { Device } from './simctl'; 6 7/** Manages launching apps on Apple simulators. */ 8export class ApplePlatformManager extends PlatformManager<Device> { 9 constructor( 10 protected projectRoot: string, 11 protected port: number, 12 options: { 13 /** Get the base URL for the dev server hosting this platform manager. */ 14 getDevServerUrl: () => string | null; 15 /** Expo Go URL */ 16 getExpoGoUrl: () => string | null; 17 /** Dev Client */ 18 getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null; 19 } 20 ) { 21 super(projectRoot, { 22 platform: 'ios', 23 ...options, 24 resolveDeviceAsync: AppleDeviceManager.resolveAsync, 25 }); 26 } 27 28 async openAsync( 29 options: 30 | { runtime: 'expo' | 'web' } 31 | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> }, 32 resolveSettings?: Partial<{ shouldPrompt?: boolean; device?: Device }> 33 ): Promise<{ url: string }> { 34 await AppleDeviceManager.assertSystemRequirementsAsync(); 35 return super.openAsync(options, resolveSettings); 36 } 37 38 _getAppIdResolver(): AppIdResolver { 39 return new AppleAppIdResolver(this.projectRoot); 40 } 41 42 _resolveAlternativeLaunchUrl( 43 applicationId: string, 44 props?: Partial<BaseOpenInCustomProps> 45 ): string { 46 return applicationId; 47 } 48} 49