2019-05-16 22:28:21 +03:00
|
|
|
/**
|
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*
|
2020-07-22 19:43:45 +03:00
|
|
|
* @flow strict
|
2019-05-16 22:28:21 +03:00
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2019-11-08 22:41:57 +03:00
|
|
|
import type {TurboModule} from '../TurboModule/RCTExport';
|
|
|
|
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
2019-05-23 10:48:22 +03:00
|
|
|
import Platform from '../Utilities/Platform';
|
2019-05-16 22:28:21 +03:00
|
|
|
|
|
|
|
export interface Spec extends TurboModule {
|
|
|
|
// Common interface
|
|
|
|
+getInitialURL: () => Promise<string>;
|
|
|
|
+canOpenURL: (url: string) => Promise<boolean>;
|
|
|
|
+openURL: (url: string) => Promise<void>;
|
|
|
|
+openSettings: () => Promise<void>;
|
|
|
|
|
|
|
|
// Android only
|
|
|
|
+sendIntent: (
|
|
|
|
action: string,
|
2019-11-21 20:38:13 +03:00
|
|
|
extras: ?Array<{
|
|
|
|
key: string,
|
2020-06-10 03:44:26 +03:00
|
|
|
value: string | number | boolean, // TODO(T67672788): Union types are not type safe
|
2019-11-21 20:38:13 +03:00
|
|
|
...
|
|
|
|
}>,
|
2019-05-16 22:28:21 +03:00
|
|
|
) => Promise<void>;
|
|
|
|
|
|
|
|
// Events
|
|
|
|
+addListener: (eventName: string) => void;
|
|
|
|
+removeListeners: (count: number) => void;
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:06:53 +03:00
|
|
|
export default ((Platform.OS === 'android'
|
2019-07-31 15:36:08 +03:00
|
|
|
? TurboModuleRegistry.getEnforcing<Spec>('IntentAndroid')
|
2019-08-09 20:06:53 +03:00
|
|
|
: TurboModuleRegistry.getEnforcing<Spec>('LinkingManager')): Spec);
|