1import { NativeModules, NativeEventEmitter, EventSubscription } from 'react-native';
2
3const DevLauncher = NativeModules.EXDevLauncherInternal;
4const EventEmitter = new NativeEventEmitter(DevLauncher);
5
6const ON_NEW_DEEP_LINK_EVENT = 'expo.modules.devlauncher.onnewdeeplink';
7
8export async function getRecentlyOpenedApps(): Promise<{ [key: string]: string | null }[]> {
9  return await DevLauncher.getRecentlyOpenedApps();
10}
11
12export async function loadApp(url: string): Promise<void> {
13  return await DevLauncher.loadApp(url);
14}
15
16export async function getPendingDeepLink(): Promise<string | null> {
17  return await DevLauncher.getPendingDeepLink();
18}
19
20export async function openCamera(): Promise<void> {
21  return await DevLauncher.openCamera();
22}
23
24export function addDeepLinkListener(callback: (string) => void): EventSubscription {
25  return EventEmitter.addListener(ON_NEW_DEEP_LINK_EVENT, callback);
26}
27
28export type BuildInfo = {
29  appName?: string;
30  appVersion?: string;
31  appIcon?: string;
32  sdkVersion?: string;
33  runtimeVersion?: string;
34};
35
36export async function getBuildInfoAsync(): Promise<BuildInfo> {
37  return DevLauncher.getBuildInfo();
38}
39
40export async function copyToClipboardAsync(content: string): Promise<null> {
41  return DevLauncher.copyToClipboard(content);
42}
43
44export const clientUrlScheme = DevLauncher.clientUrlScheme;
45export const installationID = DevLauncher.installationID;
46export const isDevice = !!DevLauncher.isDevice;
47