1/** 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 * 7 * @format 8 */ 9 10import {NativeEventEmitter} from '../EventEmitter/NativeEventEmitter'; 11import {EmitterSubscription} from '../vendor/emitter/EventEmitter'; 12 13export interface LinkingStatic extends NativeEventEmitter { 14 /** 15 * Add a handler to Linking changes by listening to the `url` event type 16 * and providing the handler 17 */ 18 addEventListener( 19 type: 'url', 20 handler: (event: {url: string}) => void, 21 ): EmitterSubscription; 22 23 /** 24 * Try to open the given url with any of the installed apps. 25 * You can use other URLs, like a location (e.g. "geo:37.484847,-122.148386"), a contact, or any other URL that can be opened with the installed apps. 26 * NOTE: This method will fail if the system doesn't know how to open the specified URL. If you're passing in a non-http(s) URL, it's best to check {@code canOpenURL} first. 27 * NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly! 28 */ 29 openURL(url: string): Promise<any>; 30 31 /** 32 * Determine whether or not an installed app can handle a given URL. 33 * NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly! 34 * NOTE: As of iOS 9, your app needs to provide the LSApplicationQueriesSchemes key inside Info.plist. 35 * @param URL the URL to open 36 */ 37 canOpenURL(url: string): Promise<boolean>; 38 39 /** 40 * If the app launch was triggered by an app link with, it will give the link url, otherwise it will give null 41 * NOTE: To support deep linking on Android, refer http://developer.android.com/training/app-indexing/deep-linking.html#handling-intents 42 */ 43 getInitialURL(): Promise<string | null>; 44 45 /** 46 * Open the Settings app and displays the app’s custom settings, if it has any. 47 */ 48 openSettings(): Promise<void>; 49 50 /** 51 * Sends an Android Intent - a broad surface to express Android functions. Useful for deep-linking to settings pages, 52 * opening an SMS app with a message draft in place, and more. See https://developer.android.com/reference/kotlin/android/content/Intent?hl=en 53 */ 54 sendIntent( 55 action: string, 56 extras?: Array<{key: string; value: string | number | boolean}>, 57 ): Promise<void>; 58} 59 60export const Linking: LinkingStatic; 61export type Linking = LinkingStatic; 62