-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
32 lines (25 loc) · 1.09 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { NativeModules, NativeEventEmitter } from 'react-native';
const { UseDeskChat } = NativeModules;
const MessageEvents = new NativeEventEmitter(UseDeskChat);
export class UseDesk {
static initChat = ({companyID, url, urlToSendFile, port, api_token, email, phone, name, nameChat, signature, channelId}) => {
UseDeskChat.initChat(companyID, url, urlToSendFile, port, api_token, email, phone, name, nameChat, signature, channelId);
}
static sendMessage = (text) => {
UseDeskChat.sendMessage(text);
}
static sendFile = (message = "", fileName, fileType, base64) => {
UseDeskChat.sendFile(message, fileName, fileType, base64);
}
static sendFileAndroid = (uri = "", fileType = "", name = "") => {
console.log('uri', uri);
console.log('fileType', fileType);
UseDeskChat.sendFile(uri, fileType, name);
}
static addEventListener = (event, listener) => {
return MessageEvents.addListener(event, listener);
}
static removeEventListener = (event) => {
return MessageEvents.removeAllListeners(event);
}
}