UNPKG

@talkjs/react-native

Version:

Official TalkJS SDK for React Native

35 lines (34 loc) 1.28 kB
"use strict"; // @ts-ignore import sha1 from 'sha1'; import { Platform } from 'react-native'; import { IOSNotificationHandler } from './iOSNotification'; import { AndroidNotificationHandler } from './AndroidNotification'; export { Session } from './Session'; export { Chatbox } from './Chatbox'; export { HtmlPanel } from './HtmlPanel'; export { ConversationList } from './ConversationList'; export { getConversationBuilder } from './ConversationBuilder'; export { AndroidImportance, AndroidVisibility } from './Notification'; let handler; export function getNotificationHandler() { return handler; } export function registerPushNotificationHandlers(androidSettings, iosSettings) { if (Platform.OS === 'android') { handler = new AndroidNotificationHandler(); } else if (Platform.OS === 'ios') { const provider = iosSettings?.useFirebase ? 'fcm' : 'apns'; handler = new IOSNotificationHandler(provider); } return handler.setup(androidSettings, iosSettings); } function getId(obj) { const isUser = typeof obj === 'object' && 'id' in obj; return isUser ? obj.id : obj; } export function oneOnOneId(me, other) { const encoded = JSON.stringify([getId(me), getId(other)].sort()); return sha1(encoded).substr(0, 20); } //# sourceMappingURL=index.js.map