1import { AppleAppIdResolver } from './AppleAppIdResolver'; 2import { AppleDeviceManager } from './AppleDeviceManager'; 3import { Device } from './simctl'; 4import { AppIdResolver } from '../AppIdResolver'; 5import { BaseOpenInCustomProps, PlatformManager } from '../PlatformManager'; 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; 17 /** Get redirect URL for native disambiguation. */ 18 getRedirectUrl: () => string | null; 19 /** Dev Client */ 20 getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null; 21 } 22 ) { 23 super(projectRoot, { 24 platform: 'ios', 25 ...options, 26 resolveDeviceAsync: AppleDeviceManager.resolveAsync, 27 }); 28 } 29 30 async openAsync( 31 options: 32 | { runtime: 'expo' | 'web' } 33 | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> }, 34 resolveSettings?: Partial<{ shouldPrompt?: boolean; device?: Device }> 35 ): Promise<{ url: string }> { 36 await AppleDeviceManager.assertSystemRequirementsAsync(); 37 return super.openAsync(options, resolveSettings); 38 } 39 40 _getAppIdResolver(): AppIdResolver { 41 return new AppleAppIdResolver(this.projectRoot); 42 } 43 44 _resolveAlternativeLaunchUrl( 45 applicationId: string, 46 props?: Partial<BaseOpenInCustomProps> 47 ): string { 48 return applicationId; 49 } 50} 51