-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
179 lines (163 loc) · 3.04 KB
/
index.js
File metadata and controls
179 lines (163 loc) · 3.04 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import {NativeModules} from 'react-native';
const {RNReactNativeEasemob} = NativeModules;
export default RNReactNativeEasemob;
const
{
_login ,
_create,
_logout,
_sendText,
_sendVoice,
_sendVideo,
_sendImage,
_sendLocation,
_addMessageListener,
_getAllContacts,
_getAllConversations,
_getConversation,
_download,
_loadPics,
_searchText,
_deleteMsg,
_forwarding
} = RNReactNativeEasemob
export async function login(user,pwd){
try{
const result = await _login(user,pwd)
_addMessageListener()
return result
}catch (e){
console.log(e)
}
}
export async function create(user,pwd){
try {
const result = await _create(user,pwd)
return result
}
catch (e){
console.log(e)
}
}
export async function logout(){
try{
const result = await _logout()
return result
}catch (e){
console.log(e)
}
}
export async function sendText(content,user){
try{
const result = await _sendText(content,user)
console.log(result)
return result
}catch (e){
console.log(e)
}
}
export async function sendVoice(path,length,user){
try{
const result = await _sendVoice(path,length,user,)
return result
}catch (e){
console.log(e)
}
}
export async function sendVideo(path,thumbPath,length,user){
try{
const result = await _sendVideo(path,thumbPath,length,user)
return result
}catch (e){
console.log(e)
}
}
export async function sendImage(path,user){
try{
const result = await _sendImage(path,user)
console.log(result)
return result
}catch (e){
console.log(e)
}
}
export async function sendLocation(latitude,longitude,address,user){
console.log(latitude,address)
try{
const result = await _sendLocation(latitude-0,longitude-0,address,user)
return result
}catch (e){
console.log(e)
}
}
export async function getAllContacts(){
try{
const result = await _getAllContacts()
return result
}
catch (e){
console.log(e)
}
}
export async function getAllConversations(){
try{
const result = await _getAllConversations()
return result
}catch (e){
console.log(e)
}
}
export async function getConversation(user,msgId){
try{
const result = await _getConversation(user,msgId)
return result
}catch (e){
console.log(e)
}
}
export async function download(user,msgId){
try{
const result=await _download(user,msgId);
return result
}catch (e){
console.log(e)
}
}
export async function loadPics(user){
try{
const result=await _loadPics(user)
return result
}catch (e){
console.log(e)
}
}
export async function searchText(user ,keyword){
try{
const result=await _searchText(user,keyword)
return result
}catch(e){
console.log(e)
}
}
export async function deleteMsg(user,msgId){
console.log('params')
console.log(user,msgId)
try{
const result=await _deleteMsg(user,msgId)
console.log(result)
return result
}catch (e){
console.log("失败")
}
}
export async function forwarding(user,msgId,toUser){
console.log('params')
console.log(user,msgId,toUser)
try{
const result=await _forwarding(user,msgId,toUser)
console.log(result)
return result
}catch (e){
console.log("失败")
}
}