18d307f52SEvan Baconimport { AppleAppIdResolver } from './AppleAppIdResolver';
28d307f52SEvan Baconimport { AppleDeviceManager } from './AppleDeviceManager';
38d307f52SEvan Baconimport { Device } from './simctl';
4*8a424bebSJames Ideimport { AppIdResolver } from '../AppIdResolver';
5*8a424bebSJames Ideimport { BaseOpenInCustomProps, PlatformManager } from '../PlatformManager';
68d307f52SEvan Bacon
78d307f52SEvan Bacon/** Manages launching apps on Apple simulators. */
88d307f52SEvan Baconexport class ApplePlatformManager extends PlatformManager<Device> {
98d307f52SEvan Bacon  constructor(
108d307f52SEvan Bacon    protected projectRoot: string,
118d307f52SEvan Bacon    protected port: number,
128d307f52SEvan Bacon    options: {
138d307f52SEvan Bacon      /** Get the base URL for the dev server hosting this platform manager. */
148d307f52SEvan Bacon      getDevServerUrl: () => string | null;
15212e3a1aSEric Samelson      /** Expo Go URL. */
16212e3a1aSEric Samelson      getExpoGoUrl: () => string;
17212e3a1aSEric Samelson      /** Get redirect URL for native disambiguation. */
18212e3a1aSEric Samelson      getRedirectUrl: () => string | null;
198d307f52SEvan Bacon      /** Dev Client */
208d307f52SEvan Bacon      getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;
218d307f52SEvan Bacon    }
228d307f52SEvan Bacon  ) {
238d307f52SEvan Bacon    super(projectRoot, {
248d307f52SEvan Bacon      platform: 'ios',
258d307f52SEvan Bacon      ...options,
268d307f52SEvan Bacon      resolveDeviceAsync: AppleDeviceManager.resolveAsync,
278d307f52SEvan Bacon    });
288d307f52SEvan Bacon  }
298d307f52SEvan Bacon
308d307f52SEvan Bacon  async openAsync(
318d307f52SEvan Bacon    options:
328d307f52SEvan Bacon      | { runtime: 'expo' | 'web' }
338d307f52SEvan Bacon      | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> },
348d307f52SEvan Bacon    resolveSettings?: Partial<{ shouldPrompt?: boolean; device?: Device }>
358d307f52SEvan Bacon  ): Promise<{ url: string }> {
368d307f52SEvan Bacon    await AppleDeviceManager.assertSystemRequirementsAsync();
378d307f52SEvan Bacon    return super.openAsync(options, resolveSettings);
388d307f52SEvan Bacon  }
398d307f52SEvan Bacon
408d307f52SEvan Bacon  _getAppIdResolver(): AppIdResolver {
418d307f52SEvan Bacon    return new AppleAppIdResolver(this.projectRoot);
428d307f52SEvan Bacon  }
438d307f52SEvan Bacon
448d307f52SEvan Bacon  _resolveAlternativeLaunchUrl(
458d307f52SEvan Bacon    applicationId: string,
468d307f52SEvan Bacon    props?: Partial<BaseOpenInCustomProps>
478d307f52SEvan Bacon  ): string {
488d307f52SEvan Bacon    return applicationId;
498d307f52SEvan Bacon  }
508d307f52SEvan Bacon}
51