@d4l/react-native-wear-connectivity
Version:
Establish a two-way connection with wearOS
24 lines • 1.18 kB
JavaScript
import { Platform } from 'react-native';
import { WearConnectivity } from './index';
import { LIBRARY_NAME, IOS_NOT_SUPPORTED_WARNING } from './constants';
const UNHANDLED_CALLBACK = 'The openRemoteURI function was called without a callback function. ';
const UNHANDLED_CALLBACK_REPLY = 'The callback function was invoked with the uri: ';
const UNHANDLED_CALLBACK_ERROR = 'The callback function was invoked with the error: ';
const defaultReplyCb = reply => {
console.log(UNHANDLED_CALLBACK + UNHANDLED_CALLBACK_REPLY, reply);
};
const defaultErrCb = err => {
console.warn(UNHANDLED_CALLBACK + UNHANDLED_CALLBACK_ERROR, err);
};
const openRemoteURI = (uri, nodeId, cb, errCb) => {
const callbackWithDefault = cb ?? defaultReplyCb;
const errCbWithDefault = errCb ?? defaultErrCb;
return WearConnectivity.openRemoteURI(uri, nodeId, callbackWithDefault, errCbWithDefault);
};
const openRemoteURIMock = () => console.warn(LIBRARY_NAME + 'intent' + IOS_NOT_SUPPORTED_WARNING);
let openRemoteURIExport = openRemoteURIMock;
if (Platform.OS !== 'ios') {
openRemoteURIExport = openRemoteURI;
}
export { openRemoteURIExport as openRemoteURI };
//# sourceMappingURL=intent.js.map