├── .gitignore
├── .npmignore
├── android
├── build.gradle
├── libs
│ ├── Rong_IMLib_v2_7_3.jar
│ ├── arm64-v8a
│ │ └── libRongIMLib.so
│ ├── armeabi-v7a
│ │ └── libRongIMLib.so
│ ├── armeabi
│ │ └── libRongIMLib.so
│ └── x86
│ │ └── libRongIMLib.so
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── io
│ │ └── rong
│ │ └── imlib
│ │ └── ipc
│ │ ├── IMLibModule.java
│ │ ├── IMLibPackage.java
│ │ ├── PushReceiver.java
│ │ └── Utils.java
│ └── res
│ ├── values-en
│ └── rc_strings.xml
│ ├── values-sw
│ └── rc_notification_string.xml
│ └── values
│ ├── rc_configuration.xml
│ └── rc_strings.xml
├── ios
├── RCTRongCloud.xcodeproj
│ └── project.pbxproj
├── RCTRongCloud
│ ├── RCTConvert+RongCloud.h
│ ├── RCTConvert+RongCloud.m
│ ├── RCTRongCloud.h
│ ├── RCTRongCloud.m
│ ├── RCTRongCloudVoiceManager.h
│ └── RCTRongCloudVoiceManager.m
└── RongCloudSDK
│ ├── RongIMLib.framework
│ ├── Headers
│ │ ├── RCAMRDataConverter.h
│ │ ├── RCChatRoomInfo.h
│ │ ├── RCChatRoomMemberInfo.h
│ │ ├── RCCommandMessage.h
│ │ ├── RCCommandNotificationMessage.h
│ │ ├── RCContactNotificationMessage.h
│ │ ├── RCConversation.h
│ │ ├── RCCustomerServiceConfig.h
│ │ ├── RCCustomerServiceGroupItem.h
│ │ ├── RCCustomerServiceInfo.h
│ │ ├── RCDiscussion.h
│ │ ├── RCDiscussionNotificationMessage.h
│ │ ├── RCEvaluateItem.h
│ │ ├── RCFileMessage.h
│ │ ├── RCFileUtility.h
│ │ ├── RCGroup.h
│ │ ├── RCGroupNotificationMessage.h
│ │ ├── RCIMClient.h
│ │ ├── RCImageMessage.h
│ │ ├── RCInformationNotificationMessage.h
│ │ ├── RCLocationMessage.h
│ │ ├── RCMentionedInfo.h
│ │ ├── RCMessage.h
│ │ ├── RCMessageContent.h
│ │ ├── RCMessageContentView.h
│ │ ├── RCProfileNotificationMessage.h
│ │ ├── RCPublicServiceCommandMessage.h
│ │ ├── RCPublicServiceMenu.h
│ │ ├── RCPublicServiceMenuItem.h
│ │ ├── RCPublicServiceMultiRichContentMessage.h
│ │ ├── RCPublicServiceProfile.h
│ │ ├── RCPublicServiceRichContentMessage.h
│ │ ├── RCReadReceiptInfo.h
│ │ ├── RCRealTimeLocationEndMessage.h
│ │ ├── RCRealTimeLocationManager.h
│ │ ├── RCRealTimeLocationStartMessage.h
│ │ ├── RCRecallNotificationMessage.h
│ │ ├── RCRichContentItem.h
│ │ ├── RCRichContentMessage.h
│ │ ├── RCStatusDefine.h
│ │ ├── RCStatusMessage.h
│ │ ├── RCTextMessage.h
│ │ ├── RCUnknownMessage.h
│ │ ├── RCUploadImageStatusListener.h
│ │ ├── RCUploadMediaStatusListener.h
│ │ ├── RCUserInfo.h
│ │ ├── RCUserTypingStatus.h
│ │ ├── RCUtilities.h
│ │ ├── RCVoiceMessage.h
│ │ ├── RCWatchKitStatusDelegate.h
│ │ ├── RongIMLib.h
│ │ ├── interf_dec.h
│ │ └── interf_enc.h
│ ├── Info.plist
│ └── RongIMLib
│ └── libopencore-amrnb.a
├── package.json
└── src
└── index.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea
2 | /node_modules
3 | /android/build
4 | *.iml
5 |
6 | # OSX
7 | #
8 | .DS_Store
9 |
10 | # Xcode
11 | #
12 | build/
13 | *.pbxuser
14 | !default.pbxuser
15 | *.mode1v3
16 | !default.mode1v3
17 | *.mode2v3
18 | !default.mode2v3
19 | *.perspectivev3
20 | !default.perspectivev3
21 | xcuserdata
22 | *.xccheckout
23 | *.moved-aside
24 | DerivedData
25 | *.hmap
26 | *.ipa
27 | *.xcuserstate
28 | project.xcworkspace
29 |
30 | # Android/IJ
31 | #
32 | .idea
33 | .gradle
34 | local.properties
35 |
36 | # node.js
37 | #
38 | node_modules/
39 | npm-debug.log
40 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | /.idea
2 | /.babelrc
3 | /.npmignore
4 | /.eslintrc
5 | /.nvmrc
6 | /.travis.yml
7 | /local-cli/src
8 | /android/build
9 |
10 | # OSX
11 | #
12 | .DS_Store
13 |
14 | # Xcode
15 | #
16 | build/
17 | *.pbxuser
18 | !default.pbxuser
19 | *.mode1v3
20 | !default.mode1v3
21 | *.mode2v3
22 | !default.mode2v3
23 | *.perspectivev3
24 | !default.perspectivev3
25 | xcuserdata
26 | *.xccheckout
27 | *.moved-aside
28 | DerivedData
29 | *.hmap
30 | *.ipa
31 | *.xcuserstate
32 | project.xcworkspace
33 |
34 | # Android/IJ
35 | #
36 | .idea
37 | .gradle
38 | local.properties
39 |
40 | # node.js
41 | #
42 | node_modules/
43 | npm-debug.log
44 | Example
45 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 |
14 | sourceSets {
15 | main {
16 | jniLibs.srcDirs = ['libs']
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile 'com.facebook.react:react-native:+'
23 | compile files('libs/Rong_IMLib_v2_7_3.jar')
24 | }
25 |
--------------------------------------------------------------------------------
/android/libs/Rong_IMLib_v2_7_3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/android/libs/Rong_IMLib_v2_7_3.jar
--------------------------------------------------------------------------------
/android/libs/arm64-v8a/libRongIMLib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/android/libs/arm64-v8a/libRongIMLib.so
--------------------------------------------------------------------------------
/android/libs/armeabi-v7a/libRongIMLib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/android/libs/armeabi-v7a/libRongIMLib.so
--------------------------------------------------------------------------------
/android/libs/armeabi/libRongIMLib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/android/libs/armeabi/libRongIMLib.so
--------------------------------------------------------------------------------
/android/libs/x86/libRongIMLib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/android/libs/x86/libRongIMLib.so
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
26 |
27 |
28 |
32 |
33 |
35 |
36 |
38 |
39 |
42 |
43 |
46 |
47 |
48 |
51 |
52 |
53 |
57 |
58 |
59 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/imlib/ipc/IMLibModule.java:
--------------------------------------------------------------------------------
1 | package io.rong.imlib.ipc;
2 |
3 | import android.app.Notification;
4 | import android.app.NotificationManager;
5 | import android.app.PendingIntent;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.content.pm.PackageManager;
9 | import android.graphics.Bitmap;
10 | import android.media.MediaPlayer;
11 | import android.media.MediaRecorder;
12 | import android.net.Uri;
13 | import android.support.annotation.Nullable;
14 | import android.support.v4.app.NotificationCompat;
15 | import android.util.Base64;
16 | import android.util.Log;
17 |
18 | import com.facebook.react.bridge.Arguments;
19 | import com.facebook.react.bridge.LifecycleEventListener;
20 | import com.facebook.react.bridge.Promise;
21 | import com.facebook.react.bridge.ReactApplicationContext;
22 | import com.facebook.react.bridge.ReactContext;
23 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
24 | import com.facebook.react.bridge.ReactMethod;
25 | import com.facebook.react.bridge.ReadableMap;
26 | import com.facebook.react.bridge.UiThreadUtil;
27 | import com.facebook.react.bridge.WritableMap;
28 | import com.facebook.react.modules.core.DeviceEventManagerModule;
29 | import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
30 |
31 | import java.io.File;
32 | import java.io.FileInputStream;
33 | import java.io.FileNotFoundException;
34 | import java.io.IOException;
35 | import java.util.Date;
36 | import java.util.List;
37 |
38 | import io.rong.imlib.RongIMClient;
39 | import io.rong.imlib.model.Conversation;
40 | import io.rong.imlib.model.Message;
41 | import io.rong.imlib.model.MessageContent;
42 |
43 | /**
44 | * Created by tdzl2003 on 3/31/16.
45 | */
46 | public class IMLibModule extends ReactContextBaseJavaModule implements RongIMClient.OnReceiveMessageListener, RongIMClient.ConnectionStatusListener, LifecycleEventListener {
47 |
48 | static boolean isIMClientInited = false;
49 |
50 | boolean hostActive = true;
51 |
52 | public IMLibModule(ReactApplicationContext reactContext) {
53 | super(reactContext);
54 |
55 | if (!isIMClientInited) {
56 | isIMClientInited = true;
57 | RongIMClient.init(reactContext.getApplicationContext());
58 | }
59 |
60 | reactContext.addLifecycleEventListener(this);
61 | }
62 |
63 | @Override
64 | public String getName() {
65 | return "RCTRongIMLib";
66 | }
67 |
68 | @Override
69 | public void initialize() {
70 | RongIMClient.setOnReceiveMessageListener(this);
71 | RongIMClient.setConnectionStatusListener(this);
72 | }
73 |
74 | @Override
75 | public void onCatalystInstanceDestroy() {
76 | RongIMClient.setOnReceiveMessageListener(null);
77 | RongIMClient.getInstance().disconnect();
78 | }
79 |
80 | private void sendDeviceEvent(String type, Object arg){
81 | ReactContext context = this.getReactApplicationContext();
82 | context.getJSModule(RCTNativeAppEventEmitter.class)
83 | .emit(type, arg);
84 |
85 | }
86 |
87 | @Override
88 | public boolean onReceived(Message message, int i) {
89 | sendDeviceEvent("rongIMMsgRecved", Utils.convertMessage(message));
90 |
91 | if (!hostActive) {
92 | Context context = getReactApplicationContext();
93 | NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
94 | NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context);
95 | MessageContent content = message.getContent();
96 | String title = content.getUserInfo() != null ? content.getUserInfo().getName() : message.getSenderUserId();
97 |
98 | String contentString = Utils.convertMessageContentToString(content);
99 | mBuilder.setSmallIcon(context.getApplicationInfo().icon)
100 | .setContentTitle(title)
101 | .setContentText(contentString)
102 | .setTicker(contentString)
103 | .setAutoCancel(true)
104 | .setDefaults(Notification.DEFAULT_ALL);
105 |
106 | Intent intent = new Intent();
107 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
108 | Uri.Builder builder = Uri.parse("rong://" + context.getPackageName()).buildUpon();
109 |
110 | builder.appendPath("conversation").appendPath(message.getConversationType().getName())
111 | .appendQueryParameter("targetId", message.getTargetId())
112 | .appendQueryParameter("title", message.getTargetId());
113 | intent.setData(builder.build());
114 | mBuilder.setContentIntent(PendingIntent.getActivity(context, 0, intent, 0));
115 |
116 | Notification notification = mBuilder.build();
117 | mNotificationManager.notify(1000, notification);
118 | }
119 | return true;
120 | }
121 |
122 | RongIMClient client = null;
123 |
124 | @ReactMethod
125 | public void connect(String token, final Promise promise){
126 | if (client != null) {
127 | promise.reject("AlreadyLogined", "Is already logined.");
128 | return;
129 | }
130 | client = RongIMClient.connect(token, new RongIMClient.ConnectCallback() {
131 | /**
132 | * Token 错误,在线上环境下主要是因为 Token 已经过期,您需要向 App Server 重新请求一个新的 Token
133 | */
134 | @Override
135 | public void onTokenIncorrect() {
136 | promise.reject("tokenIncorrect", "Incorrect token provided.");
137 | }
138 |
139 | /**
140 | * 连接融云成功
141 | * @param userid 当前 token
142 | */
143 | @Override
144 | public void onSuccess(String userid) {
145 | promise.resolve(userid);
146 | }
147 |
148 | /**
149 | * 连接融云失败
150 | * @param errorCode 错误码,可到官网 查看错误码对应的注释
151 | */
152 | @Override
153 | public void onError(RongIMClient.ErrorCode errorCode) {
154 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
155 | }
156 | });
157 | }
158 |
159 | @ReactMethod
160 | public void getConversationList(final Promise promise){
161 | if (client == null) {
162 | promise.reject("NotLogined", "Must call connect first.");
163 | return;
164 | }
165 | client.getConversationList(new RongIMClient.ResultCallback>() {
166 |
167 | @Override
168 | public void onSuccess(List conversations) {
169 | promise.resolve(Utils.convertConversationList(conversations));
170 | }
171 |
172 | @Override
173 | public void onError(RongIMClient.ErrorCode errorCode) {
174 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
175 | }
176 | });
177 | }
178 |
179 | @ReactMethod
180 | public void logout(final Promise promise){
181 | if (client == null) {
182 | promise.reject("NotLogined", "Must call connect first.");
183 | return;
184 | }
185 | client.logout();
186 | client = null;
187 | promise.resolve(null);
188 | }
189 |
190 | @ReactMethod
191 | public void disconnect(final Promise promise){
192 | if (client == null) {
193 | promise.reject("NotLogined", "Must call connect first.");
194 | return;
195 | }
196 | client.disconnect();
197 | promise.resolve(null);
198 | }
199 |
200 | @ReactMethod
201 | public void getLatestMessages(String type, String targetId, int count, final Promise promise) {
202 | if (client == null) {
203 | promise.reject("NotLogined", "Must call connect first.");
204 | return;
205 | }
206 | client.getLatestMessages(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId, count, new RongIMClient.ResultCallback>() {
207 |
208 | @Override
209 | public void onSuccess(List messages) {
210 | promise.resolve(Utils.convertMessageList(messages));
211 | }
212 |
213 | @Override
214 | public void onError(RongIMClient.ErrorCode errorCode) {
215 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
216 | }
217 | });
218 | }
219 |
220 | @ReactMethod
221 | public void removeConversation(final String type, final String targetId, final Promise promise) {
222 | if (client == null) {
223 | promise.reject("NotLogined", "Must call connect first.");
224 | return;
225 | }
226 | client.removeConversation(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId, new RongIMClient.ResultCallback(){
227 | @Override
228 | public void onError(RongIMClient.ErrorCode errorCode) {
229 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
230 | }
231 |
232 | @Override
233 | public void onSuccess(Boolean message) {
234 | promise.resolve(message);
235 | }
236 | });
237 | }
238 |
239 | @ReactMethod
240 | public void sendMessage(final String type, final String targetId, final ReadableMap map, final String pushContent, final String pushData, final Promise promise) {
241 | if (client == null) {
242 | promise.reject("NotLogined", "Must call connect first.");
243 | return;
244 | }
245 | if ("image".equals(map.getString("type"))) {
246 | Utils.getImage(Uri.parse(map.getString("imageUrl")), null, new Utils.ImageCallback(){
247 |
248 | @Override
249 | public void invoke(@Nullable Bitmap bitmap) {
250 | if (bitmap == null){
251 | promise.reject("loadImageFailed", "Cannot open image uri ");
252 | return;
253 | }
254 | MessageContent content;
255 | try {
256 | content = Utils.convertImageMessageContent(getReactApplicationContext(), bitmap);
257 | } catch (Throwable e){
258 | promise.reject("cacheImageFailed", e);
259 | return;
260 | }
261 | client.sendImageMessage(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId, content, pushContent, pushData, new RongIMClient.SendImageMessageCallback() {
262 |
263 | @Override
264 | public void onAttached(Message message) {
265 | promise.resolve(Utils.convertMessage(message));
266 | }
267 |
268 | @Override
269 | public void onError(Message message, RongIMClient.ErrorCode e) {
270 | WritableMap ret = Arguments.createMap();
271 | ret.putInt("messageId", message.getMessageId());
272 | ret.putInt("errCode", e.getValue());
273 | ret.putString("errMsg", e.getMessage());
274 | sendDeviceEvent("msgSendFailed", ret);
275 | }
276 |
277 | @Override
278 | public void onSuccess(Message message) {
279 | sendDeviceEvent("msgSendOk", message.getMessageId());
280 | }
281 |
282 | @Override
283 | public void onProgress(Message message, int i) {
284 |
285 | }
286 | });
287 | }
288 | });
289 | return;
290 | }
291 | client.sendMessage(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId, Utils.convertToMessageContent(map), pushContent, pushData, new RongIMClient.SendMessageCallback() {
292 | @Override
293 | public void onError(Integer messageId, RongIMClient.ErrorCode e) {
294 | WritableMap ret = Arguments.createMap();
295 | ret.putInt("messageId", messageId);
296 | ret.putInt("errCode", e.getValue());
297 | ret.putString("errMsg", e.getMessage());
298 | sendDeviceEvent("msgSendFailed", ret);
299 | }
300 |
301 | @Override
302 | public void onSuccess(Integer messageId) {
303 | sendDeviceEvent("msgSendOk", messageId);
304 |
305 | }
306 |
307 | }, new RongIMClient.ResultCallback() {
308 | @Override
309 | public void onError(RongIMClient.ErrorCode errorCode) {
310 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
311 | }
312 |
313 | @Override
314 | public void onSuccess(Message message) {
315 | promise.resolve(Utils.convertMessage(message));
316 | }
317 |
318 | });
319 | }
320 |
321 | @ReactMethod
322 | public void insertMessage(String type, String targetId, String senderId, ReadableMap map, final Promise promise) {
323 | if (client == null) {
324 | promise.reject("NotLogined", "Must call connect first.");
325 | return;
326 | }
327 | client.insertMessage(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId, senderId, Utils.convertToMessageContent(map),
328 | new RongIMClient.ResultCallback() {
329 | @Override
330 | public void onError(RongIMClient.ErrorCode errorCode) {
331 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
332 | }
333 |
334 | @Override
335 | public void onSuccess(Message message) {
336 | promise.resolve(Utils.convertMessage(message));
337 | }
338 | });
339 | }
340 |
341 | @ReactMethod
342 | public void clearMessageUnreadStatus(String type, String targetId, final Promise promise){
343 | if (client == null) {
344 | promise.reject("NotLogined", "Must call connect first.");
345 | return;
346 | }
347 | client.clearMessagesUnreadStatus(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId, new RongIMClient.ResultCallback() {
348 | @Override
349 | public void onSuccess(Boolean aBoolean) {
350 | promise.resolve(null);
351 | }
352 |
353 | @Override
354 | public void onError(RongIMClient.ErrorCode errorCode) {
355 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
356 | }
357 | });
358 | }
359 |
360 | private MediaRecorder recorder;
361 | private Promise recordPromise;
362 |
363 | private File recordTarget = new File(this.getReactApplicationContext().getFilesDir(), "imlibrecord.amr");
364 |
365 | private long startTime;
366 |
367 | @ReactMethod
368 | public void startRecordVoice(Promise promise)
369 | {
370 | if (recorder != null) {
371 | cancelRecordVoice();
372 | return;
373 | }
374 | startTime = new Date().getTime();
375 | recorder = new MediaRecorder();// new出MediaRecorder对象
376 | // 设置MediaRecorder的音频源为麦克风
377 | recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
378 | // 设置MediaRecorder录制的音频格式
379 | recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
380 | // 设置MediaRecorder录制音频的编码为amr.
381 | recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
382 |
383 | recorder.setAudioChannels(1);
384 | recorder.setAudioSamplingRate(8000);
385 |
386 | recorder.setOnErrorListener(new MediaRecorder.OnErrorListener() {
387 | @Override
388 | public void onError(MediaRecorder mr, int what, int extra) {
389 | Log.d("MediaRecord", "OnError: " + what + "" + extra);
390 | }
391 | });
392 |
393 | recorder.setOnInfoListener(new MediaRecorder.OnInfoListener() {
394 | @Override
395 | public void onInfo(MediaRecorder mr, int what, int extra) {
396 | Log.d("MediaRecord", "OnInfo: " + what + "" + extra);
397 | }
398 | });
399 |
400 | recorder.setOutputFile(recordTarget.toString());
401 |
402 | try {
403 | recorder.prepare();
404 | } catch (IOException e) {
405 | recorder.release();
406 | recorder = null;
407 | promise.reject(e);
408 | return;
409 | }
410 | recorder.start();
411 | recordPromise = promise;
412 | }
413 |
414 | @ReactMethod
415 | public void cancelRecordVoice()
416 | {
417 | if (recorder == null){
418 | return;
419 | }
420 | recorder.stop();
421 | recorder.release();
422 | recorder = null;
423 | recordPromise.reject("Canceled", "Record was canceled by user.");
424 | recordPromise = null;
425 | }
426 |
427 | @ReactMethod
428 | public void finishRecordVoice()
429 | {
430 | if (recorder == null){
431 | return;
432 | }
433 | recorder.stop();
434 | recorder.release();
435 | recorder = null;
436 | FileInputStream inputFile = null;
437 | try {
438 | WritableMap ret = Arguments.createMap();
439 |
440 | inputFile = new FileInputStream(recordTarget);
441 | byte[] buffer = new byte[(int) recordTarget.length()];
442 | inputFile.read(buffer);
443 | inputFile.close();
444 | ret.putString("type", "voice");
445 | ret.putString("base64", Base64.encodeToString(buffer, Base64.DEFAULT));
446 | ret.putString("uri", Uri.fromFile(recordTarget).toString());
447 | ret.putInt("duration", (int)(new Date().getTime() - startTime));
448 | recordPromise.resolve(ret);
449 | } catch (IOException e) {
450 | recordPromise.reject(e);
451 | e.printStackTrace();
452 | }
453 | recordPromise = null;
454 | }
455 |
456 | private MediaPlayer player;
457 | private Promise playerPromise;
458 |
459 | @ReactMethod
460 | public void startPlayVoice(ReadableMap map, Promise promise) {
461 | if (player != null){
462 | this.stopPlayVoice();
463 | }
464 |
465 | String strUri = map.getString("uri");
466 | player = MediaPlayer.create(this.getReactApplicationContext(), Uri.parse(strUri));
467 | playerPromise = promise;
468 | player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
469 | @Override
470 | public void onCompletion(MediaPlayer mp) {
471 | onPlayComplete(mp);
472 | }
473 | });
474 | player.start();
475 | }
476 |
477 | private void onPlayComplete(MediaPlayer mp) {
478 | if (player == mp) {
479 | playerPromise.resolve(null);
480 | playerPromise = null;
481 | player.release();
482 | player = null;
483 | }
484 | }
485 |
486 | @ReactMethod
487 | public void stopPlayVoice() {
488 | if (player != null) {
489 | playerPromise.reject("Canceled", "Record was canceled by user.");
490 | playerPromise = null;
491 | player.stop();
492 | player.release();
493 | player = null;
494 | }
495 | }
496 |
497 | @ReactMethod
498 | public void getConversationNotificationStatus(String type, String targetId, final Promise promise){
499 | if (client == null){
500 | promise.reject("NotLogined", "Must call connect first.");
501 | return;
502 | }
503 | client.getConversationNotificationStatus(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId,
504 | new RongIMClient.ResultCallback(){
505 |
506 | @Override
507 | public void onSuccess(Conversation.ConversationNotificationStatus conversationNotificationStatus) {
508 | switch (conversationNotificationStatus) {
509 | case DO_NOT_DISTURB:
510 | promise.resolve(true);
511 | break;
512 | default:
513 | promise.resolve(false);
514 | }
515 | }
516 |
517 | @Override
518 | public void onError(RongIMClient.ErrorCode errorCode) {
519 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
520 | }
521 | });
522 | }
523 |
524 | @ReactMethod
525 | public void setConversationNotificationStatus(String type, String targetId, boolean isBlock, final Promise promise) {
526 | client.setConversationNotificationStatus(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId,
527 | isBlock ? Conversation.ConversationNotificationStatus.DO_NOT_DISTURB : Conversation.ConversationNotificationStatus.NOTIFY,
528 | new RongIMClient.ResultCallback() {
529 |
530 | @Override
531 | public void onSuccess(Conversation.ConversationNotificationStatus conversationNotificationStatus) {
532 | promise.resolve(null);
533 | }
534 |
535 | @Override
536 | public void onError(RongIMClient.ErrorCode errorCode) {
537 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
538 | }
539 | });
540 | }
541 |
542 | @ReactMethod
543 | public void clearMessages(String type, String targetId, final Promise promise) {
544 | client.clearMessages(Conversation.ConversationType.valueOf(type.toUpperCase()), targetId,
545 | new RongIMClient.ResultCallback() {
546 | @Override
547 | public void onSuccess(Boolean aBoolean) {
548 | promise.resolve(null);
549 | }
550 |
551 | @Override
552 | public void onError(RongIMClient.ErrorCode errorCode) {
553 | promise.reject("" + errorCode.getValue(), errorCode.getMessage());
554 | }
555 | });
556 | }
557 |
558 | @Override
559 | public void onChanged(ConnectionStatus connectionStatus) {
560 | WritableMap map = Arguments.createMap();
561 | map.putInt("code", connectionStatus.getValue());
562 | map.putString("message", connectionStatus.getMessage());
563 | this.sendDeviceEvent("rongIMConnectionStatus", map);
564 | }
565 |
566 | @Override
567 | public void onHostResume() {
568 | this.hostActive = true;
569 | }
570 |
571 | @Override
572 | public void onHostPause() {
573 | this.hostActive = false;
574 | }
575 |
576 | @Override
577 | public void onHostDestroy() {
578 |
579 | }
580 | }
581 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/imlib/ipc/IMLibPackage.java:
--------------------------------------------------------------------------------
1 | package io.rong.imlib.ipc;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 |
9 | import java.util.Arrays;
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by tdzl2003 on 3/31/16.
15 | */
16 | public class IMLibPackage implements ReactPackage {
17 |
18 | @Override
19 | public List createNativeModules(ReactApplicationContext reactContext) {
20 | return Arrays.asList(new NativeModule[]{
21 | // Modules from third-party
22 | new IMLibModule(reactContext),
23 | });
24 | }
25 |
26 | public List> createJSModules() {
27 | return Collections.emptyList();
28 | }
29 |
30 | @Override
31 | public List createViewManagers(ReactApplicationContext reactContext) {
32 | return Collections.emptyList();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/imlib/ipc/PushReceiver.java:
--------------------------------------------------------------------------------
1 | package io.rong.imlib.ipc;
2 |
3 | import android.content.Context;
4 |
5 | import io.rong.push.notification.PushMessageReceiver;
6 | import io.rong.push.notification.PushNotificationMessage;
7 |
8 | /**
9 | * Created by tdzl2003 on 11/5/16.
10 | */
11 | public class PushReceiver extends PushMessageReceiver {
12 | @Override
13 | public boolean onNotificationMessageArrived(Context context, PushNotificationMessage pushNotificationMessage) {
14 | return false;
15 | }
16 |
17 | @Override
18 | public boolean onNotificationMessageClicked(Context context, PushNotificationMessage pushNotificationMessage) {
19 | return false;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/imlib/ipc/Utils.java:
--------------------------------------------------------------------------------
1 | package io.rong.imlib.ipc;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Matrix;
6 | import android.graphics.RectF;
7 | import android.net.Uri;
8 | import android.support.annotation.Nullable;
9 |
10 | import com.facebook.common.executors.UiThreadImmediateExecutorService;
11 | import com.facebook.common.references.CloseableReference;
12 | import com.facebook.datasource.DataSource;
13 | import com.facebook.drawee.backends.pipeline.Fresco;
14 | import com.facebook.imagepipeline.common.ResizeOptions;
15 | import com.facebook.imagepipeline.core.ImagePipeline;
16 | import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
17 | import com.facebook.imagepipeline.image.CloseableImage;
18 | import com.facebook.imagepipeline.request.ImageRequest;
19 | import com.facebook.imagepipeline.request.ImageRequestBuilder;
20 | import com.facebook.react.bridge.Arguments;
21 | import com.facebook.react.bridge.ReadableMap;
22 | import com.facebook.react.bridge.WritableArray;
23 | import com.facebook.react.bridge.WritableMap;
24 |
25 | import org.w3c.dom.Text;
26 |
27 | import java.io.File;
28 | import java.io.FileNotFoundException;
29 | import java.io.FileOutputStream;
30 | import java.io.IOException;
31 | import java.util.List;
32 |
33 | import io.rong.imlib.RongIMClient;
34 | import io.rong.imlib.model.Conversation;
35 | import io.rong.imlib.model.Message;
36 | import io.rong.imlib.model.MessageContent;
37 | import io.rong.message.CommandNotificationMessage;
38 | import io.rong.message.ImageMessage;
39 | import io.rong.message.TextMessage;
40 | import io.rong.message.VoiceMessage;
41 |
42 | /**
43 | * Created by tdzl2003 on 4/13/16.
44 | */
45 | public class Utils {
46 |
47 | public static WritableMap convertMessage(Message message) {
48 | WritableMap ret = Arguments.createMap();
49 | ret.putString("senderId", message.getSenderUserId());
50 | ret.putString("targetId", message.getTargetId());
51 | ret.putString("conversationType", message.getConversationType().getName());
52 | ret.putString("extra", message.getExtra());
53 | ret.putInt("messageId", message.getMessageId());
54 | ret.putDouble("receivedTime", message.getReceivedTime());
55 | ret.putDouble("sentTime", message.getSentTime());
56 | ret.putMap("content", convertMessageContent(message.getContent()));
57 | return ret;
58 | }
59 |
60 |
61 | private static WritableMap convertMessageContent(MessageContent content) {
62 | WritableMap ret = Arguments.createMap();
63 | if (content instanceof TextMessage) {
64 | TextMessage textContent = (TextMessage)content;
65 | ret.putString("type", "text");
66 | ret.putString("content", textContent.getContent());
67 | ret.putString("extra", textContent.getExtra());
68 | } else if (content instanceof VoiceMessage) {
69 | VoiceMessage voiceContent = (VoiceMessage)content;
70 | ret.putString("type", "voice");
71 | ret.putString("uri", voiceContent.getUri().toString());
72 | ret.putInt("duration", voiceContent.getDuration());
73 | ret.putString("extra", voiceContent.getExtra());
74 | } else if (content instanceof ImageMessage){
75 | ImageMessage imageContent = (ImageMessage)content;
76 | ret.putString("type", "image");
77 | if (imageContent.getLocalUri() != null) {
78 | ret.putString("imageUrl", imageContent.getLocalUri().toString());
79 | }
80 | ret.putString("thumb", imageContent.getThumUri().toString());
81 | ret.putString("extra", imageContent.getExtra());
82 | } else if (content instanceof CommandNotificationMessage) {
83 | CommandNotificationMessage notifyContent = (CommandNotificationMessage)content;
84 | ret.putString("type", "notify");
85 | ret.putString("name", notifyContent.getName());
86 | ret.putString("data", notifyContent.getData());
87 | } else {
88 | ret.putString("type", "unknown");
89 | }
90 | return ret;
91 | }
92 |
93 | public static WritableArray convertMessageList(List messages) {
94 | WritableArray ret = Arguments.createArray();
95 |
96 | if (messages != null) {
97 | for (Message msg : messages) {
98 | ret.pushMap(convertMessage(msg));
99 | }
100 | }
101 | return ret;
102 | }
103 |
104 | public static WritableArray convertConversationList(List conversations) {
105 | WritableArray ret = Arguments.createArray();
106 | if (conversations != null) {
107 | for (Conversation conv : conversations) {
108 | ret.pushMap(convertConversation(conv));
109 | }
110 | }
111 | return ret;
112 | }
113 |
114 | private static WritableMap convertConversation(Conversation conv) {
115 | WritableMap ret = Arguments.createMap();
116 | ret.putString("title", conv.getConversationTitle());
117 | ret.putBoolean("isTop", conv.isTop());
118 | ret.putString("type", conv.getConversationType().getName());
119 | ret.putString("targetId", conv.getTargetId());
120 | ret.putString("senderUserId", conv.getSenderUserId());
121 | ret.putInt("unreadCount", conv.getUnreadMessageCount());
122 | ret.putDouble("sentTime", conv.getSentTime());
123 | ret.putDouble("receivedTime", conv.getReceivedTime());
124 | ret.putDouble("latestMessageId", conv.getLatestMessageId());
125 |
126 | ret.putString("conversationTitle", conv.getConversationTitle());
127 | ret.putMap("lastMessage", convertMessageContent(conv.getLatestMessage()));
128 | return ret;
129 |
130 | }
131 |
132 | public static MessageContent convertToMessageContent(ReadableMap map) {
133 | String type = map.getString("type");
134 | if (type.equals("text")) {
135 | TextMessage ret = TextMessage.obtain(map.getString("content"));
136 | if (map.hasKey("extra")) {
137 | ret.setExtra(map.getString("extra"));
138 | }
139 | return ret;
140 | } else if (type.equals("voice")) {
141 | VoiceMessage ret = VoiceMessage.obtain(Uri.parse(map.getString("uri")), map.getInt("duration"));
142 | // ret.setBase64(map.getString("base64"));
143 | if (map.hasKey("extra")) {
144 | ret.setExtra(map.getString("extra"));
145 | }
146 | return ret;
147 | } else if (type.equals("image")) {
148 | String uri = map.getString("imageUrl");
149 | ImageMessage ret = ImageMessage.obtain(Uri.parse(uri), Uri.parse(uri), map.hasKey("full") && map.getBoolean("full"));
150 | if (map.hasKey("extra")) {
151 | ret.setExtra(map.getString("extra"));
152 | }
153 | return ret;
154 | } else if (type.equals("notify")) {
155 | CommandNotificationMessage ret = CommandNotificationMessage.obtain(map.getString("name"), map.getString("data"));
156 | return ret;
157 | }
158 | return TextMessage.obtain("[未知消息]");
159 | }
160 |
161 | public static String convertMessageContentToString(MessageContent content) {
162 | if (content instanceof TextMessage) {
163 | TextMessage textContent = (TextMessage)content;
164 | return textContent.getContent();
165 | } else if (content instanceof VoiceMessage) {
166 | VoiceMessage voiceContent = (VoiceMessage)content;
167 | return "[语音消息]";
168 | } else if (content instanceof ImageMessage){
169 | ImageMessage imageContent = (ImageMessage)content;
170 | return "[图片]";
171 | } else if (content instanceof CommandNotificationMessage) {
172 | return "[通知]";
173 | } else {
174 | return "[新消息]";
175 | }
176 | }
177 |
178 | public interface ImageCallback {
179 | void invoke(@Nullable Bitmap bitmap);
180 | }
181 |
182 | public static void getImage(Uri uri, ResizeOptions resizeOptions, final ImageCallback imageCallback) {
183 | BaseBitmapDataSubscriber dataSubscriber = new BaseBitmapDataSubscriber() {
184 | @Override
185 | protected void onNewResultImpl(Bitmap bitmap) {
186 | bitmap = bitmap.copy(bitmap.getConfig(), true);
187 | imageCallback.invoke(bitmap);
188 | }
189 |
190 | @Override
191 | protected void onFailureImpl(DataSource> dataSource) {
192 | imageCallback.invoke(null);
193 | }
194 | };
195 |
196 | ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
197 | if (resizeOptions != null) {
198 | builder = builder.setResizeOptions(resizeOptions);
199 | }
200 | ImageRequest imageRequest = builder.build();
201 |
202 | ImagePipeline imagePipeline = Fresco.getImagePipeline();
203 | DataSource> dataSource = imagePipeline.fetchDecodedImage(imageRequest, null);
204 | dataSource.subscribe(dataSubscriber, UiThreadImmediateExecutorService.getInstance());
205 | }
206 |
207 | public static MessageContent convertImageMessageContent(Context context, Bitmap bmpSource) throws IOException {
208 | File imageFileSource = new File(context.getCacheDir(), "source.jpg");
209 | File imageFileThumb = new File(context.getCacheDir(), "thumb.jpg");
210 |
211 | FileOutputStream fosSource = new FileOutputStream(imageFileSource);
212 |
213 | // 保存原图。
214 | bmpSource.compress(Bitmap.CompressFormat.JPEG, 100, fosSource);
215 |
216 | // 创建缩略图变换矩阵。
217 | Matrix m = new Matrix();
218 | m.setRectToRect(new RectF(0, 0, bmpSource.getWidth(), bmpSource.getHeight()), new RectF(0, 0, 160, 160), Matrix.ScaleToFit.CENTER);
219 |
220 | // 生成缩略图。
221 | Bitmap bmpThumb = Bitmap.createBitmap(bmpSource, 0, 0, bmpSource.getWidth(), bmpSource.getHeight(), m, true);
222 |
223 | imageFileThumb.createNewFile();
224 |
225 | FileOutputStream fosThumb = new FileOutputStream(imageFileThumb);
226 | bmpThumb.compress(Bitmap.CompressFormat.JPEG, 60, fosThumb);
227 |
228 | ImageMessage imgMsg = ImageMessage.obtain(Uri.fromFile(imageFileThumb), Uri.fromFile(imageFileSource));
229 |
230 | return imgMsg;
231 | }
232 | }
233 |
--------------------------------------------------------------------------------
/android/src/main/res/values-en/rc_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Custom Service Have Quit
5 | Failed Connect Custom Service
6 |
7 | You have a new message
8 |
9 | %1$s sent %2$d messages
10 | %1$d contacts sent %2$d messages
11 |
12 |
--------------------------------------------------------------------------------
/android/src/main/res/values-sw/rc_notification_string.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Umepokea Ujumbe Mpya
5 | %1$s ametuma ujumbe %2$d
6 | Mrafiki.%1$d wametuma ujumbe %2$d
7 |
--------------------------------------------------------------------------------
/android/src/main/res/values/rc_configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 7950
5 |
6 |
7 | 85
8 |
9 | 960
10 |
11 | false
12 |
13 | /RongCloud/Media/
14 |
15 |
--------------------------------------------------------------------------------
/android/src/main/res/values/rc_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 客服已结束
5 | 连接客服失败
6 |
7 | 您有了一条新消息
8 | %1$s发来了%2$d条消息
9 | %1$d个联系人发来了%2$d条消息
10 |
--------------------------------------------------------------------------------
/ios/RCTRongCloud.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 09B385661CC20D5300BB85ED /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09B385651CC20D5300BB85ED /* AVFoundation.framework */; };
11 | 09B385681CC20D5900BB85ED /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09B385671CC20D5900BB85ED /* CoreAudio.framework */; };
12 | 09B80B331CC8ED5500E37B9A /* RCTRongCloudVoiceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 09B80B321CC8ED5500E37B9A /* RCTRongCloudVoiceManager.m */; };
13 | 91B363D21C57459700137B9C /* RCTRongCloud.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91B363D11C57459700137B9C /* RCTRongCloud.h */; };
14 | 91B363D41C57459700137B9C /* RCTRongCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 91B363D31C57459700137B9C /* RCTRongCloud.m */; };
15 | 91B363F41C5747BD00137B9C /* RongIMLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 91B363F31C5747BD00137B9C /* RongIMLib.framework */; };
16 | 91EC70AD1C5753A4001FDC90 /* libopencore-amrnb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 91EC70AC1C5753A4001FDC90 /* libopencore-amrnb.a */; };
17 | 91EC70B01C575424001FDC90 /* RCTConvert+RongCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 91EC70AF1C575424001FDC90 /* RCTConvert+RongCloud.m */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXCopyFilesBuildPhase section */
21 | 91B363CC1C57459700137B9C /* CopyFiles */ = {
22 | isa = PBXCopyFilesBuildPhase;
23 | buildActionMask = 2147483647;
24 | dstPath = "include/$(PRODUCT_NAME)";
25 | dstSubfolderSpec = 16;
26 | files = (
27 | 91B363D21C57459700137B9C /* RCTRongCloud.h in CopyFiles */,
28 | );
29 | runOnlyForDeploymentPostprocessing = 0;
30 | };
31 | /* End PBXCopyFilesBuildPhase section */
32 |
33 | /* Begin PBXFileReference section */
34 | 09B385651CC20D5300BB85ED /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
35 | 09B385671CC20D5900BB85ED /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
36 | 09B80B311CC8ED5500E37B9A /* RCTRongCloudVoiceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRongCloudVoiceManager.h; sourceTree = ""; };
37 | 09B80B321CC8ED5500E37B9A /* RCTRongCloudVoiceManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRongCloudVoiceManager.m; sourceTree = ""; };
38 | 91B363CE1C57459700137B9C /* libRCTRongCloud.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTRongCloud.a; sourceTree = BUILT_PRODUCTS_DIR; };
39 | 91B363D11C57459700137B9C /* RCTRongCloud.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTRongCloud.h; sourceTree = ""; };
40 | 91B363D31C57459700137B9C /* RCTRongCloud.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTRongCloud.m; sourceTree = ""; };
41 | 91B363F31C5747BD00137B9C /* RongIMLib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RongIMLib.framework; sourceTree = ""; };
42 | 91EC70AC1C5753A4001FDC90 /* libopencore-amrnb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libopencore-amrnb.a"; sourceTree = ""; };
43 | 91EC70AE1C575424001FDC90 /* RCTConvert+RongCloud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+RongCloud.h"; sourceTree = ""; };
44 | 91EC70AF1C575424001FDC90 /* RCTConvert+RongCloud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+RongCloud.m"; sourceTree = ""; };
45 | /* End PBXFileReference section */
46 |
47 | /* Begin PBXFrameworksBuildPhase section */
48 | 91B363CB1C57459700137B9C /* Frameworks */ = {
49 | isa = PBXFrameworksBuildPhase;
50 | buildActionMask = 2147483647;
51 | files = (
52 | 09B385681CC20D5900BB85ED /* CoreAudio.framework in Frameworks */,
53 | 09B385661CC20D5300BB85ED /* AVFoundation.framework in Frameworks */,
54 | 91B363F41C5747BD00137B9C /* RongIMLib.framework in Frameworks */,
55 | 91EC70AD1C5753A4001FDC90 /* libopencore-amrnb.a in Frameworks */,
56 | );
57 | runOnlyForDeploymentPostprocessing = 0;
58 | };
59 | /* End PBXFrameworksBuildPhase section */
60 |
61 | /* Begin PBXGroup section */
62 | 91B363C51C57459700137B9C = {
63 | isa = PBXGroup;
64 | children = (
65 | 09B385671CC20D5900BB85ED /* CoreAudio.framework */,
66 | 09B385651CC20D5300BB85ED /* AVFoundation.framework */,
67 | 91B363F21C5747BD00137B9C /* RongCloudSDK */,
68 | 91B363D01C57459700137B9C /* RCTRongCloud */,
69 | 91B363CF1C57459700137B9C /* Products */,
70 | );
71 | sourceTree = "";
72 | };
73 | 91B363CF1C57459700137B9C /* Products */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 91B363CE1C57459700137B9C /* libRCTRongCloud.a */,
77 | );
78 | name = Products;
79 | sourceTree = "";
80 | };
81 | 91B363D01C57459700137B9C /* RCTRongCloud */ = {
82 | isa = PBXGroup;
83 | children = (
84 | 09B80B311CC8ED5500E37B9A /* RCTRongCloudVoiceManager.h */,
85 | 09B80B321CC8ED5500E37B9A /* RCTRongCloudVoiceManager.m */,
86 | 91B363D11C57459700137B9C /* RCTRongCloud.h */,
87 | 91B363D31C57459700137B9C /* RCTRongCloud.m */,
88 | 91EC70AE1C575424001FDC90 /* RCTConvert+RongCloud.h */,
89 | 91EC70AF1C575424001FDC90 /* RCTConvert+RongCloud.m */,
90 | );
91 | path = RCTRongCloud;
92 | sourceTree = "";
93 | };
94 | 91B363F21C5747BD00137B9C /* RongCloudSDK */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 91EC70AC1C5753A4001FDC90 /* libopencore-amrnb.a */,
98 | 91B363F31C5747BD00137B9C /* RongIMLib.framework */,
99 | );
100 | path = RongCloudSDK;
101 | sourceTree = "";
102 | };
103 | /* End PBXGroup section */
104 |
105 | /* Begin PBXNativeTarget section */
106 | 91B363CD1C57459700137B9C /* RCTRongCloud */ = {
107 | isa = PBXNativeTarget;
108 | buildConfigurationList = 91B363D71C57459700137B9C /* Build configuration list for PBXNativeTarget "RCTRongCloud" */;
109 | buildPhases = (
110 | 91B363CA1C57459700137B9C /* Sources */,
111 | 91B363CB1C57459700137B9C /* Frameworks */,
112 | 91B363CC1C57459700137B9C /* CopyFiles */,
113 | );
114 | buildRules = (
115 | );
116 | dependencies = (
117 | );
118 | name = RCTRongCloud;
119 | productName = RCTRongCloud;
120 | productReference = 91B363CE1C57459700137B9C /* libRCTRongCloud.a */;
121 | productType = "com.apple.product-type.library.static";
122 | };
123 | /* End PBXNativeTarget section */
124 |
125 | /* Begin PBXProject section */
126 | 91B363C61C57459700137B9C /* Project object */ = {
127 | isa = PBXProject;
128 | attributes = {
129 | LastUpgradeCheck = 0720;
130 | ORGANIZATIONNAME = erica;
131 | TargetAttributes = {
132 | 91B363CD1C57459700137B9C = {
133 | CreatedOnToolsVersion = 7.2;
134 | };
135 | };
136 | };
137 | buildConfigurationList = 91B363C91C57459700137B9C /* Build configuration list for PBXProject "RCTRongCloud" */;
138 | compatibilityVersion = "Xcode 3.2";
139 | developmentRegion = English;
140 | hasScannedForEncodings = 0;
141 | knownRegions = (
142 | en,
143 | );
144 | mainGroup = 91B363C51C57459700137B9C;
145 | productRefGroup = 91B363CF1C57459700137B9C /* Products */;
146 | projectDirPath = "";
147 | projectRoot = "";
148 | targets = (
149 | 91B363CD1C57459700137B9C /* RCTRongCloud */,
150 | );
151 | };
152 | /* End PBXProject section */
153 |
154 | /* Begin PBXSourcesBuildPhase section */
155 | 91B363CA1C57459700137B9C /* Sources */ = {
156 | isa = PBXSourcesBuildPhase;
157 | buildActionMask = 2147483647;
158 | files = (
159 | 91EC70B01C575424001FDC90 /* RCTConvert+RongCloud.m in Sources */,
160 | 91B363D41C57459700137B9C /* RCTRongCloud.m in Sources */,
161 | 09B80B331CC8ED5500E37B9A /* RCTRongCloudVoiceManager.m in Sources */,
162 | );
163 | runOnlyForDeploymentPostprocessing = 0;
164 | };
165 | /* End PBXSourcesBuildPhase section */
166 |
167 | /* Begin XCBuildConfiguration section */
168 | 91B363D51C57459700137B9C /* Debug */ = {
169 | isa = XCBuildConfiguration;
170 | buildSettings = {
171 | ALWAYS_SEARCH_USER_PATHS = NO;
172 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
173 | CLANG_CXX_LIBRARY = "libc++";
174 | CLANG_ENABLE_MODULES = YES;
175 | CLANG_ENABLE_OBJC_ARC = YES;
176 | CLANG_WARN_BOOL_CONVERSION = YES;
177 | CLANG_WARN_CONSTANT_CONVERSION = YES;
178 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
179 | CLANG_WARN_EMPTY_BODY = YES;
180 | CLANG_WARN_ENUM_CONVERSION = YES;
181 | CLANG_WARN_INT_CONVERSION = YES;
182 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
183 | CLANG_WARN_UNREACHABLE_CODE = YES;
184 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
185 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
186 | COPY_PHASE_STRIP = NO;
187 | DEBUG_INFORMATION_FORMAT = dwarf;
188 | ENABLE_STRICT_OBJC_MSGSEND = YES;
189 | ENABLE_TESTABILITY = YES;
190 | GCC_C_LANGUAGE_STANDARD = gnu99;
191 | GCC_DYNAMIC_NO_PIC = NO;
192 | GCC_NO_COMMON_BLOCKS = YES;
193 | GCC_OPTIMIZATION_LEVEL = 0;
194 | GCC_PREPROCESSOR_DEFINITIONS = (
195 | "DEBUG=1",
196 | "$(inherited)",
197 | );
198 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
199 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
200 | GCC_WARN_UNDECLARED_SELECTOR = YES;
201 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
202 | GCC_WARN_UNUSED_FUNCTION = YES;
203 | GCC_WARN_UNUSED_VARIABLE = YES;
204 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
205 | MTL_ENABLE_DEBUG_INFO = YES;
206 | ONLY_ACTIVE_ARCH = YES;
207 | SDKROOT = iphoneos;
208 | };
209 | name = Debug;
210 | };
211 | 91B363D61C57459700137B9C /* Release */ = {
212 | isa = XCBuildConfiguration;
213 | buildSettings = {
214 | ALWAYS_SEARCH_USER_PATHS = NO;
215 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
216 | CLANG_CXX_LIBRARY = "libc++";
217 | CLANG_ENABLE_MODULES = YES;
218 | CLANG_ENABLE_OBJC_ARC = YES;
219 | CLANG_WARN_BOOL_CONVERSION = YES;
220 | CLANG_WARN_CONSTANT_CONVERSION = YES;
221 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
222 | CLANG_WARN_EMPTY_BODY = YES;
223 | CLANG_WARN_ENUM_CONVERSION = YES;
224 | CLANG_WARN_INT_CONVERSION = YES;
225 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
226 | CLANG_WARN_UNREACHABLE_CODE = YES;
227 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
228 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
229 | COPY_PHASE_STRIP = NO;
230 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
231 | ENABLE_NS_ASSERTIONS = NO;
232 | ENABLE_STRICT_OBJC_MSGSEND = YES;
233 | GCC_C_LANGUAGE_STANDARD = gnu99;
234 | GCC_NO_COMMON_BLOCKS = YES;
235 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
236 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
237 | GCC_WARN_UNDECLARED_SELECTOR = YES;
238 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
239 | GCC_WARN_UNUSED_FUNCTION = YES;
240 | GCC_WARN_UNUSED_VARIABLE = YES;
241 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
242 | MTL_ENABLE_DEBUG_INFO = NO;
243 | SDKROOT = iphoneos;
244 | VALIDATE_PRODUCT = YES;
245 | };
246 | name = Release;
247 | };
248 | 91B363D81C57459700137B9C /* Debug */ = {
249 | isa = XCBuildConfiguration;
250 | buildSettings = {
251 | FRAMEWORK_SEARCH_PATHS = (
252 | "$(inherited)",
253 | "$(PROJECT_DIR)/RongCloudSDK",
254 | );
255 | HEADER_SEARCH_PATHS = (
256 | "$(SRCROOT)/../../react-native/React/**",
257 | "$(SRCROOT)/../../react-native/Libraries/**",
258 | );
259 | LIBRARY_SEARCH_PATHS = (
260 | "$(inherited)",
261 | "$(PROJECT_DIR)/RongCloudSDK",
262 | );
263 | OTHER_LDFLAGS = (
264 | "-ObjC",
265 | "-lstdc++",
266 | );
267 | PRODUCT_NAME = "$(TARGET_NAME)";
268 | SKIP_INSTALL = YES;
269 | };
270 | name = Debug;
271 | };
272 | 91B363D91C57459700137B9C /* Release */ = {
273 | isa = XCBuildConfiguration;
274 | buildSettings = {
275 | FRAMEWORK_SEARCH_PATHS = (
276 | "$(inherited)",
277 | "$(PROJECT_DIR)/RongCloudSDK",
278 | );
279 | HEADER_SEARCH_PATHS = (
280 | "$(SRCROOT)/../../react-native/React/**",
281 | "$(SRCROOT)/../../react-native/Libraries/**",
282 | );
283 | LIBRARY_SEARCH_PATHS = (
284 | "$(inherited)",
285 | "$(PROJECT_DIR)/RongCloudSDK",
286 | );
287 | OTHER_LDFLAGS = (
288 | "-ObjC",
289 | "-lstdc++",
290 | );
291 | PRODUCT_NAME = "$(TARGET_NAME)";
292 | SKIP_INSTALL = YES;
293 | };
294 | name = Release;
295 | };
296 | /* End XCBuildConfiguration section */
297 |
298 | /* Begin XCConfigurationList section */
299 | 91B363C91C57459700137B9C /* Build configuration list for PBXProject "RCTRongCloud" */ = {
300 | isa = XCConfigurationList;
301 | buildConfigurations = (
302 | 91B363D51C57459700137B9C /* Debug */,
303 | 91B363D61C57459700137B9C /* Release */,
304 | );
305 | defaultConfigurationIsVisible = 0;
306 | defaultConfigurationName = Release;
307 | };
308 | 91B363D71C57459700137B9C /* Build configuration list for PBXNativeTarget "RCTRongCloud" */ = {
309 | isa = XCConfigurationList;
310 | buildConfigurations = (
311 | 91B363D81C57459700137B9C /* Debug */,
312 | 91B363D91C57459700137B9C /* Release */,
313 | );
314 | defaultConfigurationIsVisible = 0;
315 | defaultConfigurationName = Release;
316 | };
317 | /* End XCConfigurationList section */
318 | };
319 | rootObject = 91B363C61C57459700137B9C /* Project object */;
320 | }
321 |
--------------------------------------------------------------------------------
/ios/RCTRongCloud/RCTConvert+RongCloud.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCTConvert+RongCloud.h
3 | // RCTRongCloud
4 | //
5 | // Created by LvBingru on 1/26/16.
6 | // Copyright © 2016 erica. All rights reserved.
7 | //
8 |
9 | #import "RCTConvert.h"
10 | #import
11 |
12 | @interface RCTConvert(RongCloud)
13 |
14 | + (RCMessageContent *)RCMessageContent:(id)json;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ios/RCTRongCloud/RCTConvert+RongCloud.m:
--------------------------------------------------------------------------------
1 | //
2 | // RCTCovert+RongCloud.m
3 | // RCTRongCloud
4 | //
5 | // Created by LvBingru on 1/26/16.
6 | // Copyright © 2016 erica. All rights reserved.
7 | //
8 |
9 | #import "RCTConvert+RongCloud.h"
10 |
11 | @implementation RCTConvert(RongCloud)
12 |
13 | + (RCMessageContent *)RCMessageContent:(id)json;
14 | {
15 | json = [self NSDictionary:json];
16 | NSString *type = [RCTConvert NSString:json[@"type"]];
17 |
18 | if ([@"text" isEqualToString:type]) {
19 | RCTextMessage* ret = [RCTextMessage messageWithContent:json[@"content"]];
20 | ret.extra = [RCTConvert NSString:json[@"extra"]];
21 | return ret;
22 | } else if ([@"voice" isEqualToString:type]) {
23 | NSString *base64 = [RCTConvert NSString:json[@"base64"]];
24 | NSData *voice = [[NSData alloc] initWithBase64EncodedString:base64 options:0];
25 | long long duration = [RCTConvert int64_t:json[@"duration"]];
26 |
27 | RCVoiceMessage *ret = [RCVoiceMessage messageWithAudio:voice duration:duration];
28 | ret.extra = [RCTConvert NSString:json[@"extra"]];
29 | return ret;
30 | } else if ([@"image" isEqualToString:type]) {
31 | NSString * uri = [RCTConvert NSString:json[@"imageUrl"]];
32 | RCImageMessage *ret = [RCImageMessage messageWithImageURI:uri];
33 | ret.full = [json[@"full"] boolValue];
34 | ret.extra = [RCTConvert NSString:json[@"extra"]];
35 | return ret;
36 | } else if ([@"notify" isEqualToString:type]) {
37 | NSString * name = [RCTConvert NSString:json[@"name"]];
38 | NSString * data =[RCTConvert NSString:json[@"data"]];
39 | RCCommandNotificationMessage* ret = [RCCommandNotificationMessage notificationWithName:name data:data];
40 | return ret;
41 | }
42 | else {
43 | RCTextMessage* ret = [RCTextMessage messageWithContent:@"[未知消息]"];
44 | return ret;
45 | }
46 | // RCUserInfo *userInfo = [[RCUserInfo alloc] initWithUserId:json[@"userId"] name:json[@"name"] portrait:json[@"portraitUri"]];
47 | // return userInfo;
48 | }
49 |
50 | RCT_ENUM_CONVERTER(RCConversationType, (@{
51 | @"private": @(ConversationType_PRIVATE),
52 | @"discussion": @(ConversationType_DISCUSSION),
53 | @"group": @(ConversationType_GROUP),
54 | @"chatroom": @(ConversationType_CHATROOM),
55 | @"customer_service": @(ConversationType_CUSTOMERSERVICE),
56 | @"system": @(ConversationType_SYSTEM),
57 | @"app_service": @(ConversationType_APPSERVICE),
58 | @"publish_service": @(ConversationType_PUBLICSERVICE),
59 | @"push_service": @(ConversationType_PUSHSERVICE)
60 | }), ConversationType_PRIVATE, unsignedIntegerValue)
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/ios/RCTRongCloud/RCTRongCloud.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCTRongCloud.h
3 | // RCTRongCloud
4 | //
5 | // Created by LvBingru on 1/26/16.
6 | // Copyright © 2016 erica. All rights reserved.
7 | //
8 |
9 | #import "RCTBridgeModule.h"
10 |
11 | @interface RCTRongCloud : NSObject
12 |
13 | + (void)registerAPI:(NSString *)aString;
14 | + (void)setDeviceToken:(NSData *)aToken;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ios/RCTRongCloud/RCTRongCloud.m:
--------------------------------------------------------------------------------
1 | //
2 | // RCTRongCloud.m
3 | // RCTRongCloud
4 | //
5 | // Created by LvBingru on 1/26/16.
6 | // Copyright © 2016 erica. All rights reserved.
7 | //
8 |
9 | #import "RCTRongCloud.h"
10 | #import
11 | #import "RCTConvert+RongCloud.h"
12 | #import "RCTUtils.h"
13 | #import "RCTEventDispatcher.h"
14 | #import "RCTRongCloudVoiceManager.h"
15 | #import "RCTImageLoader.h"
16 |
17 | #define OPERATION_FAILED (@"operation returns false.")
18 |
19 | @interface RCTRongCloud()
20 |
21 | @property (nonatomic, strong) NSMutableDictionary *userInfoDic;
22 | @property (nonatomic, strong) RCTRongCloudVoiceManager *voiceManager;
23 |
24 | @end
25 |
26 | @implementation RCTRongCloud
27 |
28 | RCT_EXPORT_MODULE(RCTRongIMLib);
29 |
30 | @synthesize bridge = _bridge;
31 |
32 | - (NSDictionary *)constantsToExport
33 | {
34 | return @{};
35 | };
36 |
37 | - (dispatch_queue_t)methodQueue
38 | {
39 | return dispatch_get_main_queue();
40 | }
41 |
42 | - (instancetype)init
43 | {
44 | self = [super init];
45 | if (self) {
46 | [[RCIMClient sharedRCIMClient] setReceiveMessageDelegate:self object:nil];
47 | [[RCIMClient sharedRCIMClient] setRCConnectionStatusChangeDelegate:self];
48 | _voiceManager = [RCTRongCloudVoiceManager new];
49 | }
50 | return self;
51 | }
52 |
53 | - (void)dealloc
54 | {
55 | RCIMClient* client = [RCIMClient sharedRCIMClient];
56 | [client disconnect];
57 | }
58 |
59 | + (void)registerAPI:(NSString *)aString
60 | {
61 | static dispatch_once_t onceToken;
62 | dispatch_once(&onceToken, ^{
63 | [[RCIMClient sharedRCIMClient] initWithAppKey:aString];
64 | });
65 | }
66 |
67 | + (void)setDeviceToken:(NSData *)aToken
68 | {
69 | NSString *token =
70 | [[[[aToken description] stringByReplacingOccurrencesOfString:@"<"
71 | withString:@""]
72 | stringByReplacingOccurrencesOfString:@">"
73 | withString:@""]
74 | stringByReplacingOccurrencesOfString:@" "
75 | withString:@""];
76 |
77 | [[RCIMClient sharedRCIMClient] setDeviceToken:token];
78 | }
79 |
80 | RCT_EXPORT_METHOD(connect:(NSString *)token resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
81 | {
82 | [[RCIMClient sharedRCIMClient] connectWithToken:token success:^(NSString *userId) {
83 | // Connect 成功
84 | resolve(userId);
85 | } error:^(RCConnectErrorCode status) {
86 | // Connect 失败
87 | reject([NSString stringWithFormat:@"%d", (int)status], @"Connection error", nil);
88 | }
89 | tokenIncorrect:^() {
90 | // Token 失效的状态处理
91 | reject(@"tokenIncorrect", @"Incorrect token provided.", nil);
92 | }];
93 | }
94 |
95 | // 断开与融云服务器的连接,并不再接收远程推送
96 | RCT_EXPORT_METHOD(logout:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
97 | {
98 | [[RCIMClient sharedRCIMClient] logout];
99 | resolve(nil);
100 | }
101 |
102 | // 断开与融云服务器的连接,但仍然接收远程推送
103 | RCT_EXPORT_METHOD(disconnect:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
104 | {
105 | [[RCIMClient sharedRCIMClient] disconnect];
106 | resolve(nil);
107 | }
108 |
109 | RCT_EXPORT_METHOD(getConversationList:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
110 | {
111 | NSArray *array = [[RCIMClient sharedRCIMClient] getConversationList:@[@(ConversationType_PRIVATE),
112 | @(ConversationType_DISCUSSION),
113 | @(ConversationType_GROUP),
114 | @(ConversationType_CHATROOM),
115 | @(ConversationType_CUSTOMERSERVICE),
116 | @(ConversationType_SYSTEM),
117 | @(ConversationType_APPSERVICE),
118 | @(ConversationType_PUBLICSERVICE),
119 | @(ConversationType_PUSHSERVICE)]];
120 | NSMutableArray *newArray = [NSMutableArray new];
121 | for (RCConversation *conv in array) {
122 | NSDictionary *convDic = [self.class _convertConversation:conv];
123 | [newArray addObject:convDic];
124 | }
125 | resolve(newArray);
126 | }
127 |
128 | RCT_EXPORT_METHOD(getLatestMessages: (RCConversationType) type targetId:(NSString*) targetId count:(int) count
129 | resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
130 | {
131 | NSArray* array = [[RCIMClient sharedRCIMClient] getLatestMessages:type targetId:targetId count:count];
132 |
133 | NSMutableArray* newArray = [NSMutableArray new];
134 | for (RCMessage* msg in array) {
135 | NSDictionary* convDic = [self.class _convertMessage:msg];
136 | [newArray addObject:convDic];
137 | }
138 | resolve(newArray);
139 | }
140 |
141 | RCT_EXPORT_METHOD(removeConversation: (RCConversationType) type targetId:(NSString*) targetId)
142 | {
143 | RCIMClient* client = [RCIMClient sharedRCIMClient];
144 | [client removeConversation: type targetId: targetId];
145 | }
146 |
147 | RCT_EXPORT_METHOD(sendMessage: (RCConversationType) type targetId:(NSString*) targetId content:(NSDictionary*) json
148 | pushContent: (NSString*) pushContent pushData:(NSString*) pushData
149 | resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
150 | {
151 | if ([[json valueForKey:@"type"] isEqualToString:@"image"]) {
152 | NSString * uri = [RCTConvert NSString:json[@"imageUrl"]];
153 | [self.bridge.imageLoader loadImageWithURLRequest:[RCTConvert NSURLRequest: uri] callback:^(NSError *error, UIImage *image) {
154 | dispatch_async([self methodQueue], ^(void) {
155 | if (error) {
156 | reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
157 | return;
158 | }
159 | RCImageMessage *content = [RCImageMessage messageWithImage:image];
160 | content.full = [json[@"full"] boolValue];
161 | content.extra = [RCTConvert NSString:json[@"extra"]];
162 | RCIMClient* client = [RCIMClient sharedRCIMClient];
163 | RCMessage* msg = [client sendImageMessage:type targetId:targetId content:content pushContent:pushContent
164 | progress:^(int progress, long messageId) {
165 |
166 | }
167 | success:^(long messageId){
168 | [_bridge.eventDispatcher sendAppEventWithName:@"msgSendOk" body:@(messageId)];
169 | } error:^(RCErrorCode code, long messageId){
170 | NSMutableDictionary* dic = [NSMutableDictionary new];
171 | dic[@"messageId"] = @(messageId);
172 | dic[@"errCode"] = @((int)code);
173 | [_bridge.eventDispatcher sendAppEventWithName:@"msgSendFailed" body:dic];
174 | }];
175 | resolve([self.class _convertMessage:msg]);
176 | });
177 | }];
178 |
179 | return;
180 | }
181 | RCMessageContent* content = [RCTConvert RCMessageContent:json];
182 | RCIMClient* client = [RCIMClient sharedRCIMClient];
183 | RCMessage* msg = [client sendMessage:type targetId:targetId content:content pushContent:pushContent
184 | success:^(long messageId){
185 | [_bridge.eventDispatcher sendAppEventWithName:@"msgSendOk" body:@(messageId)];
186 | } error:^(RCErrorCode code, long messageId){
187 | NSMutableDictionary* dic = [NSMutableDictionary new];
188 | dic[@"messageId"] = @(messageId);
189 | dic[@"errCode"] = @((int)code);
190 | [_bridge.eventDispatcher sendAppEventWithName:@"msgSendFailed" body:dic];
191 | }];
192 | resolve([self.class _convertMessage:msg]);
193 | }
194 |
195 | RCT_EXPORT_METHOD(insertMessage: (RCConversationType) type targetId:(NSString*) targetId senderId:(NSString*) senderId content:(NSDictionary*) json
196 | resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
197 | {
198 | RCMessageContent* content = [RCTConvert RCMessageContent:json];
199 | RCIMClient* client = [RCIMClient sharedRCIMClient];
200 | RCMessage* msg = [client insertMessage:type targetId:targetId senderUserId:senderId sendStatus:SentStatus_SENT content:content];
201 | resolve([self.class _convertMessage:msg]);
202 | }
203 |
204 | RCT_EXPORT_METHOD(clearMessageUnreadStatus: (RCConversationType) type targetId:(NSString*) targetId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
205 | {
206 | RCIMClient* client = [RCIMClient sharedRCIMClient];
207 | [client clearMessagesUnreadStatus:type targetId:targetId];
208 | resolve(nil);
209 | }
210 |
211 | RCT_EXPORT_METHOD(canRecordVoice:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
212 | {
213 | [_voiceManager canRecordVoice:^(NSError *error, NSDictionary *result) {
214 | if (error) {
215 | reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
216 | }
217 | else {
218 | resolve(result);
219 | }
220 | }];
221 | }
222 |
223 | RCT_EXPORT_METHOD(startRecordVoice:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
224 | {
225 | [_voiceManager startRecord:^(NSError *error,NSDictionary *result) {
226 | if (error) {
227 | reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
228 | }
229 | else {
230 | resolve(result);
231 | }
232 | }];
233 | }
234 |
235 | RCT_EXPORT_METHOD(cancelRecordVoice)
236 | {
237 | [_voiceManager cancelRecord];
238 | }
239 |
240 | RCT_EXPORT_METHOD(finishRecordVoice)
241 | {
242 | [_voiceManager finishRecord];
243 | }
244 |
245 | RCT_EXPORT_METHOD(startPlayVoice:(RCMessageContent *)voice resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
246 | {
247 | [_voiceManager startPlayVoice:(RCVoiceMessage *)voice result:^(NSError *error, NSDictionary *result) {
248 | if (error) {
249 | reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
250 | }
251 | else {
252 | resolve(result);
253 | }
254 | }];
255 | }
256 |
257 | RCT_EXPORT_METHOD(stopPlayVoice)
258 | {
259 | [_voiceManager stopPlayVoice];
260 | }
261 |
262 | RCT_EXPORT_METHOD(getConversationNotificationStatus:(RCConversationType) type targetId:(NSString*) targetId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
263 | {
264 | RCIMClient* client = [RCIMClient sharedRCIMClient];
265 | [client getConversationNotificationStatus:type targetId:targetId success:^(RCConversationNotificationStatus nStatus) {
266 | switch (nStatus) {
267 | case DO_NOT_DISTURB:
268 | resolve(@(YES));
269 | default:
270 | resolve(@(NO));
271 | }
272 | } error:^(RCErrorCode status) {
273 | reject([NSString stringWithFormat:@"%ld", status], @"Failed", nil);
274 | }];
275 | }
276 |
277 | RCT_EXPORT_METHOD(setConversationNotificationStatus:(RCConversationType) type targetId:(NSString*) targetId isBlocked:(BOOL)isBlocked resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
278 | {
279 | RCIMClient* client = [RCIMClient sharedRCIMClient];
280 | [client setConversationNotificationStatus:type targetId:targetId isBlocked:isBlocked success:^(RCConversationNotificationStatus nStatus) {
281 | resolve(nil);
282 | } error:^(RCErrorCode status) {
283 | reject([NSString stringWithFormat:@"%ld", status], @"Failed", nil);
284 | }];
285 | }
286 |
287 | RCT_EXPORT_METHOD(clearMessages:(RCConversationType) type targetId:(NSString*) targetId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
288 | {
289 | RCIMClient* client = [RCIMClient sharedRCIMClient];
290 | [client clearMessages:type targetId:targetId];
291 | resolve(nil);
292 | }
293 |
294 | #pragma mark - delegate
295 | - (void)onReceived:(RCMessage *)message
296 | left:(int)nLeft
297 | object:(id)object
298 | {
299 | [_bridge.eventDispatcher sendAppEventWithName:@"rongIMMsgRecved" body:[self.class _convertMessage:message]];
300 | }
301 |
302 | - (void)onConnectionStatusChanged:(RCConnectionStatus)status
303 | {
304 | NSMutableDictionary* dict = [NSMutableDictionary dictionary];
305 | switch (status){
306 | case ConnectionStatus_UNKNOWN:
307 | [dict setObject:@(-2) forKey:@"code"];
308 | [dict setObject:@"Unknown" forKey:@"message"];
309 | break;
310 | case ConnectionStatus_NETWORK_UNAVAILABLE:
311 | [dict setObject:@(-1) forKey:@"code"];
312 | [dict setObject:@"Network is unavailable." forKey:@"message"];
313 | break;
314 | case ConnectionStatus_Connected:
315 | [dict setObject:@(0) forKey:@"code"];
316 | [dict setObject:@"Connect Success." forKey:@"message"];
317 | break;
318 | case ConnectionStatus_Connecting:
319 | [dict setObject:@(1) forKey:@"code"];
320 | [dict setObject:@"Connecting" forKey:@"message"];
321 | break;
322 | case ConnectionStatus_Unconnected:
323 | case ConnectionStatus_SignUp:
324 | [dict setObject:@(2) forKey:@"code"];
325 | [dict setObject:@"Disconnected" forKey:@"message"];
326 | break;
327 | case ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT:
328 | [dict setObject:@(3) forKey:@"code"];
329 | [dict setObject:@"Login on the other device, and be kicked offline." forKey:@"message"];
330 | break;
331 | case ConnectionStatus_TOKEN_INCORRECT:
332 | [dict setObject:@(4) forKey:@"code"];
333 | [dict setObject:@"Token incorrect." forKey:@"message"];
334 | break;
335 | case ConnectionStatus_SERVER_INVALID:
336 | [dict setObject:@(5) forKey:@"code"];
337 | [dict setObject:@"Server invalid." forKey:@"message"];
338 | break;
339 | case ConnectionStatus_Cellular_2G:
340 | case ConnectionStatus_Cellular_3G_4G:
341 | case ConnectionStatus_WIFI:
342 | case ConnectionStatus_LOGIN_ON_WEB:
343 | case ConnectionStatus_VALIDATE_INVALID:
344 | case ConnectionStatus_DISCONN_EXCEPTION:
345 | default:
346 | //ignore
347 | return;
348 | }
349 | [_bridge.eventDispatcher sendAppEventWithName:@"rongIMConnectionStatus" body:[dict copy]];
350 | }
351 |
352 | #pragma mark - private
353 |
354 | + (NSDictionary *)_convertConversation:(RCConversation *)conversation
355 | {
356 | NSMutableDictionary *dic = [NSMutableDictionary new];
357 | dic[@"title"] = conversation.conversationTitle;
358 | dic[@"type"] = [self _convertConversationType: conversation.conversationType];
359 | dic[@"targetId"] = conversation.targetId;
360 | dic[@"unreadCount"] = @(conversation.unreadMessageCount);
361 | dic[@"lastMessage"] = [self _converMessageContent:conversation.lastestMessage];
362 |
363 | dic[@"isTop"] = @(conversation.isTop);
364 | dic[@"receivedStatus"] = @(conversation.receivedStatus);
365 | dic[@"sentStatus"] = @(conversation.sentStatus);
366 | dic[@"receivedTime"] = @(conversation.receivedTime);
367 | dic[@"sentTime"] = @(conversation.sentTime);
368 | dic[@"draft"] = conversation.draft;
369 | dic[@"objectName"] = conversation.objectName;
370 | dic[@"senderUserId"] = conversation.senderUserId;
371 |
372 | dic[@"conversationTitle"] = conversation.conversationTitle;
373 |
374 | dic[@"jsonDict"] = conversation.jsonDict;
375 | dic[@"lastestMessageId"] = @(conversation.lastestMessageId);
376 | return dic;
377 | }
378 |
379 | + (NSString *) _convertConversationType: (RCConversationType) type
380 | {
381 | switch(type) {
382 | case ConversationType_PRIVATE: return @"private";
383 | case ConversationType_DISCUSSION: return @"discussion";
384 | case ConversationType_GROUP: return @"group";
385 | case ConversationType_CHATROOM: return @"chatroom";
386 | case ConversationType_CUSTOMERSERVICE: return @"customer_service";
387 | case ConversationType_SYSTEM: return @"system";
388 | case ConversationType_APPSERVICE: return @"app_service";
389 | case ConversationType_PUBLICSERVICE: return @"public_service";
390 | case ConversationType_PUSHSERVICE: return @"push_service";
391 | default: return @"unknown";
392 | }
393 | }
394 |
395 | + (NSDictionary *)_convertMessage:(RCMessage *)message
396 | {
397 | NSMutableDictionary *dic = [NSMutableDictionary new];
398 | dic[@"senderId"] = message.senderUserId;
399 | dic[@"targetId"] = message.targetId;
400 | dic[@"conversationType"] = [self _convertConversationType: message.conversationType];;
401 | dic[@"extra"] = message.extra;
402 | dic[@"messageId"] = @(message.messageId);
403 | dic[@"receivedTime"] = @(message.receivedTime);
404 | dic[@"sentTime"] = @(message.sentTime);
405 | dic[@"content"] = [self _converMessageContent:message.content];
406 |
407 | dic[@"messageDirection"] = @(message.messageDirection);
408 | dic[@"receivedStatus"] = @(message.receivedStatus);
409 | dic[@"sentStatus"] = @(message.sentStatus);
410 | dic[@"objectName"] = message.objectName;
411 | dic[@"messageUId"] = message.messageUId;
412 | return dic;
413 | }
414 |
415 | + (NSDictionary *)_converMessageContent:(RCMessageContent *)messageContent
416 | {
417 | NSMutableDictionary *dic = [NSMutableDictionary new];
418 | if ([messageContent isKindOfClass:[RCTextMessage class]]) {
419 | RCTextMessage *message = (RCTextMessage *)messageContent;
420 | dic[@"type"] = @"text";
421 | dic[@"content"] = message.content;
422 | dic[@"extra"] = message.extra;
423 | }
424 | else if ([messageContent isKindOfClass:[RCVoiceMessage class]]) {
425 | RCVoiceMessage *message = (RCVoiceMessage *)messageContent;
426 | dic[@"type"] = @"voice";
427 | dic[@"duration"] = @(message.duration);
428 | dic[@"extra"] = message.extra;
429 | if (message.wavAudioData) {
430 | dic[@"base64"] = [message.wavAudioData base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
431 | }
432 | }
433 | else if ([messageContent isKindOfClass:[RCImageMessage class]]) {
434 | RCImageMessage *message = (RCImageMessage*)messageContent;
435 | dic[@"type"] = @"image";
436 | if ([[message.imageUrl substringToIndex:1] isEqualToString:@"/"]) {
437 | dic[@"imageUrl"] = [NSString stringWithFormat: @"file://%@", message.imageUrl];
438 | } else {
439 | dic[@"imageUrl"] = message.imageUrl;
440 | }
441 | dic[@"thumb"] = [NSString stringWithFormat:@"data:image/png;base64,%@", [UIImagePNGRepresentation(message.thumbnailImage) base64EncodedStringWithOptions:0]];
442 | dic[@"extra"] = message.extra;
443 | }
444 | else if ([messageContent isKindOfClass:[RCCommandNotificationMessage class]]){
445 | RCCommandNotificationMessage * message = (RCCommandNotificationMessage*)messageContent;
446 | dic[@"type"] = @"notify";
447 | dic[@"name"] = message.name;
448 | dic[@"data"] = message.data;
449 | }
450 | else {
451 | dic[@"type"] = @"unknown";
452 | }
453 | return dic;
454 | }
455 |
456 |
457 | @end
458 |
--------------------------------------------------------------------------------
/ios/RCTRongCloud/RCTRongCloudVoiceManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCTRongCloudVoiceManager.h
3 | // RCTRongCloud
4 | //
5 | // Created by LvBingru on 4/18/16.
6 | // Copyright © 2016 erica. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class RCVoiceMessage;
12 |
13 | typedef void (^RCVoiceResultBlock)(NSError *error, NSDictionary *result);
14 |
15 | @interface RCTRongCloudVoiceManager : NSObject
16 |
17 | - (void)canRecordVoice:(RCVoiceResultBlock)result;
18 | - (void)startRecord:(RCVoiceResultBlock)result;
19 | - (void)cancelRecord;
20 | - (void)finishRecord;
21 | - (void)startPlayVoice:(RCVoiceMessage *)voice result:(RCVoiceResultBlock)result;
22 | - (void)stopPlayVoice;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/ios/RCTRongCloud/RCTRongCloudVoiceManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // RCTRongCloudVoiceManager.m
3 | // RCTRongCloud
4 | //
5 | // Created by LvBingru on 4/18/16.
6 | // Copyright © 2016 erica. All rights reserved.
7 | //
8 |
9 | #import "RCTRongCloudVoiceManager.h"
10 | #import
11 | #import
12 | #import
13 | #import
14 |
15 | @interface RCTRongCloudVoiceManager ()
16 |
17 | @property (nonatomic, strong) AVAudioRecorder *recorder;
18 | @property (nonatomic, strong) AVAudioPlayer *player;
19 | @property (nonatomic, strong) NSString *recordWavFilePath;
20 | @property (nonatomic, assign) NSTimeInterval duration;
21 |
22 | @property (nonatomic, copy) RCVoiceResultBlock finishRecordBlock;
23 | @property (nonatomic, copy) RCVoiceResultBlock finishPlayBlock;
24 |
25 | @end
26 |
27 |
28 | @implementation RCTRongCloudVoiceManager
29 |
30 | //- (instancetype)init
31 | //{
32 | // self = [super init];
33 | // if (self) {
34 | // }
35 | //
36 | // return self;
37 | //}
38 |
39 | - (void)dealloc
40 | {
41 | [self.player setDelegate:nil];
42 | [self.recorder setDelegate:nil];
43 |
44 | if (self.player && self.player.isPlaying)
45 | {
46 | [self.player stop];
47 | }
48 |
49 | if (self.recorder && self.recorder.isRecording)
50 | {
51 | [self.recorder stop];
52 | }
53 | }
54 |
55 | - (void)canRecordVoice:(RCVoiceResultBlock)result
56 | {
57 | [[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
58 | if (granted) {
59 | result(nil, nil);
60 | }
61 | else {
62 | result([self _errorWithMessage:@"record not granted"], nil);
63 | }
64 | }];
65 | }
66 |
67 | - (void)startRecord:(RCVoiceResultBlock)result;
68 | {
69 | [self cancelRecord];
70 |
71 | NSError *error = nil;
72 | // 初始化
73 | if (self.recorder == nil)
74 | {
75 | error = [self _prepareRecorder];
76 | if (error) {
77 | result(error, nil);
78 | return;
79 | }
80 | }
81 | [self.recorder setDelegate:self];
82 |
83 | // 设置环境
84 | error = [[self class] activeAudioSessionWithCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker];
85 | if (error) {
86 | result(error, nil);
87 | return;
88 | }
89 |
90 | // 准备录音
91 | BOOL success = [self.recorder prepareToRecord];
92 | if (!success) {
93 | result([self _errorWithMessage:@"recorder prepareToRecord failed"], nil);
94 | return;
95 | }
96 |
97 | // 开始录音
98 | success = [self.recorder record];
99 | if (!success) {
100 | result([self _errorWithMessage:@"record failed"], nil);
101 | return;
102 | }
103 |
104 | [self setFinishRecordBlock:result];
105 | }
106 |
107 | - (void)startPlayVoice:(RCVoiceMessage *)voice result:(RCVoiceResultBlock)result
108 | {
109 | [self cancelPlay];
110 |
111 | // 初始化
112 | NSError *error = [self _preparePlayer:voice];
113 | if (error) {
114 | result(error, nil);
115 | return;
116 | }
117 |
118 | if (self.player == nil)
119 | {
120 | result([self _errorWithMessage:@"player null"], nil);
121 | return;
122 | }
123 |
124 | [self.player setDelegate:self];
125 |
126 | // 配置环境
127 | error = [[self class] activeAudioSessionWithCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker];
128 | if (error) {
129 | result(error, nil);
130 | return;
131 | }
132 |
133 | // 准备播放
134 | BOOL success = [self.player prepareToPlay];
135 | if (!success) {
136 | result([self _errorWithMessage:@"player prepareToPlay failed"], nil);
137 | return;
138 | }
139 |
140 | // 开始播放
141 | success = [self.player play];
142 | if (!success) {
143 | result([self _errorWithMessage:@"play failed"], nil);
144 | return;
145 | }
146 |
147 | [self setFinishPlayBlock:result];
148 |
149 | }
150 |
151 |
152 | - (void)cancelRecord
153 | {
154 | if (self.finishRecordBlock) {
155 | [self.recorder setDelegate:nil];
156 |
157 | [self.recorder stop];
158 | self.finishRecordBlock([self _errorWithMessage:@"recorder cancelled"], nil);
159 | [self setFinishRecordBlock:nil];
160 | [[self class] deactiveAudioSession];
161 | }
162 | }
163 |
164 | - (void)finishRecord
165 | {
166 | if (!self.recorder.recording) {
167 | [self cancelRecord];
168 | }
169 | else {
170 | [self setDuration:self.recorder.currentTime];
171 | [self.recorder stop];
172 | }
173 | }
174 |
175 | - (void)cancelPlay
176 | {
177 | if (self.finishPlayBlock) {
178 | [self.recorder setDelegate:nil];
179 | [self.recorder stop];
180 |
181 | self.finishPlayBlock([self _errorWithMessage:@"play cancelled"], nil);
182 | [self setFinishPlayBlock:nil];
183 | [[self class] deactiveAudioSession];
184 | }
185 | }
186 |
187 | - (void)stopPlayVoice
188 | {
189 | if (!self.player.isPlaying) {
190 | [self cancelPlay];
191 | }
192 | else {
193 | [self.player stop];
194 | }
195 | }
196 |
197 | #pragma mark - private
198 |
199 | - (NSError *)_prepareRecorder
200 | {
201 | //初始化录音
202 | NSDictionary *settings = @{AVFormatIDKey: @(kAudioFormatLinearPCM),
203 | AVSampleRateKey: @8000.00f,
204 | AVNumberOfChannelsKey: @1,
205 | AVLinearPCMBitDepthKey: @16,
206 | AVLinearPCMIsNonInterleaved: @NO,
207 | AVLinearPCMIsFloatKey: @NO,
208 | AVLinearPCMIsBigEndianKey: @NO};
209 |
210 | NSString *tempPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
211 |
212 | NSString *savePath = [tempPath stringByAppendingPathComponent:[NSString stringWithFormat:@"tempRecorderVoice%lld", (long long)([[NSDate date] timeIntervalSince1970]*1000)]];
213 | [self setRecordWavFilePath:savePath];
214 |
215 | NSURL *outputFileURL = [NSURL fileURLWithPath:self.recordWavFilePath];
216 |
217 | NSError *error;
218 | AVAudioRecorder *recoder = [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:settings error:&error];
219 | if (error)
220 | {
221 | return error;
222 | }
223 |
224 | [self setRecorder:recoder];
225 | return nil;
226 | }
227 |
228 | - (NSError *)_preparePlayer:(RCVoiceMessage *)voice
229 | {
230 | NSError *error = nil;
231 | AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithData:voice.wavAudioData error:&error];
232 |
233 | if (error)
234 | {
235 | [self setPlayer:nil];
236 | return error;
237 | }
238 | [self setPlayer:player];
239 |
240 | return nil;
241 | }
242 |
243 | - (NSError *)_errorWithMessage:(NSString *)errorMessage
244 | {
245 | return [NSError errorWithDomain:@"cn.reactnative.rongcloud"
246 | code:-1
247 | userInfo:@{ NSLocalizedDescriptionKey: errorMessage}];
248 | }
249 |
250 |
251 | #pragma mark - Recorder Delegate
252 | - (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)avrecorder successfully:(BOOL)flag
253 | {
254 | if (self.finishRecordBlock) {
255 | if (flag == YES)
256 | {
257 | NSData *data = [NSData dataWithContentsOfFile:self.recordWavFilePath];
258 | NSString *base64 = [data base64EncodedStringWithOptions:0];
259 | NSDictionary *body = @{
260 | @"base64":base64,
261 | @"type":@"voice",
262 | @"duration":@(self.duration * 1000)
263 | };
264 |
265 | self.finishRecordBlock(nil,body);
266 | [self setFinishRecordBlock:nil];
267 | }
268 | else
269 | {
270 | self.finishRecordBlock([self _errorWithMessage:@"record failed"], nil);
271 | [self setFinishRecordBlock:nil];
272 | }
273 | }
274 | [[self class] deactiveAudioSession];
275 | }
276 |
277 | - (void)audioRecorderEncodeErrorDidOccur:(AVAudioRecorder *)recorder error:(NSError *)error
278 | {
279 | if (self.finishRecordBlock) {
280 | self.finishRecordBlock([self _errorWithMessage:@"record failed"], nil);
281 | [self setFinishRecordBlock:nil];
282 | }
283 | [[self class] deactiveAudioSession];
284 | }
285 |
286 | #pragma mark - Player Delegate
287 |
288 | - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
289 | {
290 | if (self.finishPlayBlock) {
291 | if (flag == YES)
292 | {
293 | self.finishPlayBlock(nil, nil);
294 | [self setFinishPlayBlock:nil];
295 | }
296 | else
297 | {
298 | self.finishPlayBlock([self _errorWithMessage:@"play failed"], nil);
299 | [self setFinishPlayBlock:nil];
300 | }
301 | }
302 | [[self class] deactiveAudioSession];
303 | }
304 |
305 | - (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error
306 | {
307 | if (self.finishPlayBlock) {
308 | self.finishPlayBlock([self _errorWithMessage:@"play failed"], nil);
309 | [self setFinishPlayBlock:nil];
310 | }
311 | [[self class] deactiveAudioSession];
312 | }
313 |
314 | #pragma mark - context
315 |
316 | + (NSError *)activeAudioSession
317 | {
318 | NSError *error = nil;
319 | AVAudioSession *audioSession = [AVAudioSession sharedInstance];
320 |
321 | [audioSession setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&error];
322 |
323 | return error;
324 | }
325 |
326 | + (NSError *)deactiveAudioSession
327 | {
328 | NSError *error = nil;
329 | AVAudioSession *audioSession = [AVAudioSession sharedInstance];
330 | [audioSession setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&error];
331 | return error;
332 | }
333 |
334 | + (NSError *)activeAudioSessionWithCategory:(NSString*)category withOptions:(AVAudioSessionCategoryOptions)options
335 | {
336 | NSError *error = nil;
337 | AVAudioSession *audioSession = [AVAudioSession sharedInstance];
338 |
339 | if(!options)
340 | {
341 | [audioSession setCategory:category error:&error];
342 | }
343 | else
344 | {
345 | [audioSession setCategory:category withOptions:options error:&error];
346 | }
347 |
348 | if(!error)
349 | {
350 | [audioSession setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&error];
351 | }
352 | return error;
353 | }
354 |
355 | + (NSError *)deactiveAudioSessionWithCategory:(NSString*)category
356 | {
357 | NSError *error = nil;
358 | AVAudioSession *audioSession = [AVAudioSession sharedInstance];
359 | BOOL ret = [audioSession setCategory:category error:&error];
360 |
361 | if(ret)
362 | {
363 | [audioSession setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&error];
364 | }
365 | return error;
366 | }
367 |
368 |
369 | @end
370 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCAMRDataConverter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCAmrDataConverter.h
11 | // Created by Heq.Shinoda on 14-6-17.
12 |
13 | #ifndef __RCAmrDataConverter
14 | #define __RCAmrDataConverter
15 |
16 | #include "interf_dec.h"
17 | #include "interf_enc.h"
18 | #import
19 | #include
20 | #include
21 | #include
22 |
23 | /*!
24 | AMR格式与WAV格式音频转换工具类
25 | */
26 | @interface RCAMRDataConverter : NSObject
27 |
28 | /*!
29 | 获取AMR格式与WAV格式音频转换工具类单例
30 |
31 | @return AMR格式与WAV格式音频转换工具类单例
32 | */
33 | + (RCAMRDataConverter *)sharedAMRDataConverter;
34 |
35 | /*!
36 | 将AMR格式的音频数据转化为WAV格式的音频数据
37 |
38 | @param data AMR格式的音频数据,必须是AMR-NB的格式
39 | @return WAV格式的音频数据
40 | */
41 | - (NSData *)decodeAMRToWAVE:(NSData *)data;
42 |
43 | /*!
44 | 将WAV格式的音频数据转化为AMR格式的音频数据(8KHz采样)
45 |
46 | @param data WAV格式的音频数据
47 | @param nChannels 声道数
48 | @param nBitsPerSample 采样位数(精度)
49 | @return AMR-NB格式的音频数据
50 |
51 | @discussion
52 | 此方法为工具类方法,您可以使用此方法将任意WAV音频转换为AMR-NB格式的音频。
53 |
54 | @warning
55 | 如果您想和SDK自带的语音消息保持一致和互通,考虑到跨平台和传输的原因,SDK对于WAV音频有所限制.
56 | 具体可以参考RCVoiceMessage中的音频参数说明(nChannels为1,nBitsPerSample为16)。
57 | */
58 | - (NSData *)encodeWAVEToAMR:(NSData *)data
59 | channel:(int)nChannels
60 | nBitsPerSample:(int)nBitsPerSample;
61 | @end
62 |
63 | #endif
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCChatRoomInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCChatRoomInfo.h
3 | // RongIMLib
4 | //
5 | // Created by 岑裕 on 16/1/11.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCStatusDefine.h"
10 | #import
11 |
12 | /*!
13 | 聊天室信息类
14 | */
15 | @interface RCChatRoomInfo : NSObject
16 |
17 | /*!
18 | 聊天室ID
19 | */
20 | @property(nonatomic, strong) NSString *targetId;
21 |
22 | /*!
23 | 包含的成员信息类型
24 | */
25 | @property(nonatomic, assign) RCChatRoomMemberOrder memberOrder;
26 |
27 | /*!
28 | 聊天室中的部分成员信息RCChatRoomMemberInfo列表
29 |
30 | @discussion
31 | 如果成员类型为RC_ChatRoom_Member_Asc,则为最早加入的成员列表,按成员加入时间升序排列;
32 | 如果成员类型为RC_ChatRoom_Member_Desc,则为最晚加入的成员列表,按成员加入时间升序排列。
33 | */
34 | @property(nonatomic, strong) NSArray *memberInfoArray;
35 |
36 | /*!
37 | 当前聊天室的成员总数
38 | */
39 | @property(nonatomic, assign) int totalMemberCount;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCChatRoomMemberInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCChatRoomMemberInfo.h
3 | // RongIMLib
4 | //
5 | // Created by 岑裕 on 16/1/10.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*!
12 | 聊天室成员信息类
13 | */
14 | @interface RCChatRoomMemberInfo : NSObject
15 |
16 | /*!
17 | 用户ID
18 | */
19 | @property(nonatomic, strong) NSString *userId;
20 |
21 | /*!
22 | 加入时间(Unix时间戳,毫秒)
23 | */
24 | @property(nonatomic, assign) long long joinTime;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCCommandMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCCommandMessage.h
3 | // RongIMLib
4 | //
5 | // Created by 张改红 on 15/12/2.
6 | // Copyright © 2015年 RongCloud. All rights reserved.
7 | //
8 | #import "RCMessageContent.h"
9 |
10 | /*!
11 | 命令消息的类型名
12 | */
13 | #define RCCommandMessageIdentifier @"RC:CmdMsg"
14 |
15 | /*!
16 | 命令消息类
17 |
18 | @discussion 命令消息类,此消息不存储不计入未读消息数。
19 | 与RCCommandNotificationMessage的区别是,此消息不存储,也不会在界面上显示。
20 | */
21 | @interface RCCommandMessage : RCMessageContent
22 |
23 | /*!
24 | 命令的名称
25 | */
26 | @property(nonatomic, strong) NSString *name;
27 |
28 | /*!
29 | 命令的扩展数据
30 |
31 | @discussion 命令的扩展数据,可以为任意字符串,如存放您定义的json数据。
32 | */
33 | @property(nonatomic, strong) NSString *data;
34 |
35 | /*!
36 | 初始化命令消息
37 |
38 | @param name 命令的名称
39 | @param data 命令的扩展数据
40 | @return 命令消息对象
41 | */
42 | + (instancetype)messageWithName:(NSString *)name data:(NSString *)data;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCCommandNotificationMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCCommandNotificationMessage.h
11 | // Created by xugang on 14/11/28.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 命令提醒消息的类型名
17 | */
18 | #define RCCommandNotificationMessageIdentifier @"RC:CmdNtf"
19 |
20 | /*!
21 | 命令提醒消息类
22 |
23 | @discussion 命令消息类,此消息会进行存储,但不计入未读消息数。
24 | 与RCCommandMessage的区别是,此消息会进行存储并在界面上显示。
25 | */
26 | @interface RCCommandNotificationMessage : RCMessageContent
27 |
28 | /*!
29 | 命令提醒的名称
30 | */
31 | @property(nonatomic, strong) NSString *name;
32 |
33 | /*!
34 | 命令提醒消息的扩展数据
35 |
36 | @discussion 命令提醒消息的扩展数据,可以为任意字符串,如存放您定义的json数据。
37 | */
38 | @property(nonatomic, strong) NSString *data;
39 |
40 | /*!
41 | 初始化命令提醒消息
42 |
43 | @param name 命令的名称
44 | @param data 命令的扩展数据
45 | @return 命令提醒消息对象
46 | */
47 | + (instancetype)notificationWithName:(NSString *)name data:(NSString *)data;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCContactNotificationMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCContactNotificationMessage.h
11 | // Created by xugang on 14/11/28.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 好友请求消息的类型名
17 | */
18 | #define RCContactNotificationMessageIdentifier @"RC:ContactNtf"
19 |
20 | /*!
21 | 请求添加好友
22 | */
23 | #define ContactNotificationMessage_ContactOperationRequest @"Request"
24 | /*!
25 | 同意添加好友的请求
26 | */
27 | #define ContactNotificationMessage_ContactOperationAcceptResponse \
28 | @"AcceptResponse"
29 | /*!
30 | 拒绝添加好友的请求
31 | */
32 | #define ContactNotificationMessage_ContactOperationRejectResponse \
33 | @"RejectResponse"
34 |
35 | /*!
36 | 好友请求消息类
37 |
38 | @discussion 好友请求消息类,此消息会进行存储,但不计入未读消息数。
39 | */
40 | @interface RCContactNotificationMessage : RCMessageContent
41 |
42 | /*!
43 | 好友请求的当前操作名
44 |
45 | @discussion
46 | 好友请求当前的操作名称,您可以使用预定义好的操作名,也可以是您自己定义的任何操作名。
47 | 预定义的操作名:ContactNotificationMessage_ContactOperationRequest、ContactNotificationMessage_ContactOperationAcceptResponse、ContactNotificationMessage_ContactOperationRejectResponse。
48 | */
49 | @property(nonatomic, strong) NSString *operation;
50 |
51 | /*!
52 | 当前操作发起用户的用户ID
53 | */
54 | @property(nonatomic, strong) NSString *sourceUserId;
55 |
56 | /*!
57 | 当前操作目标用户的用户ID
58 | */
59 | @property(nonatomic, strong) NSString *targetUserId;
60 |
61 | /*!
62 | 当前操作的消息内容
63 |
64 | @discussion 当前操作的消息内容,如同意、拒绝的理由等。
65 | */
66 | @property(nonatomic, strong) NSString *message;
67 |
68 | /*!
69 | 当前操作的附加信息
70 | */
71 | @property(nonatomic, strong) NSString *extra;
72 |
73 | /*!
74 | 初始化好友请求消息
75 |
76 | @param operation 好友请求当前的操作名
77 | @param sourceUserId 当前操作发起用户的用户ID
78 | @param targetUserId 当前操作目标用户的用户ID
79 | @param message 当前操作的消息内容
80 | @param extra 当前操作的附加信息
81 | @return 好友请求消息对象
82 |
83 | @discussion 融云不介入您的好友关系,所有的好友关系都由您的服务器自己维护。
84 | 所以好友请求的操作名和消息内容、扩展信息您均可以自己定制,只要您发送方和接收方针对具体字段内容做好UI显示即可。
85 | */
86 | + (instancetype)notificationWithOperation:(NSString *)operation
87 | sourceUserId:(NSString *)sourceUserId
88 | targetUserId:(NSString *)targetUserId
89 | message:(NSString *)message
90 | extra:(NSString *)extra;
91 |
92 | @end
93 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCConversation.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCConversation.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #import "RCMessageContent.h"
14 | #import
15 |
16 | /*!
17 | 会话类
18 |
19 | @discussion 会话类,包含会话的所有属性。
20 | */
21 | @interface RCConversation : NSObject
22 |
23 | /*!
24 | 会话类型
25 | */
26 | @property(nonatomic, assign) RCConversationType conversationType;
27 |
28 | /*!
29 | 目标会话ID
30 | */
31 | @property(nonatomic, strong) NSString *targetId;
32 |
33 | /*!
34 | 会话的标题
35 | */
36 | @property(nonatomic, strong) NSString *conversationTitle;
37 |
38 | /*!
39 | 会话中的未读消息数量
40 | */
41 | @property(nonatomic, assign) int unreadMessageCount;
42 |
43 | /*!
44 | 是否置顶,默认值为NO
45 |
46 | @discussion
47 | 如果设置了置顶,在IMKit的RCConversationListViewController中会将此会话置顶显示。
48 | */
49 | @property(nonatomic, assign) BOOL isTop;
50 |
51 | /*!
52 | 会话中最后一条消息的接收状态
53 | */
54 | @property(nonatomic, assign) RCReceivedStatus receivedStatus;
55 |
56 | /*!
57 | 会话中最后一条消息的发送状态
58 | */
59 | @property(nonatomic, assign) RCSentStatus sentStatus;
60 |
61 | /*!
62 | 会话中最后一条消息的接收时间(Unix时间戳、毫秒)
63 | */
64 | @property(nonatomic, assign) long long receivedTime;
65 |
66 | /*!
67 | 会话中最后一条消息的发送时间(Unix时间戳、毫秒)
68 | */
69 | @property(nonatomic, assign) long long sentTime;
70 |
71 | /*!
72 | 会话中存在的草稿
73 | */
74 | @property(nonatomic, strong) NSString *draft;
75 |
76 | /*!
77 | 会话中最后一条消息的类型名
78 | */
79 | @property(nonatomic, strong) NSString *objectName;
80 |
81 | /*!
82 | 会话中最后一条消息的发送者用户ID
83 | */
84 | @property(nonatomic, strong) NSString *senderUserId;
85 |
86 | /*!
87 | 会话中最后一条消息的发送者的用户名(已废弃,请勿使用)
88 |
89 | @warning **已废弃,请勿使用。**
90 | */
91 | @property(nonatomic, strong) NSString *senderUserName
92 | __deprecated_msg("已废弃,请勿使用。");
93 |
94 | /*!
95 | 会话中最后一条消息的消息ID
96 | */
97 | @property(nonatomic, assign) long lastestMessageId;
98 |
99 | /*!
100 | 会话中最后一条消息的内容
101 | */
102 | @property(nonatomic, strong) RCMessageContent *lastestMessage;
103 |
104 | /*!
105 | 会话中最后一条消息的json Dictionary
106 |
107 | @discussion 此字段存放最后一条消息内容中未编码的json数据。
108 | SDK内置的消息,如果消息解码失败,默认会将消息的内容存放到此字段;如果编码和解码正常,此字段会置为nil。
109 | */
110 | @property(nonatomic, strong) NSDictionary *jsonDict;
111 |
112 | /*!
113 | 最后一条消息的全局唯一ID
114 |
115 | @discussion 服务器消息唯一ID(在同一个Appkey下全局唯一)
116 | */
117 | @property(nonatomic, strong) NSString *lastestMessageUId;
118 |
119 | /*!
120 | 会话中是否存在被@的消息
121 |
122 | @discussion 在清除会话未读数(clearMessagesUnreadStatus:targetId:)的时候,会将此状态置成 NO。
123 | */
124 | @property(nonatomic, assign) BOOL hasUnreadMentioned;
125 |
126 | /*!
127 | RCConversation初始化方法(已废弃,请勿使用)
128 |
129 | @param json 会话的json Dictionary
130 | @return 会话对象
131 |
132 | @warning **已废弃,请勿使用。**
133 | */
134 | + (instancetype)conversationWithProperties:(NSDictionary *)json
135 | __deprecated_msg("已废弃,请勿使用。");
136 |
137 | @end
138 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCCustomerServiceConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCCustomerServiceConfig.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 16/2/25.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // onResult:(void(^)(int isSuccess, NSString *errMsg))resultBlock
12 | // onBlocked:(void(^)(void))blockedBlock
13 | // onCompanyInfo:(void(^)(NSString *companyName, NSString
14 | // *companyUrl))companyInfoBlockInfo
15 | // onKeyboardType:(void(^)(RCCSInputType keyboardType))keyboardTypeBlock
16 | // onQuit:(void(^)(NSString *quitMsg))quitBlock;
17 |
18 | @interface RCCustomerServiceConfig : NSObject
19 | /*!
20 | * 是否被客服加为黑名单
21 | */
22 | @property(nonatomic) BOOL isBlack;
23 |
24 | /*!
25 | * 公司名称
26 | */
27 | @property(nonatomic, strong) NSString *companyName;
28 |
29 | /*!
30 | * 公司的Url
31 | */
32 | @property(nonatomic, strong) NSString *companyUrl;
33 |
34 | /*!
35 | * 机器人会话是否不需要评价
36 | */
37 | @property(nonatomic, assign) BOOL robotSessionNoEva;
38 |
39 | /*!
40 | * 人工服务会话是否不需要评价
41 | */
42 | @property(nonatomic, assign) BOOL humanSessionNoEva;
43 |
44 | /*!
45 | * 人工服务的评价选项,array的数据是RCEvaluateItem类型
46 | */
47 | @property(nonatomic, strong) NSArray *humanEvaluateItems;
48 | @end
49 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCCustomerServiceGroupItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCCustomerGroupItem.h
3 | // RongIMLib
4 | //
5 | // Created by 张改红 on 16/7/19.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface RCCustomerServiceGroupItem : NSObject
12 | @property (nonatomic, strong)NSString *groupId;
13 | @property (nonatomic, strong)NSString *name;
14 | @property (nonatomic, assign)BOOL online;
15 | @end
16 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCCustomerServiceInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCCustomerServiceInfo.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 16/5/10.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface RCCustomerServiceInfo : NSObject
12 | @property(nonatomic, strong) NSString *userId; //用户唯一标识
13 | @property(nonatomic, strong) NSString *nickName; //用户昵称
14 | @property(nonatomic, strong) NSString *loginName; //用户登录名
15 | @property(nonatomic, strong) NSString *name; //用户名称
16 | @property(nonatomic, strong) NSString *grade; //用户等级
17 | @property(nonatomic, strong) NSString *gender; //用户性别
18 | @property(nonatomic, strong) NSString *birthday; //用户生日
19 | @property(nonatomic, strong) NSString *age; //年龄
20 | @property(nonatomic, strong) NSString *profession; //职业
21 | @property(nonatomic, strong) NSString *portraitUrl; //头像
22 | @property(nonatomic, strong) NSString *province; //省份
23 | @property(nonatomic, strong) NSString *city; //城市
24 | @property(nonatomic, strong) NSString *memo; //备注
25 |
26 | @property(nonatomic, strong) NSString *mobileNo; //电话号码
27 | @property(nonatomic, strong) NSString *email; //邮箱
28 | @property(nonatomic, strong) NSString *address; //地址
29 | @property(nonatomic, strong) NSString *QQ; // QQ号
30 | @property(nonatomic, strong) NSString *weibo; //微博
31 | @property(nonatomic, strong) NSString *weixin; //微信
32 |
33 | @property(nonatomic, strong) NSString *page; //页面信息
34 | @property(nonatomic, strong) NSString *referrer; //来源
35 | @property(nonatomic, strong) NSString *enterUrl; //
36 | @property(nonatomic, strong) NSString *skillId;
37 | @property(nonatomic, strong) NSArray *listUrl;
38 | @property(nonatomic, strong) NSString *define; //自定义信息
39 | - (NSData *)encode;
40 | @end
41 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCDiscussion.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCDiscussion.h
11 | // Created by Heq.Shinoda on 14-6-23.
12 |
13 | #ifndef __RCDiscussion
14 | #define __RCDiscussion
15 |
16 | #import
17 |
18 | /*!
19 | 讨论组类
20 | */
21 | @interface RCDiscussion : NSObject
22 |
23 | /*!
24 | 讨论组ID
25 | */
26 | @property(nonatomic, strong) NSString *discussionId;
27 |
28 | /*!
29 | 讨论组名称
30 | */
31 | @property(nonatomic, strong) NSString *discussionName;
32 |
33 | /*!
34 | 讨论组的创建者的用户ID
35 | */
36 | @property(nonatomic, strong) NSString *creatorId;
37 |
38 | /*!
39 | 讨论组成员的用户ID列表
40 | */
41 | @property(nonatomic, strong) NSArray *memberIdList;
42 |
43 | /*!
44 | 讨论组是否开放加人权限
45 |
46 | @discussion 是否允许非创建者添加用户,0表示允许,1表示不允许,默认值为0。
47 | */
48 | @property(nonatomic, assign) int inviteStatus;
49 |
50 | /*!
51 | 讨论组的会话类型(已废弃,请勿使用)
52 |
53 | @warning **已废弃,请勿使用。**
54 | */
55 | @property(nonatomic, assign) __deprecated_msg("已废弃,请勿使用。")
56 | int conversationType;
57 |
58 | /*!
59 | 讨论组是否允许消息提醒(已废弃,请勿使用)
60 |
61 | @warning **已废弃,请勿使用。**
62 | */
63 | @property(nonatomic, assign) __deprecated_msg("已废弃,请勿使用。")
64 | int pushMessageNotificationStatus;
65 |
66 | /*!
67 | 讨论组初始化方法
68 |
69 | @param discussionId 讨论组ID
70 | @param discussionName 讨论组名称
71 | @param creatorId 创建者的用户ID
72 | @param conversationType 会话类型
73 | @param memberIdList 讨论组成员的用户ID列表
74 | @param inviteStatus 是否开放加人权限
75 | @param pushMessageNotificationStatus 是否允许消息提醒
76 | @return 讨论组对象
77 | */
78 | - (instancetype)initWithDiscussionId:(NSString *)discussionId
79 | discussionName:(NSString *)discussionName
80 | creatorId:(NSString *)creatorId
81 | conversationType:(int)conversationType
82 | memberIdList:(NSArray *)memberIdList
83 | inviteStatus:(int)inviteStatus
84 | msgNotificationStatus:(int)pushMessageNotificationStatus;
85 |
86 | @end
87 | #endif
88 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCDiscussionNotificationMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCDiscussionNotification.h
11 | // Created by Heq.Shinoda on 14-6-26.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 讨论组通知消息的类型名
17 | */
18 | #define RCDiscussionNotificationTypeIdentifier @"RC:DizNtf"
19 |
20 | /*!
21 | 讨论组通知的类型
22 | */
23 | typedef NS_ENUM(NSInteger, RCDiscussionNotificationType) {
24 | /*!
25 | 有成员加入讨论组的通知
26 | */
27 | RCInviteDiscussionNotification = 1,
28 | /*!
29 | 有成员退出讨论组的通知
30 | */
31 | RCQuitDiscussionNotification,
32 | /*!
33 | 讨论组名称发生变更的通知
34 | */
35 | RCRenameDiscussionTitleNotification,
36 | /*!
37 | 有成员被踢出讨论组的通知
38 | */
39 | RCRemoveDiscussionMemberNotification,
40 | /*!
41 | 讨论组加入权限的变更
42 | */
43 | RCSwichInvitationAccessNotification
44 | };
45 |
46 | /*!
47 | 讨论组通知消息类
48 |
49 | @discussion 讨论组通知消息类,此消息会进行存储,但不计入未读消息数。
50 | */
51 | @interface RCDiscussionNotificationMessage : RCMessageContent
52 |
53 | /*!
54 | 讨论组通知的类型
55 | */
56 | @property(nonatomic, assign) RCDiscussionNotificationType type;
57 |
58 | /*!
59 | 操作者的用户ID
60 | */
61 | @property(nonatomic, strong) NSString *operatorId;
62 |
63 | /*!
64 | 讨论组通知的扩展信息
65 | */
66 | @property(nonatomic, strong) NSString *extension;
67 |
68 | /*!
69 | 初始化讨论组通知消息
70 |
71 | @param type 讨论组通知的扩展信息
72 | @param operatorId 操作者的用户ID
73 | @param extension 讨论组通知的扩展信息
74 | @return 讨论组通知对象
75 | */
76 | + (instancetype)notificationWithType:(RCDiscussionNotificationType)type
77 | operator:(NSString *)operatorId
78 | extension:(NSString *)extension;
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCEvaluateItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCEvaluateItem.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 16/4/29.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface RCEvaluateItem : NSObject
12 | @property(nonatomic, strong) NSString *describe; // description
13 | @property(nonatomic) int value;
14 | @end
15 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCFileMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCFileMessage.h
3 | // RongIMLib
4 | //
5 | // Created by 珏王 on 16/5/23.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*!
12 | 文件消息的类型名
13 | */
14 | #define RCFileMessageTypeIdentifier @"RC:FileMsg"
15 |
16 | @interface RCFileMessage : RCMessageContent
17 |
18 | /*!
19 | 文件名
20 | */
21 | @property(nonatomic, strong) NSString *name;
22 |
23 | /*!
24 | 文件大小,单位为Byte
25 | */
26 | @property(nonatomic, assign) long long size;
27 |
28 | /*!
29 | 文件类型
30 | */
31 | @property(nonatomic, strong) NSString *type;
32 |
33 | /*!
34 | 文件的网络地址
35 | */
36 | @property(nonatomic, strong) NSString *fileUrl;
37 |
38 | /*!
39 | 文件的本地路径
40 | */
41 | @property(nonatomic, strong) NSString *localPath;
42 |
43 | /*!
44 | 附加信息
45 | */
46 | @property(nonatomic, strong) NSString *extra;
47 |
48 | /*!
49 | 初始化文件消息
50 |
51 | @param localPath 文件的本地路径
52 | @return 文件消息对象
53 | */
54 | + (instancetype)messageWithFile:(NSString *)localPath;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCFileUtility.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCFileUtility.h
11 |
12 | #ifndef __RCFileUtility
13 | #define __RCFileUtility
14 |
15 | #import "RCStatusDefine.h"
16 |
17 | @interface RCFileUtility : NSObject
18 |
19 | /*!
20 | 设置文件媒体类型
21 |
22 | @return 文件类型
23 | */
24 | + (NSString *)getMimeType:(RCMediaType)fileType;
25 |
26 | /*!
27 | 获取上传文件名称
28 |
29 | @return 文件媒体类型
30 | */
31 | + (NSString *)generateKey:(NSString *)mimeType;
32 |
33 | /*!
34 | 生成下载的文件路径
35 |
36 | @return 文件名称
37 | */
38 | + (NSString *)getFileName:(NSString *)imgUrl
39 | conversationType:(RCConversationType)conversationType
40 | mediaType:(RCMediaType)mediaType
41 | targetId:(NSString *)targetId;
42 |
43 | + (NSString *)getFileKey:(NSString *)fileUri;
44 |
45 | + (NSString *)getMediaDir:(RCMediaType)fileType;
46 |
47 | + (NSString *)getCateDir:(RCConversationType)categoryId;
48 |
49 | + (BOOL)isFileExist:(NSString *)fileName;
50 |
51 | + (BOOL)saveFile:(NSString *)filePath content:(NSData *)content;
52 |
53 | + (NSString *)getUniqueFileName:(NSString *)baseFileName;
54 |
55 | @end
56 | #endif
57 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCGroup.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCGroup.h
11 | // Created by Heq.Shinoda on 14-9-6.
12 |
13 | #import
14 |
15 | /*!
16 | 群组信息类
17 | */
18 | @interface RCGroup : NSObject
19 |
20 | /*!
21 | 群组ID
22 | */
23 | @property(nonatomic, strong) NSString *groupId;
24 |
25 | /*!
26 | 群组名称
27 | */
28 | @property(nonatomic, strong) NSString *groupName;
29 |
30 | /*!
31 | 群组头像的URL
32 | */
33 | @property(nonatomic, strong) NSString *portraitUri;
34 |
35 | /*!
36 | 群组信息的初始化方法
37 |
38 | @param groupId 群组ID
39 | @param groupName 群组名称
40 | @param portraitUri 群组头像的URL
41 | @return 群组信息对象
42 | */
43 | - (instancetype)initWithGroupId:(NSString *)groupId
44 | groupName:(NSString *)groupName
45 | portraitUri:(NSString *)portraitUri;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCGroupNotificationMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCGroupNotification.h
11 | // Created by xugang on 14/11/24.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 群组通知消息的类型名
17 | */
18 | #define RCGroupNotificationMessageIdentifier @"RC:GrpNtf"
19 |
20 | /*!
21 | 有成员加入群组的通知
22 | */
23 | #define GroupNotificationMessage_GroupOperationAdd @"Add"
24 | /*!
25 | 有成员退出群组的通知
26 | */
27 | #define GroupNotificationMessage_GroupOperationQuit @"Quit"
28 | /*!
29 | 有成员被踢出群组的通知
30 | */
31 | #define GroupNotificationMessage_GroupOperationKicked @"Kicked"
32 | /*!
33 | 群组名称发生变更的通知
34 | */
35 | #define GroupNotificationMessage_GroupOperationRename @"Rename"
36 | /*!
37 | 群组公告发生变更的通知
38 | */
39 | #define GroupNotificationMessage_GroupOperationBulletin @"Bulletin"
40 |
41 | /*!
42 | 群组通知消息类
43 |
44 | @discussion 群组通知消息类,此消息会进行存储,但不计入未读消息数。
45 | */
46 | @interface RCGroupNotificationMessage : RCMessageContent
47 |
48 | /*!
49 | 群组通知的当前操作名
50 |
51 | @discussion
52 | 群组通知的当前操作名称,您可以使用预定义好的操作名,也可以是您自己定义的任何操作名。
53 | 预定义的操作名:GroupNotificationMessage_GroupOperationAdd、GroupNotificationMessage_GroupOperationQuit、GroupNotificationMessage_GroupOperationKicked、GroupNotificationMessage_GroupOperationRename、GroupNotificationMessage_GroupOperationBulletin。
54 | */
55 | @property(nonatomic, strong) NSString *operation;
56 |
57 | /*!
58 | 当前操作发起用户的用户ID
59 | */
60 | @property(nonatomic, strong) NSString *operatorUserId;
61 |
62 | /*!
63 | 当前操作的目标对象
64 |
65 | @discussion
66 | 当前操作的目标对象,如被当前操作目标用户的用户ID或变更后的群主名称等。
67 | */
68 | @property(nonatomic, strong) NSString *data;
69 |
70 | /*!
71 | 当前操作的消息内容
72 | */
73 | @property(nonatomic, strong) NSString *message;
74 |
75 | /*!
76 | 当前操作的附加信息
77 | */
78 | @property(nonatomic, strong) NSString *extra;
79 |
80 | /*!
81 | 初始化群组通知消息
82 |
83 | @param operation 群组通知的当前操作名
84 | @param operatorUserId 当前操作发起用户的用户ID
85 | @param data 当前操作的目标对象
86 | @param message 当前操作的消息内容
87 | @param extra 当前操作的附加信息
88 | @return 群组通知消息对象
89 |
90 | @discussion 群组关系有开发者文虎,所有的群组操作都由您的服务器自己管理和维护。
91 | 所以群组通知的操作名和目标对象、消息内容、扩展信息您均可以自己定制,只要您发送方和接收方针对具体字段内容做好UI显示即可。
92 | */
93 | + (instancetype)notificationWithOperation:(NSString *)operation
94 | operatorUserId:(NSString *)operatorUserId
95 | data:(NSString *)data
96 | message:(NSString *)message
97 | extra:(NSString *)extra;
98 |
99 | @end
100 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCImageMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCImageMessage.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #import "RCMessageContent.h"
14 | #import
15 |
16 | /*!
17 | 图片消息的类型名
18 | */
19 | #define RCImageMessageTypeIdentifier @"RC:ImgMsg"
20 |
21 | /*!
22 | 图片消息类
23 |
24 | @discussion 图片消息类,此消息会进行存储并计入未读消息数。
25 | */
26 | @interface RCImageMessage : RCMessageContent
27 |
28 | /*!
29 | 图片消息的URL地址
30 |
31 | @discussion 发送方此字段为图片的本地路径,接收方此字段为网络URL地址。
32 | */
33 | @property(nonatomic, strong) NSString *imageUrl;
34 |
35 | /*!
36 | 图片消息的缩略图
37 | */
38 | @property(nonatomic, strong) UIImage *thumbnailImage;
39 |
40 | /*!
41 | 是否发送原图
42 |
43 | @discussion 在发送图片的时候,是否发送原图,默认值为NO。
44 | */
45 | @property(nonatomic, getter=isFull) BOOL full;
46 |
47 | /*!
48 | 图片消息的附加信息
49 | */
50 | @property(nonatomic, strong) NSString *extra;
51 |
52 | /*!
53 | 图片消息的原始图片信息
54 | */
55 | @property(nonatomic, strong) UIImage *originalImage;
56 |
57 | /*!
58 | 初始化图片消息
59 |
60 | @param image 原始图片
61 | @return 图片消息对象
62 | */
63 | + (instancetype)messageWithImage:(UIImage *)image;
64 |
65 | /*!
66 | 初始化图片消息
67 |
68 | @param imageURI 图片的本地路径
69 | @return 图片消息对象
70 | */
71 | + (instancetype)messageWithImageURI:(NSString *)imageURI;
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCInformationNotificationMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCInformationNotificationMessage.h
11 | // Created by xugang on 14/12/4.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 通知消息的类型名
17 | */
18 | #define RCInformationNotificationMessageIdentifier @"RC:InfoNtf"
19 |
20 | /*!
21 | 通知消息类
22 |
23 | @discussion 通知消息类,此消息会进行存储,但不计入未读消息数。
24 | */
25 | @interface RCInformationNotificationMessage : RCMessageContent
26 |
27 | /*!
28 | 通知的内容
29 | */
30 | @property(nonatomic, strong) NSString *message;
31 |
32 | /*!
33 | 通知的附加信息
34 | */
35 | @property(nonatomic, strong) NSString *extra;
36 |
37 | /*!
38 | 初始化通知消息
39 |
40 | @param message 通知的内容
41 | @param extra 通知的附加信息
42 | @return 通知消息对象
43 | */
44 | + (instancetype)notificationWithMessage:(NSString *)message
45 | extra:(NSString *)extra;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCLocationMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCLocationMessage.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #import "RCMessageContent.h"
14 | #import
15 | #import
16 |
17 | /*!
18 | 地理位置消息的类型名
19 | */
20 | #define RCLocationMessageTypeIdentifier @"RC:LBSMsg"
21 |
22 | /*!
23 | 地理位置消息类
24 |
25 | @discussion 地理位置消息类,此消息会进行存储并计入未读消息数。
26 | */
27 | @interface RCLocationMessage : RCMessageContent
28 |
29 | /*!
30 | 地理位置的二维坐标
31 | */
32 | @property(nonatomic, assign) CLLocationCoordinate2D location;
33 |
34 | /*!
35 | 地理位置的名称
36 | */
37 | @property(nonatomic, strong) NSString *locationName;
38 |
39 | /*!
40 | 地理位置的缩略图
41 | */
42 | @property(nonatomic, strong) UIImage *thumbnailImage;
43 |
44 | /*!
45 | 地理位置的附加信息
46 | */
47 | @property(nonatomic, strong) NSString *extra;
48 |
49 | /*!
50 | 初始化地理位置消息
51 |
52 | @param image 地理位置的缩略图
53 | @param location 地理位置的二维坐标
54 | @param locationName 地理位置的名称
55 | @return 地理位置消息的对象
56 | */
57 | + (instancetype)messageWithLocationImage:(UIImage *)image
58 | location:(CLLocationCoordinate2D)location
59 | locationName:(NSString *)locationName;
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCMentionedInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCMentionedInfo.h
3 | // RongIMLib
4 | //
5 | // Created by 杜立召 on 16/7/6.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCStatusDefine.h"
10 | #import
11 |
12 | /*!
13 | 消息中的@提醒信息
14 | */
15 | @interface RCMentionedInfo : NSObject
16 |
17 | /*!
18 | @提醒的类型
19 | */
20 | @property(nonatomic, assign) RCMentionedType type;
21 |
22 | /*!
23 | @的用户ID列表
24 |
25 | @discussion 如果type是@所有人,则可以传nil
26 | */
27 | @property(nonatomic, strong) NSArray *userIdList;
28 |
29 | /*!
30 | 包含@提醒的消息,本地通知和远程推送显示的内容
31 | */
32 | @property(nonatomic, strong) NSString *mentionedContent;
33 |
34 | /*!
35 | 是否@了我
36 | */
37 | @property(nonatomic, readonly) BOOL isMentionedMe;
38 |
39 | /*!
40 | 初始化@提醒信息
41 |
42 | @param type @提醒的类型
43 | @param userIdList @的用户ID列表
44 | @param mentionedContent @ Push 内容
45 |
46 | @return @提醒信息的对象
47 | */
48 | - (instancetype)initWithMentionedType:(RCMentionedType)type
49 | userIdList:(NSArray *)userIdList
50 | mentionedContent:(NSString *)mentionedContent;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCMessage.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #ifndef __RCMessage
14 | #define __RCMessage
15 | #import "RCMessageContent.h"
16 | #import "RCStatusDefine.h"
17 | #import "RCReadReceiptInfo.h"
18 | #import
19 |
20 | /*!
21 | 消息实体类
22 |
23 | @discussion 消息实体类,包含消息的所有属性。
24 | */
25 | @interface RCMessage : NSObject
26 |
27 | /*!
28 | 会话类型
29 | */
30 | @property(nonatomic, assign) RCConversationType conversationType;
31 |
32 | /*!
33 | 目标会话ID
34 | */
35 | @property(nonatomic, strong) NSString *targetId;
36 |
37 | /*!
38 | 消息的ID
39 |
40 | @discussion 本地存储的消息的唯一值(数据库索引唯一值)
41 | */
42 | @property(nonatomic, assign) long messageId;
43 |
44 | /*!
45 | 消息的方向
46 | */
47 | @property(nonatomic, assign) RCMessageDirection messageDirection;
48 |
49 | /*!
50 | 消息的发送者ID
51 | */
52 | @property(nonatomic, strong) NSString *senderUserId;
53 |
54 | /*!
55 | 消息的接收状态
56 | */
57 | @property(nonatomic, assign) RCReceivedStatus receivedStatus;
58 |
59 | /*!
60 | 消息的发送状态
61 | */
62 | @property(nonatomic, assign) RCSentStatus sentStatus;
63 |
64 | /*!
65 | 消息的接收时间(Unix时间戳、毫秒)
66 | */
67 | @property(nonatomic, assign) long long receivedTime;
68 |
69 | /*!
70 | 消息的发送时间(Unix时间戳、毫秒)
71 | */
72 | @property(nonatomic, assign) long long sentTime;
73 |
74 | /*!
75 | 消息的类型名
76 | */
77 | @property(nonatomic, strong) NSString *objectName;
78 |
79 | /*!
80 | 消息的内容
81 | */
82 | @property(nonatomic, strong) RCMessageContent *content;
83 |
84 | /*!
85 | 消息的附加字段
86 | */
87 | @property(nonatomic, strong) NSString *extra;
88 |
89 | /*!
90 | 全局唯一ID
91 |
92 | @discussion 服务器消息唯一ID(在同一个Appkey下全局唯一)
93 | */
94 | @property(nonatomic, strong) NSString *messageUId;
95 |
96 | /*!
97 | 阅读回执状态
98 | */
99 | @property(nonatomic, strong) RCReadReceiptInfo *readReceiptInfo;
100 |
101 |
102 | /*!
103 | RCMessage初始化方法
104 |
105 | @param conversationType 会话类型
106 | @param targetId 目标会话ID
107 | @param messageDirection 消息的方向
108 | @param messageId 消息的ID
109 | @param content 消息的内容
110 | */
111 | - (instancetype)initWithType:(RCConversationType)conversationType
112 | targetId:(NSString *)targetId
113 | direction:(RCMessageDirection)messageDirection
114 | messageId:(long)messageId
115 | content:(RCMessageContent *)content;
116 |
117 | /*!
118 | RCMessage初始化方法(已废弃,请勿使用)
119 |
120 | @param jsonData 消息的JSON Dictionary
121 | @return 消息实体对象
122 |
123 | @warning **已废弃,请勿使用。**
124 | */
125 | + (instancetype)messageWithJSON:(NSDictionary *)jsonData
126 | __deprecated_msg("已废弃,请勿使用。");
127 |
128 | @end
129 | #endif
130 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCMessageContent.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCMessageContent.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #ifndef __RCMessageContent
14 | #define __RCMessageContent
15 |
16 | #import "RCStatusDefine.h"
17 | #import "RCUserInfo.h"
18 | #import
19 | #import "RCMentionedInfo.h"
20 |
21 | /*!
22 | 消息内容的编解码协议
23 |
24 | @discussion 用于标示消息内容的类型,进行消息的编码和解码。
25 | 所有自定义消息必须实现此协议,否则将无法正常传输和使用。
26 | */
27 | @protocol RCMessageCoding
28 | @required
29 |
30 | /*!
31 | 将消息内容序列化,编码成为可传输的json数据
32 |
33 | @discussion
34 | 消息内容通过此方法,将消息中的所有数据,编码成为json数据,返回的json数据将用于网络传输。
35 | */
36 | - (NSData *)encode;
37 |
38 | /*!
39 | 将json数据的内容反序列化,解码生成可用的消息内容
40 |
41 | @param data 消息中的原始json数据
42 |
43 | @discussion
44 | 网络传输的json数据,会通过此方法解码,获取消息内容中的所有数据,生成有效的消息内容。
45 | */
46 | - (void)decodeWithData:(NSData *)data;
47 |
48 | /*!
49 | 返回消息的类型名
50 |
51 | @return 消息的类型名
52 |
53 | @discussion 您定义的消息类型名,需要在各个平台上保持一致,以保证消息互通。
54 |
55 | @warning 请勿使用@"RC:"开头的类型名,以免和SDK默认的消息名称冲突
56 | */
57 | + (NSString *)getObjectName;
58 |
59 | @end
60 |
61 | /*!
62 | 消息内容的存储协议
63 |
64 | @discussion 用于确定消息内容的存储策略。
65 | 所有自定义消息必须实现此协议,否则将无法正常存储和使用。
66 | */
67 | @protocol RCMessagePersistentCompatible
68 | @required
69 |
70 | /*!
71 | 返回消息的存储策略
72 |
73 | @return 消息的存储策略
74 |
75 | @discussion 指明此消息类型在本地是否存储、是否计入未读消息数。
76 | */
77 | + (RCMessagePersistent)persistentFlag;
78 | @end
79 |
80 | /*!
81 | 消息内容摘要的协议
82 |
83 | @discussion 用于在会话列表和本地通知中显示消息的摘要。
84 | */
85 | @protocol RCMessageContentView
86 | @optional
87 |
88 | /*!
89 | 返回在会话列表和本地通知中显示的消息内容摘要
90 |
91 | @return 会话列表和本地通知中显示的消息内容摘要
92 |
93 | @discussion
94 | 如果您使用IMKit,当会话的最后一条消息为自定义消息时,需要通过此方法获取在会话列表展现的内容摘要;
95 | 当App在后台收到消息时,需要通过此方法获取在本地通知中展现的内容摘要。
96 | */
97 | - (NSString *)conversationDigest;
98 |
99 | @end
100 |
101 | /*!
102 | 消息内容的基类
103 |
104 | @discussion 此类为消息实体类RCMessage中的消息内容content的基类。
105 | 所有的消息内容均为此类的子类,包括SDK自带的消息(如RCTextMessage、RCImageMessage等)和用户自定义的消息。
106 | 所有的自定义消息必须继承此类,并实现RCMessageCoding和RCMessagePersistentCompatible、RCMessageContentView协议。
107 | */
108 | @interface RCMessageContent
109 | : NSObject
111 |
112 | /*!
113 | 消息内容中携带的发送者的用户信息
114 |
115 | @discussion
116 | 如果您使用IMKit,可以通过RCIM的enableMessageAttachUserInfo属性设置在每次发送消息中携带发送者的用户信息。
117 | */
118 | @property(nonatomic, strong) RCUserInfo *senderUserInfo;
119 |
120 | /*!
121 | 消息中的@提醒信息
122 | */
123 | @property(nonatomic, strong) RCMentionedInfo *mentionedInfo;
124 |
125 | /*!
126 | 将消息内容中携带的用户信息解码
127 |
128 | @param dictionary 用户信息的Dictionary
129 | */
130 | - (void)decodeUserInfo:(NSDictionary *)dictionary;
131 |
132 | /*!
133 | 将消息内容中携带的@提醒信息解码
134 |
135 | @param dictionary @提醒信息的Dictionary
136 | */
137 | - (void)decodeMentionedInfo:(NSDictionary *)dictionary;
138 |
139 | /*!
140 | 消息内容的原始json数据
141 |
142 | @discussion 此字段存放消息内容中未编码的json数据。
143 | SDK内置的消息,如果消息解码失败,默认会将消息的内容存放到此字段;如果编码和解码正常,此字段会置为nil。
144 | */
145 | @property(nonatomic, strong, setter=setRawJSONData:) NSData *rawJSONData;
146 |
147 | @end
148 | #endif
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCMessageContentView.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCMessageContentView.h
11 | // Created by litao on 15/4/27.
12 |
13 | #ifndef RongIMLib_RCMessageContentView_h
14 | #define RongIMLib_RCMessageContentView_h
15 |
16 | ///此协议已经移到RCMessageContent中
17 |
18 | ///*!
19 | // 消息内容摘要的协议
20 | //
21 | // @discussion 用于在会话列表中显示消息的摘要。
22 | //
23 | // @warning 此协议已经移到RCMessageContent中
24 | // */
25 | //@protocol RCMessageContentView
26 | //@optional
27 | //
28 | ///*!
29 | // 返回在会话列表中显示的消息内容摘要
30 | //
31 | // @return 会话列表中显示的消息内容摘要
32 | //
33 | // @discussion
34 | // 当会话的最后一条消息为自定义消息时,需要在会话列表展现消息内容的摘要。
35 | // 如果您使用IMKit,实现了此接口,RCConversationListViewController会在会话列表中显示该内容摘要。
36 | // */
37 | //- (NSString *)conversationDigest;
38 | //
39 | //@end
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCProfileNotificationMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCProfileNotificationMessage.h
11 | // Created by xugang on 14/11/28.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 公众服务账号信息变更消息的类型名
17 | */
18 | #define RCProfileNotificationMessageIdentifier @"RC:ProfileNtf"
19 |
20 | /*!
21 | 公众服务账号信息变更消息类
22 |
23 | @discussion 公众服务账号信息变更消息类,此消息会进行存储,但不计入未读消息数。
24 | */
25 | @interface RCProfileNotificationMessage : RCMessageContent
26 |
27 | /*!
28 | 公众服务账号信息变更的操作名
29 | */
30 | @property(nonatomic, strong) NSString *operation;
31 |
32 | /*!
33 | 信息变更的数据,可以为任意格式,如json数据。
34 | */
35 | @property(nonatomic, strong) NSString *data;
36 |
37 | /*!
38 | 信息变更的附加信息
39 | */
40 | @property(nonatomic, strong) NSString *extra;
41 |
42 | /*!
43 | 初始化公众服务账号信息变更消息
44 |
45 | @param operation 信息变更的操作名
46 | @param data 信息变更的数据
47 | @param extra 信息变更的附加信息
48 | @return 公众服务账号信息变更消息的对象
49 | */
50 | + (instancetype)notificationWithOperation:(NSString *)operation
51 | data:(NSString *)data
52 | extra:(NSString *)extra;
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCPublicServiceCommandMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCPublicServiceCommandMessage.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 15/6/23.
6 | // Copyright (c) 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCMessageContent.h"
10 | #import "RCPublicServiceMenuItem.h"
11 |
12 | /*!
13 | 公众服务请求消息的类型名
14 | */
15 | #define RCPublicServiceCommandMessageTypeIdentifier @"RC:PSCmd"
16 |
17 | /*!
18 | 公众服务请求消息类
19 |
20 | @discussion 公众服务请求消息类,此消息不存储,也不计入未读消息数。
21 | 此消息仅用于客户端公共服务账号中的菜单,向服务器发送请求。
22 | */
23 | @interface RCPublicServiceCommandMessage : RCMessageContent
24 |
25 | /*!
26 | 请求的名称
27 | */
28 | @property(nonatomic, strong) NSString *command;
29 |
30 | /*!
31 | 请求的内容
32 | */
33 | @property(nonatomic, strong) NSString *data;
34 |
35 | /*!
36 | 请求的扩展数据
37 | */
38 | @property(nonatomic, strong) NSString *extra;
39 |
40 | /*!
41 | 初始化公众服务请求消息
42 |
43 | @param item 公众服务菜单项
44 | @return 公众服务请求消息对象
45 | */
46 | + (instancetype)messageFromMenuItem:(RCPublicServiceMenuItem *)item;
47 |
48 | /*!
49 | 初始化公众服务请求消息
50 |
51 | @param command 请求的名称
52 | @param data 请求的内容
53 | @return 公众服务请求消息对象
54 | */
55 | + (instancetype)messageWithCommand:(NSString *)command data:(NSString *)data;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCPublicServiceMenu.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCPublicServiceMenu.h
11 | // Created by litao on 15/4/14.
12 |
13 | #import "RCPublicServiceMenuItem.h"
14 | #import
15 |
16 | /*!
17 | 公众服务账号菜单类
18 |
19 | @discussion
20 | 公众服务菜单类,其中包含若干数量的菜单项,每个菜单项可能还包含子菜单项。
21 | 公众服务菜单的树状结构如下所示:
22 | Menu -> MenuItem1
23 | MenuItem2 -> MenuItem2.1
24 | MenuItem2.2
25 | MenuItem3 -> MenuItem3.1
26 | MenuItem3.2
27 | MenuItem3.3
28 | */
29 | @interface RCPublicServiceMenu : NSObject
30 |
31 | /*!
32 | 菜单中包含的所有菜单项RCPublicServiceMenuItem数组
33 | */
34 | @property(nonatomic, strong) NSArray *menuItems;
35 |
36 | /*!
37 | 将公众服务菜单下的所有菜单项解码(已废弃,请勿使用)
38 |
39 | @param jsonDictionary 公众服务菜单项Json组成的数组
40 |
41 | @warning **已废弃,请勿使用。**
42 | */
43 | - (void)decodeWithJsonDictionaryArray:(NSArray *)jsonDictionary
44 | __deprecated_msg("已废弃,请勿使用。");
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCPublicServiceMenuItem.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCPublicServiceMenuItem.h
11 | // Created by litao on 15/4/14.
12 |
13 | #import "RCStatusDefine.h"
14 | #import
15 |
16 | /*!
17 | 公众服务的菜单项
18 | */
19 | @interface RCPublicServiceMenuItem : NSObject
20 |
21 | /*!
22 | 菜单的ID
23 | */
24 | @property(nonatomic, strong) NSString *id;
25 |
26 | /*!
27 | 菜单的标题
28 | */
29 | @property(nonatomic, strong) NSString *name;
30 |
31 | /*!
32 | 菜单的URL链接
33 | */
34 | @property(nonatomic, strong) NSString *url;
35 |
36 | /*!
37 | 菜单的类型
38 | */
39 | @property(nonatomic) RCPublicServiceMenuItemType type;
40 |
41 | /*!
42 | 菜单中的子菜单
43 |
44 | @discussion 子菜单为RCPublicServiceMenuItem的数组
45 | */
46 | @property(nonatomic, strong) NSArray *subMenuItems;
47 |
48 | /*!
49 | 将菜单项的json数组解码(已废弃,请勿使用)
50 |
51 | @param jsonArray 由菜单项原始Json数据组成的数组
52 | @return 公众服务菜单项RCPublicServiceMenuItem的数组
53 |
54 | @warning **已废弃,请勿使用。**
55 | */
56 | + (NSArray *)menuItemsFromJsonArray:(NSArray *)jsonArray
57 | __deprecated_msg("已废弃,请勿使用。");
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCPublicServiceMultiRichContentMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCPublicServiceMultiRichContentMessage.h
11 | // Created by litao on 15/4/13.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 公众服务的多图文消息的类型名
17 | */
18 | #define RCPublicServiceRichContentTypeIdentifier @"RC:PSMultiImgTxtMsg"
19 |
20 | /*!
21 | 公众服务的多图文消息类
22 |
23 | @discussion 公众服务的多图文消息类,此消息会进行存储并计入未读消息数。
24 | */
25 | @interface RCPublicServiceMultiRichContentMessage : RCMessageContent
26 |
27 | /*!
28 | 多图文消息的内容RCRichContentItem数组
29 | */
30 | @property(nonatomic, strong) NSArray *richConents;
31 |
32 | /*!
33 | 多图文消息的附加信息
34 | */
35 | @property(nonatomic, strong) NSString *extra;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCPublicServiceProfile.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCPublicServiceProfile.h
11 | // Created by litao on 15/4/9.
12 |
13 | #import "RCPublicServiceMenu.h"
14 | #import "RCStatusDefine.h"
15 | #import
16 | #import
17 |
18 | /*!
19 | 公众服务账号信息
20 | */
21 | @interface RCPublicServiceProfile : NSObject
22 |
23 | /*!
24 | 公众服务账号的名称
25 | */
26 | @property(nonatomic, strong) NSString *name;
27 |
28 | /*!
29 | 公众服务账号的描述
30 | */
31 | @property(nonatomic, strong) NSString *introduction;
32 |
33 | /*!
34 | 公众服务账号的ID
35 | */
36 | @property(nonatomic, strong) NSString *publicServiceId;
37 |
38 | /*!
39 | 公众服务账号头像URL
40 | */
41 | @property(nonatomic, strong) NSString *portraitUrl;
42 |
43 | /*!
44 | 公众服务账号的所有者
45 |
46 | @discussion 当前版本暂不支持。
47 | */
48 | @property(nonatomic, strong) NSString *owner;
49 |
50 | /*!
51 | 公众服务账号所有者的URL
52 |
53 | @discussion 当前版本暂不支持。
54 | */
55 | @property(nonatomic, strong) NSString *ownerUrl;
56 |
57 | /*!
58 | 公众服务账号的联系电话
59 |
60 | @discussion 当前版本暂不支持。
61 | */
62 | @property(nonatomic, strong) NSString *publicServiceTel;
63 |
64 | /*!
65 | 公众服务账号历史消息
66 |
67 | @discussion 当前版本暂不支持。
68 | */
69 | @property(nonatomic, strong) NSString *histroyMsgUrl;
70 |
71 | /*!
72 | 公众服务账号地理位置
73 |
74 | @discussion 当前版本暂不支持。
75 | */
76 | @property(nonatomic, strong) CLLocation *location;
77 |
78 | /*!
79 | 公众服务账号经营范围
80 |
81 | @discussion 当前版本暂不支持。
82 | */
83 | @property(nonatomic, strong) NSString *scope;
84 |
85 | /*!
86 | 公众服务账号类型
87 | */
88 | @property(nonatomic) RCPublicServiceType publicServiceType;
89 |
90 | /*!
91 | 是否关注该公众服务账号
92 | */
93 | @property(nonatomic, getter=isFollowed) BOOL followed;
94 |
95 | /*!
96 | 公众服务账号菜单
97 | */
98 | @property(nonatomic, strong) RCPublicServiceMenu *menu;
99 |
100 | /*!
101 | 公众服务账号的全局属性
102 |
103 | @discussion 此公众服务账号是否设置为所有用户均关注。
104 | */
105 | @property(nonatomic, getter=isGlobal) BOOL global;
106 |
107 | /*!
108 | 公众服务账号信息的json数据
109 | */
110 | @property(nonatomic, strong) NSDictionary *jsonDict;
111 |
112 | /*!
113 | 初始化公众服务账号信息
114 |
115 | @param jsonContent 公众藏獒信息的json数据
116 | */
117 | - (void)initContent:(NSString *)jsonContent;
118 |
119 | @end
120 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCPublicServiceRichContentMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCPublicServiceMultiRichContentMessage.h
11 | // Created by litao on 15/4/15.
12 |
13 | #import "RCMessageContent.h"
14 | #import "RCRichContentItem.h"
15 |
16 | /*!
17 | 公众服务图文消息的类型名
18 | */
19 | #define RCSingleNewsMessageTypeIdentifier @"RC:PSImgTxtMsg"
20 |
21 | /*!
22 | 公众服务图文消息类
23 |
24 | @discussion 公众服务图文消息类,此消息会进行存储并计入未读消息数。
25 | */
26 | @interface RCPublicServiceRichContentMessage : RCMessageContent
27 |
28 | /*!
29 | 公众服务图文信息条目RCRichContentItem内容
30 | */
31 | @property(nonatomic, strong) RCRichContentItem *richConent;
32 |
33 | /*!
34 | 图文消息的附加信息
35 | */
36 | @property(nonatomic, strong) NSString *extra;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCReadReceiptInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCReadReceiptInfo.h
3 | // RongIMLib
4 | //
5 | // Created by 杜立召 on 16/8/29.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 | #import "RCStatusDefine.h"
9 | #import
10 |
11 | @interface RCReadReceiptInfo : NSObject
12 |
13 |
14 | /*!
15 | 是否需要回执消息
16 | */
17 | @property(nonatomic, assign) BOOL isReceiptRequestMessage;
18 |
19 | /**
20 | * 是否已经发送回执
21 | */
22 | @property(nonatomic,assign) BOOL hasRespond;
23 |
24 | /*!
25 | 发送回执的用户ID列表
26 | */
27 | @property(nonatomic, strong) NSMutableDictionary *userIdList;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCRealTimeLocationEndMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCRealTimeLocationEndMessage.h
3 | // RongIMLib
4 | //
5 | // Created by 杜立召 on 15/8/13.
6 | // Copyright (c) 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCMessageContent.h"
10 |
11 | /*!
12 | 实时位置共享的结束消息的类型名
13 | */
14 | #define RCRealTimeLocationEndMessageTypeIdentifier @"RC:RLEnd"
15 |
16 | /*!
17 | 实时位置共享的结束消息类
18 |
19 | @discussion 实时位置共享的结束消息类,此消息会进行存储并计入未读消息数。
20 | */
21 | @interface RCRealTimeLocationEndMessage : RCMessageContent
22 |
23 | /*!
24 | 结束消息的附加信息
25 | */
26 | @property(nonatomic, strong) NSString *extra;
27 |
28 | /*!
29 | 初始化实时位置共享的结束消息
30 |
31 | @param extra 附加信息
32 | @return 初始化实时位置共享的结束消息对象
33 | */
34 | + (instancetype)messageWithExtra:(NSString *)extra;
35 |
36 | @end
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCRealTimeLocationManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCRealTimeLocationManager.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 15/7/14.
6 | // Copyright (c) 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCIMClient.h"
10 | #import
11 | #import
12 |
13 | /*!
14 | 实时位置共享状态
15 | */
16 | typedef NS_ENUM(NSInteger, RCRealTimeLocationStatus) {
17 | /*!
18 | 实时位置共享,初始状态
19 | */
20 | RC_REAL_TIME_LOCATION_STATUS_IDLE,
21 | /*!
22 | 实时位置共享,接收状态
23 | */
24 | RC_REAL_TIME_LOCATION_STATUS_INCOMING,
25 | /*!
26 | 实时位置共享,发起状态
27 | */
28 | RC_REAL_TIME_LOCATION_STATUS_OUTGOING,
29 | /*!
30 | 实时位置共享,共享状态
31 | */
32 | RC_REAL_TIME_LOCATION_STATUS_CONNECTED
33 | };
34 |
35 | /*!
36 | 实时位置共享错误码
37 | */
38 | typedef NS_ENUM(NSInteger, RCRealTimeLocationErrorCode) {
39 | /*!
40 | 当前设备不支持实时位置共享
41 | */
42 | RC_REAL_TIME_LOCATION_NOT_SUPPORT,
43 | /*!
44 | 当前会话不支持实时位置共享
45 | */
46 | RC_REAL_TIME_LOCATION_CONVERSATION_NOT_SUPPORT,
47 | /*!
48 | 当前会话超出了参与者人数限制
49 | */
50 | RC_REAL_TIME_LOCATION_EXCEED_MAX_PARTICIPANT,
51 | /*!
52 | 获取当前会话信息失败
53 | */
54 | RC_REAL_TIME_LOCATION_GET_CONVERSATION_FAILURE
55 | };
56 |
57 | /*!
58 | 实时位置共享监听器
59 | */
60 | @protocol RCRealTimeLocationObserver
61 | @optional
62 |
63 | /*!
64 | 实时位置共享状态改变的回调
65 |
66 | @param status 当前实时位置共享的状态
67 | */
68 | - (void)onRealTimeLocationStatusChange:(RCRealTimeLocationStatus)status;
69 |
70 | /*!
71 | 参与者位置发生变化的回调
72 |
73 | @param location 参与者的当前位置
74 | @param userId 位置发生变化的参与者的用户ID
75 | */
76 | - (void)onReceiveLocation:(CLLocation *)location fromUserId:(NSString *)userId;
77 |
78 | /*!
79 | 有参与者加入实时位置共享的回调
80 |
81 | @param userId 加入实时位置共享的参与者的用户ID
82 | */
83 | - (void)onParticipantsJoin:(NSString *)userId;
84 |
85 | /*!
86 | 有参与者退出实时位置共享的回调
87 |
88 | @param userId 退出实时位置共享的参与者的用户ID
89 | */
90 | - (void)onParticipantsQuit:(NSString *)userId;
91 |
92 | /*!
93 | 更新位置信息失败的回调
94 |
95 | @param description 失败信息
96 | */
97 | - (void)onUpdateLocationFailed:(NSString *)description;
98 |
99 | /*!
100 | 发起实时位置共享失败后执行
101 |
102 | @param messageId 发起失败的消息ID
103 | */
104 | - (void)onStartRealTimeLocationFailed:(long)messageId;
105 |
106 | @end
107 |
108 | /*!
109 | 实时位置共享代理
110 | */
111 | @protocol RCRealTimeLocationProxy
112 |
113 | /*!
114 | 发起实时位置共享
115 | */
116 | - (void)startRealTimeLocation;
117 |
118 | /*!
119 | 加入实时位置共享
120 | */
121 | - (void)joinRealTimeLocation;
122 |
123 | /*!
124 | 退出实时位置共享
125 | */
126 | - (void)quitRealTimeLocation;
127 |
128 | /*!
129 | 注册实时位置共享监听
130 |
131 | @param delegate 实时位置共享监听
132 | */
133 | - (void)addRealTimeLocationObserver:(id)delegate;
134 |
135 | /*!
136 | 移除实时位置共享监听
137 |
138 | @param delegate 实时位置共享监听
139 | */
140 | - (void)removeRealTimeLocationObserver:(id)delegate;
141 |
142 | /*!
143 | 获取当前实时位置共享的参与者列表
144 |
145 | @return 当前参与者列表
146 | */
147 | - (NSArray *)getParticipants;
148 |
149 | /*!
150 | 获取当前实时位置共享状态
151 |
152 | @return 当前实时位置共享状态
153 | */
154 | - (RCRealTimeLocationStatus)getStatus;
155 |
156 | /*!
157 | 获取参与者的当前位置
158 |
159 | @param userId 需要获取参与者的用户ID
160 |
161 | @return 该参与者的位置信息
162 | */
163 | - (CLLocation *)getLocation:(NSString *)userId;
164 |
165 | @end
166 |
167 | /*!
168 | 实时位置共享管理类
169 | */
170 | @interface RCRealTimeLocationManager : NSObject
171 |
172 | /*!
173 | 获取实时位置共享的核心类单例
174 |
175 | @return 实时位置共享的核心类单例
176 | */
177 | + (instancetype)sharedManager;
178 |
179 | /*!
180 | 获取实时位置共享的代理
181 |
182 | @param conversationType 会话类型
183 | @param targetId 目标会话ID
184 | @param successBlock 获取代理成功的处理
185 | @param errorBlock 获取代理失败的处理
186 | */
187 | - (void)
188 | getRealTimeLocationProxy:(RCConversationType)conversationType
189 | targetId:(NSString *)targetId
190 | success:(void (^)(id locationShare))
191 | successBlock
192 | error:
193 | (void (^)(RCRealTimeLocationErrorCode status))errorBlock;
194 |
195 | @end
196 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCRealTimeLocationStartMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCRealTimeLocationStartMessage.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 15/7/14.
6 | // Copyright (c) 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCMessageContent.h"
10 |
11 | /*!
12 | 实时位置共享的发起消息的类型名
13 | */
14 | #define RCRealTimeLocationStartMessageTypeIdentifier @"RC:RLStart"
15 |
16 | /*!
17 | 实时位置共享的发起消息类
18 |
19 | @discussion 实时位置共享的发起消息类,此消息会进行存储并计入未读消息数。
20 | */
21 | @interface RCRealTimeLocationStartMessage : RCMessageContent
22 |
23 | /*!
24 | 发起消息的附加信息
25 | */
26 | @property(nonatomic, strong) NSString *extra;
27 |
28 | /*!
29 | 初始化实时位置共享的发起消息
30 |
31 | @param extra 附加信息
32 | @return 初始化实时位置共享的发起消息对象
33 | */
34 | + (instancetype)messageWithExtra:(NSString *)extra;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCRecallNotificationMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCRecallNotificationMessage.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 16/7/15.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*!
12 | 撤回通知消息的类型名
13 | */
14 | #define RCRecallNotificationMessageIdentifier @"RC:RcNtf"
15 |
16 | /*!
17 | 撤回通知消息类
18 | */
19 | @interface RCRecallNotificationMessage : RCMessageContent
20 |
21 | /*!
22 | 发起撤回操作的用户ID
23 | */
24 | @property(nonatomic, strong) NSString *operatorId;
25 |
26 | /*!
27 | 撤回的时间(毫秒)
28 | */
29 | @property(nonatomic, assign) long long recallTime;
30 |
31 | /*!
32 | 原消息的消息类型名
33 | */
34 | @property(nonatomic, strong) NSString *originalObjectName;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCRichContentItem.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCRichContentItem.h
11 | // Created by Dulizhao on 15/4/21.
12 |
13 | #import
14 |
15 | /*!
16 | 公众服务图文信息条目类
17 |
18 | @discussion 图文消息类,此消息会进行存储并计入未读消息数。
19 | */
20 | @interface RCRichContentItem : NSObject
21 |
22 | /*!
23 | 图文信息条目的标题
24 | */
25 | @property(nonatomic, strong) NSString *title;
26 |
27 | /*!
28 | 图文信息条目的内容摘要
29 | */
30 | @property(nonatomic, strong) NSString *digest;
31 |
32 | /*!
33 | 图文信息条目的图片URL
34 | */
35 | @property(nonatomic, strong) NSString *imageURL;
36 |
37 | /*!
38 | 图文信息条目中包含的需要跳转到的URL
39 | */
40 | @property(nonatomic, strong) NSString *url;
41 |
42 | /*!
43 | 图文信息条目的扩展信息
44 | */
45 | @property(nonatomic, strong) NSString *extra;
46 |
47 | /*!
48 | 初始化公众服务图文信息条目
49 |
50 | @param title 图文信息条目的标题
51 | @param digest 图文信息条目的内容摘要
52 | @param imageURL 图文信息条目的图片URL
53 | @param extra 图文信息条目的扩展信息
54 | @return 图文信息条目对象
55 | */
56 | + (instancetype)messageWithTitle:(NSString *)title
57 | digest:(NSString *)digest
58 | imageURL:(NSString *)imageURL
59 | extra:(NSString *)extra;
60 |
61 | /*!
62 | 初始化公众服务图文信息条目
63 |
64 | @param title 图文信息条目的标题
65 | @param digest 图文信息条目的内容摘要
66 | @param imageURL 图文信息条目的图片URL
67 | @param url 图文信息条目中包含的需要跳转到的URL
68 | @param extra 图文信息条目的扩展信息
69 | @return 图文信息条目对象
70 | */
71 | + (instancetype)messageWithTitle:(NSString *)title
72 | digest:(NSString *)digest
73 | imageURL:(NSString *)imageURL
74 | url:(NSString *)url
75 | extra:(NSString *)extra;
76 |
77 | @end
78 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCRichContentMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCRichContentMessage.h
11 | // Created by Gang Li on 10/17/14.
12 |
13 | #import "RCMessageContent.h"
14 | #import
15 |
16 | /*!
17 | 图文消息的类型名
18 | */
19 | #define RCRichContentMessageTypeIdentifier @"RC:ImgTextMsg"
20 |
21 | /*!
22 | 图文消息类
23 |
24 | @discussion 图文消息类,此消息会进行存储并计入未读消息数。
25 | */
26 | @interface RCRichContentMessage : RCMessageContent
27 |
28 | /*!
29 | 图文消息的标题
30 | */
31 | @property(nonatomic, strong) NSString *title;
32 |
33 | /*!
34 | 图文消息的内容摘要
35 | */
36 | @property(nonatomic, strong) NSString *digest;
37 |
38 | /*!
39 | 图文消息图片URL
40 | */
41 | @property(nonatomic, strong) NSString *imageURL;
42 |
43 | /*!
44 | 图文消息中包含的需要跳转到的URL
45 | */
46 | @property(nonatomic, strong) NSString *url;
47 |
48 | /*!
49 | 图文消息的扩展信息
50 | */
51 | @property(nonatomic, strong) NSString *extra;
52 |
53 | /*!
54 | 初始化图文消息
55 |
56 | @param title 图文消息的标题
57 | @param digest 图文消息的内容摘要
58 | @param imageURL 图文消息的图片URL
59 | @param extra 图文消息的扩展信息
60 | @return 图文消息对象
61 | */
62 | + (instancetype)messageWithTitle:(NSString *)title
63 | digest:(NSString *)digest
64 | imageURL:(NSString *)imageURL
65 | extra:(NSString *)extra;
66 |
67 | /*!
68 | 初始化图文消息
69 |
70 | @param title 图文消息的标题
71 | @param digest 图文消息的内容摘要
72 | @param imageURL 图文消息的图片URL
73 | @param url 图文消息中包含的需要跳转到的URL
74 | @param extra 图文消息的扩展信息
75 | @return 图文消息对象
76 | */
77 | + (instancetype)messageWithTitle:(NSString *)title
78 | digest:(NSString *)digest
79 | imageURL:(NSString *)imageURL
80 | url:(NSString *)url
81 | extra:(NSString *)extra;
82 |
83 | @end
84 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCStatusDefine.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCStatusDefine.h
11 | // Created by Heq.Shinoda on 14-4-21.
12 |
13 | #import
14 |
15 | #ifndef __RCStatusDefine
16 | #define __RCStatusDefine
17 |
18 | #pragma mark - 错误码相关
19 |
20 | #pragma mark RCConnectErrorCode - 建立连接返回的错误码
21 | /*!
22 | 建立连接返回的错误码
23 |
24 | @discussion
25 | 开发者仅需要关注以下几种连接错误码,其余错误码SDK均会进行自动重连,开发者无须处理。
26 | RC_CONN_ID_REJECT, RC_CONN_TOKEN_INCORRECT, RC_CONN_NOT_AUTHRORIZED,
27 | RC_CONN_PACKAGE_NAME_INVALID, RC_CONN_APP_BLOCKED_OR_DELETED,
28 | RC_CONN_USER_BLOCKED,
29 | RC_DISCONN_KICK, RC_CLIENT_NOT_INIT, RC_INVALID_PARAMETER, RC_INVALID_ARGUMENT
30 | */
31 | typedef NS_ENUM(NSInteger, RCConnectErrorCode) {
32 |
33 | /*!
34 | 连接已被释放
35 |
36 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
37 | */
38 | RC_NET_CHANNEL_INVALID = 30001,
39 |
40 | /*!
41 | 连接不可用
42 |
43 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
44 | */
45 | RC_NET_UNAVAILABLE = 30002,
46 |
47 | /*!
48 | 导航HTTP发送失败
49 |
50 | @discussion 如果是偶尔出现此错误,SDK会做好自动重连,开发者无须处理。如果一直是这个错误,应该是您没有设置好ATS。
51 | ATS默认只使用HTTPS协议,当HTTP协议被禁止时SDK会一直30004错误。您可以在我们iOS开发文档中搜索到ATS设置。
52 | */
53 | RC_NAVI_REQUEST_FAIL = 30004,
54 |
55 | /*!
56 | 导航HTTP请求失败
57 |
58 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
59 | */
60 | RC_NAVI_RESPONSE_ERROR = 30007,
61 |
62 | /*!
63 | 导航HTTP返回数据格式错误
64 |
65 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
66 | */
67 | RC_NODE_NOT_FOUND = 30008,
68 |
69 | /*!
70 | 创建Socket连接失败
71 |
72 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
73 | */
74 | RC_SOCKET_NOT_CONNECTED = 30010,
75 |
76 | /*!
77 | Socket断开
78 |
79 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
80 | */
81 | RC_SOCKET_DISCONNECTED = 30011,
82 |
83 | /*!
84 | PING失败
85 |
86 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
87 | */
88 | RC_PING_SEND_FAIL = 30012,
89 |
90 | /*!
91 | PING超时
92 |
93 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
94 | */
95 | RC_PONG_RECV_FAIL = 30013,
96 |
97 | /*!
98 | 信令发送失败
99 |
100 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
101 | */
102 | RC_MSG_SEND_FAIL = 30014,
103 |
104 | /*!
105 | 连接过于频繁
106 |
107 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
108 | */
109 | RC_CONN_OVERFREQUENCY = 30015,
110 |
111 | /*!
112 | 连接ACK超时
113 |
114 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
115 | */
116 | RC_CONN_ACK_TIMEOUT = 31000,
117 |
118 | /*!
119 | 信令版本错误
120 |
121 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
122 | */
123 | RC_CONN_PROTO_VERSION_ERROR = 31001,
124 |
125 | /*!
126 | AppKey错误
127 |
128 | @discussion 请检查您使用的AppKey是否正确。
129 | */
130 | RC_CONN_ID_REJECT = 31002,
131 |
132 | /*!
133 | 服务器当前不可用(预留)
134 |
135 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
136 | */
137 | RC_CONN_SERVER_UNAVAILABLE = 31003,
138 |
139 | /*!
140 | Token无效
141 |
142 | @discussion Token无效一般有以下两种原因。
143 | 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;
144 | 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。
145 | */
146 | RC_CONN_TOKEN_INCORRECT = 31004,
147 |
148 | /*!
149 | AppKey与Token不匹配
150 |
151 | @discussion
152 | 请检查您使用的AppKey与Token是否正确,是否匹配。一般有以下两种原因。
153 | 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;
154 | 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。
155 | */
156 | RC_CONN_NOT_AUTHRORIZED = 31005,
157 |
158 | /*!
159 | 连接重定向
160 |
161 | @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
162 | */
163 | RC_CONN_REDIRECTED = 31006,
164 |
165 | /*!
166 | BundleID不正确
167 |
168 | @discussion 请检查您App的BundleID是否正确。
169 | */
170 | RC_CONN_PACKAGE_NAME_INVALID = 31007,
171 |
172 | /*!
173 | AppKey被封禁或已删除
174 |
175 | @discussion 请检查您使用的AppKey是否正确。
176 | */
177 | RC_CONN_APP_BLOCKED_OR_DELETED = 31008,
178 |
179 | /*!
180 | 用户被封禁
181 |
182 | @discussion 请检查您使用的Token是否正确,以及对应的UserId是否被封禁。
183 | */
184 | RC_CONN_USER_BLOCKED = 31009,
185 |
186 | /*!
187 | 当前用户在其他设备上登录,此设备被踢下线
188 | */
189 | RC_DISCONN_KICK = 31010,
190 |
191 | /*!
192 | SDK没有初始化
193 |
194 | @discussion 在使用SDK任何功能之前,必须先Init。
195 | */
196 | RC_CLIENT_NOT_INIT = 33001,
197 |
198 | /*!
199 | 开发者接口调用时传入的参数错误
200 |
201 | @discussion 请检查接口调用时传入的参数类型和值。
202 | */
203 | RC_INVALID_PARAMETER = 33003,
204 |
205 | /*!
206 | Connection已经存在
207 |
208 | @discussion
209 | 调用过connect之后,只有在token错误或者被踢下线或者用户logout的情况下才需要再次调用connect。SDK会自动重连,不需要应用多次调用connect来保证连接性。
210 | */
211 | RC_CONNECTION_EXIST = 34001,
212 |
213 | /*!
214 | 开发者接口调用时传入的参数错误
215 |
216 | @discussion 请检查接口调用时传入的参数类型和值。
217 | */
218 | RC_INVALID_ARGUMENT = -1000
219 | };
220 |
221 | #pragma mark RCErrorCode - 具体业务错误码
222 | /*!
223 | 具体业务错误码
224 | */
225 | typedef NS_ENUM(NSInteger, RCErrorCode) {
226 | /*!
227 | 未知错误(预留)
228 | */
229 | ERRORCODE_UNKNOWN = -1,
230 |
231 | /*!
232 | 已被对方加入黑名单
233 | */
234 | REJECTED_BY_BLACKLIST = 405,
235 |
236 | /*!
237 | 超时
238 | */
239 | ERRORCODE_TIMEOUT = 5004,
240 |
241 | /*!
242 | 发送消息频率过高,1秒钟最多只允许发送5条消息
243 | */
244 | SEND_MSG_FREQUENCY_OVERRUN = 20604,
245 |
246 | /*!
247 | 不在该讨论组中
248 | */
249 | NOT_IN_DISCUSSION = 21406,
250 |
251 | /*!
252 | 不在该群组中
253 | */
254 | NOT_IN_GROUP = 22406,
255 |
256 | /*!
257 | 在群组中已被禁言
258 | */
259 | FORBIDDEN_IN_GROUP = 22408,
260 |
261 | /*!
262 | 不在该聊天室中
263 | */
264 | NOT_IN_CHATROOM = 23406,
265 |
266 | /*!
267 | 在该聊天室中已被禁言
268 | */
269 | FORBIDDEN_IN_CHATROOM = 23408,
270 |
271 | /*!
272 | 已被踢出聊天室
273 | */
274 | KICKED_FROM_CHATROOM = 23409,
275 |
276 | /*!
277 | 聊天室不存在
278 | */
279 | RC_CHATROOM_NOT_EXIST = 23410,
280 |
281 | /*!
282 | 聊天室成员超限
283 | */
284 | RC_CHATROOM_IS_FULL = 23411,
285 |
286 | /*!
287 | 当前连接不可用(连接已经被释放)
288 | */
289 | RC_CHANNEL_INVALID = 30001,
290 |
291 | /*!
292 | 当前连接不可用
293 | */
294 | RC_NETWORK_UNAVAILABLE = 30002,
295 |
296 | /*!
297 | 消息响应超时
298 | */
299 | RC_MSG_RESPONSE_TIMEOUT = 30003,
300 |
301 | /*!
302 | SDK没有初始化
303 |
304 | @discussion 在使用SDK任何功能之前,必须先Init。
305 | */
306 | CLIENT_NOT_INIT = 33001,
307 |
308 | /*!
309 | 数据库错误
310 |
311 | @discussion 请检查您使用的Token和userId是否正确。
312 | */
313 | DATABASE_ERROR = 33002,
314 |
315 | /*!
316 | 开发者接口调用时传入的参数错误
317 |
318 | @discussion 请检查接口调用时传入的参数类型和值。
319 | */
320 | INVALID_PARAMETER = 33003,
321 |
322 | /*!
323 | 历史消息云存储业务未开通
324 | */
325 | MSG_ROAMING_SERVICE_UNAVAILABLE = 33007,
326 |
327 | /*!
328 | 无效的公众号。(由会话类型和Id所标识的公众号会话是无效的)
329 | */
330 | INVALID_PUBLIC_NUMBER = 29201,
331 | };
332 |
333 | #pragma mark - 连接状态
334 |
335 | #pragma mark RCConnectionStatus - 网络连接状态码
336 | /*!
337 | 网络连接状态码
338 |
339 | @discussion 开发者仅需要关注以下几种连接状态,其余状态SDK均会进行自动重连。
340 | ConnectionStatus_Connected, ConnectionStatus_Connecting,
341 | ConnectionStatus_Unconnected,
342 | ConnectionStatus_SignUp, ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT,
343 | ConnectionStatus_TOKEN_INCORRECT
344 | */
345 | typedef NS_ENUM(NSInteger, RCConnectionStatus) {
346 | /*!
347 | 未知状态
348 |
349 | @discussion 建立连接中出现异常的临时状态,SDK会做好自动重连,开发者无须处理。
350 | */
351 | ConnectionStatus_UNKNOWN = -1,
352 |
353 | /*!
354 | 连接成功
355 | */
356 | ConnectionStatus_Connected = 0,
357 |
358 | /*!
359 | 当前设备网络不可用
360 |
361 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
362 | */
363 | ConnectionStatus_NETWORK_UNAVAILABLE = 1,
364 |
365 | /*!
366 | 当前设备切换到飞行模式
367 |
368 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
369 | */
370 | ConnectionStatus_AIRPLANE_MODE = 2,
371 |
372 | /*!
373 | 当前设备切换到 2G(GPRS、EDGE)低速网络
374 |
375 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
376 | */
377 | ConnectionStatus_Cellular_2G = 3,
378 |
379 | /*!
380 | 当前设备切换到 3G 或 4G 高速网络
381 |
382 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
383 | */
384 | ConnectionStatus_Cellular_3G_4G = 4,
385 |
386 | /*!
387 | 当前设备切换到 WIFI 网络
388 |
389 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
390 | */
391 | ConnectionStatus_WIFI = 5,
392 |
393 | /*!
394 | 当前用户在其他设备上登录,此设备被踢下线
395 | */
396 | ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT = 6,
397 |
398 | /*!
399 | 当前用户在 Web 端登录
400 |
401 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
402 | */
403 | ConnectionStatus_LOGIN_ON_WEB = 7,
404 |
405 | /*!
406 | 服务器异常
407 |
408 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
409 | */
410 | ConnectionStatus_SERVER_INVALID = 8,
411 |
412 | /*!
413 | 连接验证异常
414 |
415 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
416 | */
417 | ConnectionStatus_VALIDATE_INVALID = 9,
418 |
419 | /*!
420 | 连接中
421 | */
422 | ConnectionStatus_Connecting = 10,
423 |
424 | /*!
425 | 连接失败或未连接
426 | */
427 | ConnectionStatus_Unconnected = 11,
428 |
429 | /*!
430 | 已注销
431 | */
432 | ConnectionStatus_SignUp = 12,
433 |
434 | /*!
435 | Token无效
436 |
437 | @discussion
438 | Token无效一般有两种原因。一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。
439 | */
440 | ConnectionStatus_TOKEN_INCORRECT = 31004,
441 |
442 | /*!
443 | 与服务器的连接已断开
444 |
445 | @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
446 | */
447 | ConnectionStatus_DISCONN_EXCEPTION = 31011
448 | };
449 |
450 | #pragma mark RCNetworkStatus - 当前所处的网络
451 | /*!
452 | 当前所处的网络
453 | */
454 | typedef NS_ENUM(NSUInteger, RCNetworkStatus) {
455 | /*!
456 | 当前网络不可用
457 | */
458 | RC_NotReachable = 0,
459 |
460 | /*!
461 | 当前处于WiFi网络
462 | */
463 | RC_ReachableViaWiFi = 1,
464 |
465 | /*!
466 | 移动网络
467 | */
468 | RC_ReachableViaWWAN = 2,
469 |
470 | // /*!
471 | // 当前处于3G网络
472 | // */
473 | // RC_ReachableVia3G = 3,
474 | //
475 | // /*!
476 | // 当前处于2G网络
477 | // */
478 | // RC_ReachableVia2G = 4
479 | };
480 |
481 | #pragma mark RCSDKRunningMode - SDK当前所处的状态
482 | /*!
483 | SDK当前所处的状态
484 | */
485 | typedef NS_ENUM(NSUInteger, RCSDKRunningMode) {
486 | /*!
487 | 前台运行状态
488 | */
489 | RCSDKRunningMode_Backgroud = 0,
490 |
491 | /*!
492 | 后台运行状态
493 | */
494 | RCSDKRunningMode_Foregroud = 1
495 | };
496 |
497 | #pragma mark - 会话相关
498 |
499 | #pragma mark RCConversationType - 会话类型
500 | /*!
501 | 会话类型
502 | */
503 | typedef NS_ENUM(NSUInteger, RCConversationType) {
504 | /*!
505 | 单聊
506 | */
507 | ConversationType_PRIVATE = 1,
508 |
509 | /*!
510 | 讨论组
511 | */
512 | ConversationType_DISCUSSION = 2,
513 |
514 | /*!
515 | 群组
516 | */
517 | ConversationType_GROUP = 3,
518 |
519 | /*!
520 | 聊天室
521 | */
522 | ConversationType_CHATROOM = 4,
523 |
524 | /*!
525 | 客服
526 | */
527 | ConversationType_CUSTOMERSERVICE = 5,
528 |
529 | /*!
530 | 系统会话
531 | */
532 | ConversationType_SYSTEM = 6,
533 |
534 | /*!
535 | 应用内公众服务会话
536 |
537 | @discussion
538 | 客服2.0使用应用内公众服务会话(ConversationType_APPSERVICE)的方式实现。
539 | 即客服2.0会话是其中一个应用内公众服务会话,这种方式我们目前不推荐,请尽快升级到新客服,升级方法请参考官网的客服文档。
540 | */
541 | ConversationType_APPSERVICE = 7,
542 |
543 | /*!
544 | 跨应用公众服务会话
545 | */
546 | ConversationType_PUBLICSERVICE = 8,
547 |
548 | /*!
549 | 推送服务会话
550 | */
551 | ConversationType_PUSHSERVICE = 9
552 | };
553 |
554 | #pragma mark RCConversationNotificationStatus - 会话提醒状态
555 | /*!
556 | 会话提醒状态
557 | */
558 | typedef NS_ENUM(NSUInteger, RCConversationNotificationStatus) {
559 | /*!
560 | 免打扰
561 | */
562 | DO_NOT_DISTURB = 0,
563 |
564 | /*!
565 | 新消息提醒
566 | */
567 | NOTIFY = 1,
568 | };
569 |
570 | #pragma mark RCReadReceiptMessageType - 消息回执
571 | /*!
572 | 已读状态消息类型
573 | */
574 | typedef NS_ENUM(NSUInteger, RCReadReceiptMessageType) {
575 | /*!
576 | 根据会话来更新未读消息状态
577 | */
578 | RC_ReadReceipt_Conversation = 1,
579 | };
580 |
581 | #pragma mark RCChatRoomMemberOrder - 聊天室成员排列顺序
582 | /*!
583 | 聊天室成员的排列顺序
584 | */
585 | typedef NS_ENUM(NSUInteger, RCChatRoomMemberOrder) {
586 | /*!
587 | 升序,返回最早加入的成员列表
588 | */
589 | RC_ChatRoom_Member_Asc = 1,
590 |
591 | /*!
592 | 降序,返回最晚加入的成员列表
593 | */
594 | RC_ChatRoom_Member_Desc = 2,
595 | };
596 |
597 | #pragma mark - 消息相关
598 |
599 | #pragma mark RCMessagePersistent - 消息的存储策略
600 | /*!
601 | 消息的存储策略
602 | */
603 | typedef NS_ENUM(NSUInteger, RCMessagePersistent) {
604 | /*!
605 | 在本地不存储,不计入未读数
606 | */
607 | MessagePersistent_NONE = 0,
608 |
609 | /*!
610 | 在本地只存储,但不计入未读数
611 | */
612 | MessagePersistent_ISPERSISTED = 1,
613 |
614 | /*!
615 | 在本地进行存储并计入未读数
616 | */
617 | MessagePersistent_ISCOUNTED = 3,
618 |
619 | /*!
620 | 在本地不存储,不计入未读数,并且如果对方不在线,服务器会直接丢弃该消息,对方如果之后再上线也不会再收到此消息。
621 |
622 | @discussion 一般用于发送输入状态之类的消息,该类型消息的messageUId为nil。
623 | */
624 | MessagePersistent_STATUS = 16
625 | };
626 |
627 | #pragma mark RCMessageDirection - 消息的方向
628 | /*!
629 | 消息的方向
630 | */
631 | typedef NS_ENUM(NSUInteger, RCMessageDirection) {
632 | /*!
633 | 发送
634 | */
635 | MessageDirection_SEND = 1,
636 |
637 | /*!
638 | 接收
639 | */
640 | MessageDirection_RECEIVE = 2
641 | };
642 |
643 | #pragma mark RCSentStatus - 消息的发送状态
644 | /*!
645 | 消息的发送状态
646 | */
647 | typedef NS_ENUM(NSUInteger, RCSentStatus) {
648 | /*!
649 | 发送中
650 | */
651 | SentStatus_SENDING = 10,
652 |
653 | /*!
654 | 发送失败
655 | */
656 | SentStatus_FAILED = 20,
657 |
658 | /*!
659 | 已发送成功
660 | */
661 | SentStatus_SENT = 30,
662 |
663 | /*!
664 | 对方已接收
665 | */
666 | SentStatus_RECEIVED = 40,
667 |
668 | /*!
669 | 对方已阅读
670 | */
671 | SentStatus_READ = 50,
672 |
673 | /*!
674 | 对方已销毁
675 | */
676 | SentStatus_DESTROYED = 60
677 | };
678 |
679 | #pragma mark RCReceivedStatus - 消息的接收状态
680 | /*!
681 | 消息的接收状态
682 | */
683 | typedef NS_ENUM(NSUInteger, RCReceivedStatus) {
684 | /*!
685 | 未读
686 | */
687 | ReceivedStatus_UNREAD = 0,
688 |
689 | /*!
690 | 已读
691 | */
692 | ReceivedStatus_READ = 1,
693 |
694 | /*!
695 | 已听
696 |
697 | @discussion 仅用于语音消息
698 | */
699 | ReceivedStatus_LISTENED = 2,
700 |
701 | /*!
702 | 已下载
703 | */
704 | ReceivedStatus_DOWNLOADED = 4,
705 |
706 | /*!
707 | 该消息已经被其他登录的多端收取过。(即改消息已经被其他端收取过后。当前端才登录,并重新拉取了这条消息。客户可以通过这个状态更新
708 | UI,比如不再提示)。
709 | */
710 | ReceivedStatus_RETRIEVED = 8,
711 |
712 | /*!
713 | 该消息是被多端同时收取的。(即其他端正同时登录,一条消息被同时发往多端。客户可以通过这个状态值更新自己的某些
714 | UI状态)。
715 | */
716 | ReceivedStatus_MULTIPLERECEIVE = 16,
717 |
718 | };
719 |
720 | #pragma mark RCMediaType - 消息内容中多媒体文件的类型
721 | /*!
722 | 消息内容中多媒体文件的类型
723 | */
724 | typedef NS_ENUM(NSUInteger, RCMediaType) {
725 | /*!
726 | 图片
727 | */
728 | MediaType_IMAGE = 1,
729 |
730 | /*!
731 | 语音
732 | */
733 | MediaType_AUDIO = 2,
734 |
735 | /*!
736 | 视频
737 | */
738 | MediaType_VIDEO = 3,
739 |
740 | /*!
741 | 其他文件
742 | */
743 | MediaType_FILE = 4
744 | };
745 |
746 | #pragma mark RCMediaType - 消息中@提醒的类型
747 | /*!
748 | @提醒的类型
749 | */
750 | typedef NS_ENUM(NSUInteger, RCMentionedType) {
751 | /*!
752 | @所有人
753 | */
754 | RC_Mentioned_All = 1,
755 |
756 | /*!
757 | @部分指定用户
758 | */
759 | RC_Mentioned_Users = 2,
760 | };
761 |
762 | #pragma mark - 公众服务相关
763 |
764 | #pragma mark RCPublicServiceType - 公众服务账号类型
765 | /*!
766 | 公众服务账号类型
767 | */
768 | typedef NS_ENUM(NSUInteger, RCPublicServiceType) {
769 | /*!
770 | 应用内公众服务账号
771 | */
772 | RC_APP_PUBLIC_SERVICE = 7,
773 |
774 | /*!
775 | 跨应用公众服务账号
776 | */
777 | RC_PUBLIC_SERVICE = 8,
778 | };
779 |
780 | #pragma mark RCPublicServiceMenuItemType - 公众服务菜单类型
781 | /*!
782 | 公众服务菜单类型
783 | */
784 | typedef NS_ENUM(NSUInteger, RCPublicServiceMenuItemType) {
785 | /*!
786 | 包含子菜单的一组菜单
787 | */
788 | RC_PUBLIC_SERVICE_MENU_ITEM_GROUP = 0,
789 |
790 | /*!
791 | 包含查看事件的菜单
792 | */
793 | RC_PUBLIC_SERVICE_MENU_ITEM_VIEW = 1,
794 |
795 | /*!
796 | 包含点击事件的菜单
797 | */
798 | RC_PUBLIC_SERVICE_MENU_ITEM_CLICK = 2,
799 | };
800 |
801 | #pragma mark RCSearchType - 公众服务查找匹配方式
802 | /*!
803 | 公众服务查找匹配方式
804 | */
805 | typedef NS_ENUM(NSUInteger, RCSearchType) {
806 | /*!
807 | 精确匹配
808 | */
809 | RC_SEARCH_TYPE_EXACT = 0,
810 |
811 | /*!
812 | 模糊匹配
813 | */
814 | RC_SEARCH_TYPE_FUZZY = 1,
815 | };
816 |
817 | /*!
818 | 客服服务方式
819 | */
820 | typedef NS_ENUM(NSUInteger, RCCSModeType) {
821 | /*!
822 | 无客服服务
823 | */
824 | RC_CS_NoService = 0,
825 |
826 | /*!
827 | 机器人服务
828 | */
829 | RC_CS_RobotOnly = 1,
830 |
831 | /*!
832 | 人工服务
833 | */
834 | RC_CS_HumanOnly = 2,
835 |
836 | /*!
837 | 机器人优先服务
838 | */
839 | RC_CS_RobotFirst = 3,
840 | };
841 |
842 | #pragma mark RCLogLevel - 日志级别
843 | /*!
844 | 日志级别
845 | */
846 | typedef NS_ENUM(NSUInteger, RCLogLevel) {
847 | /*!
848 | * 只输出错误的日志
849 | */
850 | RC_Log_Level_Error = 1,
851 |
852 | /*!
853 | * 输出错误和警告的日志
854 | */
855 | RC_Log_Level_Warn = 2,
856 |
857 | /*!
858 | * 输出错误、警告和一般的日志
859 | */
860 | RC_Log_Level_Info = 3,
861 | };
862 |
863 |
864 | #endif
865 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCStatusMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCStatusMessage.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | @interface RCStatusMessage : RCMessageContent
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCTextMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCTextMessage.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 文本消息的类型名
17 | */
18 | #define RCTextMessageTypeIdentifier @"RC:TxtMsg"
19 |
20 | /*!
21 | 文本消息类
22 |
23 | @discussion 文本消息类,此消息会进行存储并计入未读消息数。
24 | */
25 | @interface RCTextMessage : RCMessageContent
26 |
27 | /*!
28 | 文本消息的内容
29 | */
30 | @property(nonatomic, strong) NSString *content;
31 |
32 | /*!
33 | 文本消息的附加信息
34 | */
35 | @property(nonatomic, strong) NSString *extra;
36 |
37 |
38 | /*!
39 | 初始化文本消息
40 |
41 | @param content 文本消息的内容
42 | @return 文本消息对象
43 | */
44 | + (instancetype)messageWithContent:(NSString *)content;
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCUnknownMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCUnknownMessage.h
11 | // Created by xugang on 15/1/24.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 未知消息的类型名
17 | */
18 | #define RCUnknownMessageTypeIdentifier @"RC:UnknownMsg"
19 |
20 | /*!
21 | 未知消息类
22 |
23 | @discussion 所有未注册的消息类型,在IMKit中都会作为此类消息处理和显示。
24 | */
25 | @interface RCUnknownMessage : RCMessageContent
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCUploadImageStatusListener.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCUploadImageStatusListener.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 15/8/28.
6 | // Copyright (c) 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCMessage.h"
10 | #import
11 |
12 | /*!
13 | 图片上传进度更新的IMKit监听
14 |
15 | @discussion 此监听用于IMKit发送图片消息(上传到指定服务器)。
16 | App在上传图片时,需要在监听中调用updateBlock、successBlock与errorBlock,通知IMKit
17 | SDK当前上传图片的进度和状态,SDK会更新UI。
18 | */
19 | @interface RCUploadImageStatusListener : NSObject
20 |
21 | /*!
22 | 上传的图片消息的消息实体
23 | */
24 | @property(nonatomic, strong) RCMessage *currentMessage;
25 |
26 | /*!
27 | 更新上传进度需要调用的block [progress:当前上传的进度,0 <= progress < 100]
28 | */
29 | @property(nonatomic, strong) void (^updateBlock)(int progress);
30 |
31 | /*!
32 | 上传成功需要调用的block [imageUrl:图片的网络URL]
33 | */
34 | @property(nonatomic, strong) void (^successBlock)(NSString *imageUrl);
35 |
36 | /*!
37 | 上传成功需要调用的block [errorCode:上传失败的错误码,非0整数]
38 | */
39 | @property(nonatomic, strong) void (^errorBlock)(RCErrorCode errorCode);
40 |
41 | /*!
42 | 初始化图片上传进度更新的IMKit监听
43 |
44 | @param message 图片消息的消息实体
45 | @param progressBlock 更新上传进度需要调用的block
46 | @param successBlock 上传成功需要调用的block
47 | @param errorBlock 上传失败需要调用的block
48 |
49 | @return 图片上传进度更新的IMKit监听对象
50 | */
51 | - (instancetype)initWithMessage:(RCMessage *)message
52 | uploadProgress:(void (^)(int progress))progressBlock
53 | uploadSuccess:(void (^)(NSString *imageUrl))successBlock
54 | uploadError:(void (^)(RCErrorCode errorCode))errorBlock;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCUploadMediaStatusListener.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCUploadMediaStatusListener.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 15/8/28.
6 | // Copyright (c) 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCMessage.h"
10 | #import
11 |
12 | /*!
13 | 媒体文件上传进度更新的IMKit监听
14 |
15 | @discussion 此监听用于IMKit发送媒体文件消息(上传到指定服务器)。
16 | App在上传媒体文件时,需要在监听中调用updateBlock、successBlock与errorBlock,通知IMKit
17 | SDK当前上传媒体文件的进度和状态,SDK会更新UI。
18 | */
19 | @interface RCUploadMediaStatusListener : NSObject
20 |
21 | /*!
22 | 上传的媒体文件消息的消息实体
23 | */
24 | @property(nonatomic, strong) RCMessage *currentMessage;
25 |
26 | /*!
27 | 更新上传进度需要调用的block [progress:当前上传的进度,0 <= progress < 100]
28 | */
29 | @property(nonatomic, strong) void (^updateBlock)(int progress);
30 |
31 | /*!
32 | 上传成功需要调用的block [remoteUrl:媒体文件的网络URL]
33 | */
34 | @property(nonatomic, strong) void (^successBlock)(NSString *remoteUrl);
35 |
36 | /*!
37 | 上传成功需要调用的block [errorCode:上传失败的错误码,非0整数]
38 | */
39 | @property(nonatomic, strong) void (^errorBlock)(RCErrorCode errorCode);
40 |
41 | /*!
42 | 初始化媒体文件上传进度更新的IMKit监听
43 |
44 | @param message 媒体文件消息的消息实体
45 | @param progressBlock 更新上传进度需要调用的block
46 | @param successBlock 上传成功需要调用的block
47 | @param errorBlock 上传失败需要调用的block
48 |
49 | @return 媒体文件上传进度更新的IMKit监听对象
50 | */
51 | - (instancetype)initWithMessage:(RCMessage *)message
52 | uploadProgress:(void (^)(int progress))progressBlock
53 | uploadSuccess:(void (^)(NSString *remoteUrl))successBlock
54 | uploadError:(void (^)(RCErrorCode errorCode))errorBlock;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCUserInfo.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCUserInfo.h
11 | // Created by Heq.Shinoda on 14-6-16.
12 |
13 | #import
14 |
15 | /*!
16 | 用户信息类
17 | */
18 | @interface RCUserInfo : NSObject
19 |
20 | /*!
21 | 用户ID
22 | */
23 | @property(nonatomic, strong) NSString *userId;
24 |
25 | /*!
26 | 用户名称
27 | */
28 | @property(nonatomic, strong) NSString *name;
29 |
30 | /*!
31 | 用户头像的URL
32 | */
33 | @property(nonatomic, strong) NSString *portraitUri;
34 |
35 | /*!
36 | 用户信息的初始化方法
37 |
38 | @param userId 用户ID
39 | @param username 用户名称
40 | @param portrait 用户头像的URL
41 | @return 用户信息对象
42 | */
43 | - (instancetype)initWithUserId:(NSString *)userId
44 | name:(NSString *)username
45 | portrait:(NSString *)portrait;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCUserTypingStatus.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCUserTypingStatus.h
3 | // RongIMLib
4 | //
5 | // Created by 岑裕 on 16/1/8.
6 | // Copyright © 2016年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*!
12 | 用户输入状态类
13 | */
14 | @interface RCUserTypingStatus : NSObject
15 |
16 | /*!
17 | 当前正在输入的用户ID
18 | */
19 | @property(nonatomic, strong) NSString *userId;
20 |
21 | /*!
22 | 当前正在输入的消息类型名
23 |
24 | @discussion
25 | contentType为用户当前正在编辑的消息类型名,即RCMessageContent中getObjectName的返回值。
26 | 如文本消息,应该传类型名"RC:TxtMsg"。
27 | */
28 | @property(nonatomic, strong) NSString *contentType;
29 |
30 | /*!
31 | 初始化用户输入状态对象
32 |
33 | @param userId 当前正在输入的用户ID
34 | @param objectName 当前正在输入的消息类型名
35 |
36 | @return 用户输入状态对象
37 | */
38 | - (instancetype)initWithUserId:(NSString *)userId
39 | contentType:(NSString *)objectName;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCUtilities.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCUtilities.h
11 | // Created by Heq.Shinoda on 14-5-15.
12 |
13 | #ifndef __RCUtilities
14 | #define __RCUtilities
15 |
16 | #import
17 |
18 | /*!
19 | 工具类
20 | */
21 | @interface RCUtilities : NSObject
22 |
23 | /*!
24 | 将base64编码的字符串解码并转换为NSData数据
25 |
26 | @param string base64编码的字符串
27 | @return 解码后的NSData数据
28 |
29 | @discussion 此方法主要用于iOS6解码base64。
30 | */
31 | + (NSData *)dataWithBase64EncodedString:(NSString *)string;
32 |
33 | /*!
34 | 将NSData数据转化并编码为base64的字符串
35 |
36 | @param data 未编码的NSData数据
37 | @return 编码后的base64字符串
38 |
39 | @discussion 此方法主要用于iOS6编码base64。
40 | */
41 | + (NSString *)base64EncodedStringFrom:(NSData *)data;
42 |
43 | /*!
44 | scaleImage
45 |
46 | @param image image
47 | @param scaleSize scaleSize
48 |
49 | @return scaled image
50 | */
51 | + (UIImage *)scaleImage:(UIImage *)image toScale:(float)scaleSize;
52 |
53 | /*!
54 | imageByScalingAndCropSize
55 |
56 | @param image image
57 | @param targetSize targetSize
58 |
59 | @return image
60 | */
61 | + (UIImage *)imageByScalingAndCropSize:(UIImage *)image
62 | targetSize:(CGSize)targetSize;
63 |
64 | /*!
65 | generate thumbnail from image
66 |
67 | @param image image
68 | @param targetSize targetSize
69 |
70 | @return image
71 | */
72 | + (UIImage *)generateThumbnail:(UIImage *)image
73 | targetSize:(CGSize)targetSize;
74 | /*!
75 | compressedImageWithMaxDataLength
76 |
77 | @param image image
78 | @param maxDataLength maxDataLength
79 |
80 | @return nsdate
81 | */
82 | + (NSData *)compressedImageWithMaxDataLength:(UIImage *)image
83 | maxDataLength:(CGFloat)maxDataLength;
84 |
85 | /*!
86 | compressedImageAndScalingSize
87 |
88 | @param image image
89 | @param targetSize targetSize
90 | @param maxDataLen maxDataLen
91 |
92 | @return image nsdata
93 | */
94 | + (NSData *)compressedImageAndScalingSize:(UIImage *)image
95 | targetSize:(CGSize)targetSize
96 | maxDataLen:(CGFloat)maxDataLen;
97 |
98 | /*!
99 | compressedImageAndScalingSize
100 |
101 | @param image image
102 | @param targetSize targetSize
103 | @param percent percent
104 |
105 | @return image nsdata
106 | */
107 | + (NSData *)compressedImageAndScalingSize:(UIImage *)image
108 | targetSize:(CGSize)targetSize
109 | percent:(CGFloat)percent;
110 | /*!
111 | compressedImage
112 |
113 | @param image image
114 | @param percent percent
115 |
116 | @return image nsdata
117 | */
118 | + (NSData *)compressedImage:(UIImage *)image percent:(CGFloat)percent;
119 |
120 | /*!
121 | 获取文字显示的尺寸
122 |
123 | @param text 文字
124 | @param font 字体
125 | @param size 文字显示的容器大小
126 |
127 | @return 文字显示的尺寸
128 |
129 | @discussion 该方法在计算iOS 7以下系统显示的时候默认使用NSLineBreakByTruncatingTail模式。
130 | */
131 | + (CGSize)getTextDrawingSize:(NSString *)text font:(UIFont *)font constrainedSize:(CGSize)constrainedSize;
132 |
133 | /*!
134 | 判断是否是本地路径
135 |
136 | @param path 路径
137 |
138 | @return 是否是本地路径
139 | */
140 | + (BOOL)isLocalPath:(NSString *)path;
141 |
142 | /*!
143 | 判断是否是网络地址
144 |
145 | @param url 地址
146 |
147 | @return 是否是网络地址
148 | */
149 | + (BOOL)isRemoteUrl:(NSString *)url;
150 |
151 | /*!
152 | 获取沙盒修正后的文件路径
153 |
154 | @param localPath 本地路径
155 |
156 | @return 修正后的文件路径
157 | */
158 | + (NSString *)getCorrectedFilePath:(NSString *)localPath;
159 |
160 |
161 | /*!
162 | * 获取文件存储路径
163 | */
164 | + (NSString *)getFileStoragePath;
165 |
166 | /*!
167 | excludeBackupKeyForURL
168 |
169 | @param storageURL storageURL
170 |
171 | @return BOOL
172 | */
173 | + (BOOL)excludeBackupKeyForURL:(NSURL *)storageURL;
174 |
175 | /*!
176 | 获取App的文件存放路径
177 |
178 | @return App的文件存放路径
179 | */
180 | + (NSString *)applicationDocumentsDirectory;
181 |
182 | /*!
183 | 获取融云SDK的文件存放路径
184 |
185 | @return 融云SDK的文件存放路径
186 | */
187 | + (NSString *)rongDocumentsDirectory;
188 |
189 | /*!
190 | 获取融云SDK的缓存路径
191 |
192 | @return 融云SDK的缓存路径
193 | */
194 | + (NSString *)rongImageCacheDirectory;
195 |
196 | /*!
197 | 获取当前系统时间
198 |
199 | @return 当前系统时间
200 | */
201 | + (NSString *)currentSystemTime;
202 |
203 | /*!
204 | 获取当前运营商名称
205 |
206 | @return 当前运营商名称
207 | */
208 | + (NSString *)currentCarrier;
209 |
210 | /*!
211 | 获取当前网络类型
212 |
213 | @return 当前网络类型
214 | */
215 | + (NSString *)currentNetWork;
216 |
217 | /*!
218 | 获取系统版本
219 |
220 | @return 系统版本
221 | */
222 | + (NSString *)currentSystemVersion;
223 |
224 | /*!
225 | 获取设备型号
226 |
227 | @return 设备型号
228 | */
229 | + (NSString *)currentDeviceModel;
230 |
231 | @end
232 | #endif
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCVoiceMessage.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RCVoiceMessage.h
11 | // Created by Heq.Shinoda on 14-6-13.
12 |
13 | #import "RCMessageContent.h"
14 |
15 | /*!
16 | 语音消息的类型名
17 | */
18 | #define RCVoiceMessageTypeIdentifier @"RC:VcMsg"
19 |
20 | /*!
21 | 语音消息类
22 |
23 | @discussion 语音消息类,此消息会进行存储并计入未读消息数。
24 | */
25 | @interface RCVoiceMessage : RCMessageContent
26 |
27 | /*!
28 | wav格式的音频数据
29 | */
30 | @property(nonatomic, strong) NSData *wavAudioData;
31 |
32 | /*!
33 | 语音消息的时长
34 | */
35 | @property(nonatomic, assign) long duration;
36 |
37 | /*!
38 | 语音消息的附加信息
39 | */
40 | @property(nonatomic, strong) NSString *extra;
41 |
42 | /*!
43 | 初始化语音消息
44 |
45 | @param audioData wav格式的音频数据
46 | @param duration 语音消息的时长(单位:秒)
47 | @return 语音消息对象
48 |
49 | @discussion
50 | 如果您不是使用IMKit中的录音功能,则在初始化语音消息的时候,需要确保以下几点。
51 | 1. audioData必须是单声道的wav格式音频数据;
52 | 2. audioData的采样率必须是8000Hz,采样位数(精度)必须为16位。
53 |
54 | 您可以参考IMKit中的录音参数:
55 | NSDictionary *settings = @{AVFormatIDKey: @(kAudioFormatLinearPCM),
56 | AVSampleRateKey: @8000.00f,
57 | AVNumberOfChannelsKey: @1,
58 | AVLinearPCMBitDepthKey: @16,
59 | AVLinearPCMIsNonInterleaved: @NO,
60 | AVLinearPCMIsFloatKey: @NO,
61 | AVLinearPC'MIsBigEndianKey: @NO};
62 | */
63 | + (instancetype)messageWithAudio:(NSData *)audioData duration:(long)duration;
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RCWatchKitStatusDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCWatchKitStatusDelegate.h
3 | // RongIMLib
4 | //
5 | // Created by litao on 15/6/4.
6 | // Copyright (c) 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #ifndef RongIMLib_RCwatchKitStatusDelegate_h
10 | #define RongIMLib_RCwatchKitStatusDelegate_h
11 |
12 | /*!
13 | 用于Apple Watch的IMLib事务监听器
14 |
15 | @discussion 此协议定义了IMLib在状态变化和各种活动时的回调,主要用于Apple
16 | Watch。
17 | */
18 | @protocol RCWatchKitStatusDelegate
19 |
20 | @optional
21 |
22 | #pragma mark 连接状态
23 | /*!
24 | 连接状态发生变化的回调
25 |
26 | @param status SDK与融云服务器的连接状态
27 | */
28 | - (void)notifyWatchKitConnectionStatusChanged:(RCConnectionStatus)status;
29 |
30 | #pragma mark 消息接收与发送
31 |
32 | /*!
33 | 收到消息的回调
34 |
35 | @param receivedMsg 收到的消息实体
36 | */
37 | - (void)notifyWatchKitReceivedMessage:(RCMessage *)receivedMsg;
38 |
39 | /*!
40 | 向外发送消息的回调
41 |
42 | @param message 待发送消息
43 | */
44 | - (void)notifyWatchKitSendMessage:(RCMessage *)message;
45 |
46 | /*!
47 | 发送消息完成的回调
48 |
49 | @param messageId 消息ID
50 | @param status 完成的状态吗。0表示成功,非0表示失败
51 | */
52 | - (void)notifyWatchKitSendMessageCompletion:(long)messageId
53 | status:(RCErrorCode)status;
54 |
55 | /*!
56 | 上传图片进度更新的回调
57 |
58 | @param progress 进度
59 | @param messageId 消息ID
60 | */
61 | - (void)notifyWatchKitUploadFileProgress:(int)progress
62 | messageId:(long)messageId;
63 |
64 | #pragma mark 消息与会话操作
65 | /*!
66 | 删除会话的回调
67 |
68 | @param conversationTypeList 会话类型的数组
69 | */
70 | - (void)notifyWatchKitClearConversations:(NSArray *)conversationTypeList;
71 |
72 | /*!
73 | 删除消息的回调
74 |
75 | @param conversationType 会话类型
76 | @param targetId 目标会话ID
77 | */
78 | - (void)notifyWatchKitClearMessages:(RCConversationType)conversationType
79 | targetId:(NSString *)targetId;
80 |
81 | /*!
82 | 删除消息的回调
83 |
84 | @param messageIds 消息ID的数组
85 | */
86 | - (void)notifyWatchKitDeleteMessages:(NSArray *)messageIds;
87 |
88 | /*!
89 | 清除未读消息数的回调
90 |
91 | @param conversationType 会话类型
92 | @param targetId 目标会话ID
93 | */
94 | - (void)notifyWatchKitClearUnReadStatus:(RCConversationType)conversationType
95 | targetId:(NSString *)targetId;
96 |
97 | #pragma mark 讨论组
98 |
99 | /*!
100 | 创建讨论组的回调
101 |
102 | @param name 讨论组名称
103 | @param userIdList 成员的用户ID列表
104 | */
105 | - (void)notifyWatchKitCreateDiscussion:(NSString *)name
106 | userIdList:(NSArray *)userIdList;
107 |
108 | /*!
109 | 创建讨论组成功的回调
110 |
111 | @param discussionId 讨论组的ID
112 | */
113 | - (void)notifyWatchKitCreateDiscussionSuccess:(NSString *)discussionId;
114 |
115 | /*!
116 | 创建讨论组失败
117 |
118 | @param errorCode 创建失败的错误码
119 | */
120 | - (void)notifyWatchKitCreateDiscussionError:(RCErrorCode)errorCode;
121 |
122 | /*!
123 | 讨论组加人的回调
124 |
125 | @param discussionId 讨论组的ID
126 | @param userIdList 添加成员的用户ID列表
127 |
128 | @discussion 加人的结果可以通过notifyWatchKitDiscussionOperationCompletion获得。
129 | */
130 | - (void)notifyWatchKitAddMemberToDiscussion:(NSString *)discussionId
131 | userIdList:(NSArray *)userIdList;
132 |
133 | /*!
134 | 讨论组踢人的回调
135 |
136 | @param discussionId 讨论组ID
137 | @param userId 用户ID
138 |
139 | @discussion 踢人的结果可以通过notifyWatchKitDiscussionOperationCompletion获得。
140 | */
141 | - (void)notifyWatchKitRemoveMemberFromDiscussion:(NSString *)discussionId
142 | userId:(NSString *)userId;
143 |
144 | /*!
145 | 退出讨论组的回调
146 |
147 | @param discussionId 讨论组ID
148 |
149 | @discussion 创建的结果可以通过notifyWatchKitDiscussionOperationCompletion获得。
150 | */
151 | - (void)notifyWatchKitQuitDiscussion:(NSString *)discussionId;
152 |
153 | /*!
154 | 讨论组操作的回调。tag:100-邀请;101-踢人;102-退出。status:0成功,非0失败
155 |
156 | @param tag 讨论组的操作类型。100为加人,101为踢人,102为退出
157 | @param status 操作的结果。0表示成功,非0表示失败
158 | */
159 | - (void)notifyWatchKitDiscussionOperationCompletion:(int)tag
160 | status:(RCErrorCode)status;
161 |
162 | @end
163 | #endif
164 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/RongIMLib.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-2015, RongCloud.
3 | * All rights reserved.
4 | *
5 | * All the contents are the copyright of RongCloud Network Technology Co.Ltd.
6 | * Unless otherwise credited. http://rongcloud.cn
7 | *
8 | */
9 |
10 | // RongIMLib.h
11 | // Created by xugang on 14/12/11.
12 |
13 | #import
14 |
15 | //! Project version number for RongIMLib.
16 | FOUNDATION_EXPORT double RongIMLibVersionNumber;
17 |
18 | //! Project version string for RongIMLib.
19 | FOUNDATION_EXPORT const unsigned char RongIMLibVersionString[];
20 |
21 | /// IMLib核心类
22 | #import
23 | #import
24 | /// 会话相关类
25 | #import
26 | #import
27 | #import
28 | #import
29 | #import
30 | /// 消息相关类
31 | #import
32 | #import
33 | #import
34 | #import
35 | #import
36 | #import
37 | #import
38 | #import
39 | #import
40 | #import
41 | #import
42 | #import
43 | #import
44 | #import
45 | #import
46 | #import
47 | #import
48 | #import
49 | #import
50 | #import
51 | #import
52 | #import
53 | /// 工具类
54 | #import
55 | #import
56 | #import
57 | #import
58 |
59 | ///客服
60 | #import
61 | #import
62 |
63 | /// 其他
64 | #import
65 | #import
66 | #import
67 | #import
68 | #import
69 | #import
70 | #import
71 | #import
72 | #import
73 | #import
74 |
75 | #import
76 | #import
77 | #import
78 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/interf_dec.h:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRNB_INTERF_DEC_H
20 | #define OPENCORE_AMRNB_INTERF_DEC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | void *Decoder_Interface_init(void);
27 | void Decoder_Interface_exit(void *state);
28 | void Decoder_Interface_Decode(void *state, const unsigned char *in, short *out,
29 | int bfi);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Headers/interf_enc.h:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRNB_INTERF_ENC_H
20 | #define OPENCORE_AMRNB_INTERF_ENC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #ifndef AMRNB_WRAPPER_INTERNAL
27 | /* Copied from enc/src/gsmamr_enc.h */
28 | enum Mode {
29 | MR475 = 0, /* 4.75 kbps */
30 | MR515, /* 5.15 kbps */
31 | MR59, /* 5.90 kbps */
32 | MR67, /* 6.70 kbps */
33 | MR74, /* 7.40 kbps */
34 | MR795, /* 7.95 kbps */
35 | MR102, /* 10.2 kbps */
36 | MR122, /* 12.2 kbps */
37 | MRDTX, /* DTX */
38 | N_MODES /* Not Used */
39 | };
40 | #endif
41 |
42 | void *Encoder_Interface_init(int dtx);
43 | void Encoder_Interface_exit(void *state);
44 | int Encoder_Interface_Encode(void *state, enum Mode mode, const short *speech,
45 | unsigned char *out, int forceSpeech);
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/ios/RongCloudSDK/RongIMLib.framework/Info.plist
--------------------------------------------------------------------------------
/ios/RongCloudSDK/RongIMLib.framework/RongIMLib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/ios/RongCloudSDK/RongIMLib.framework/RongIMLib
--------------------------------------------------------------------------------
/ios/RongCloudSDK/libopencore-amrnb.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/reactnativecn/react-native-rong-imlib/d4f7b7fe7e444e91f92c36037703df6cc8ee53f6/ios/RongCloudSDK/libopencore-amrnb.a
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-rong-imlib",
3 | "version": "0.1.7",
4 | "description": "React Native下的融云SDK (IMLib) 封装",
5 | "main": "src/index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/reactnativecn/react-native-rong-imlib.git"
12 | },
13 | "keywords": [
14 | "react",
15 | "native",
16 | "ios",
17 | "android",
18 | "rong",
19 | "im",
20 | "chat"
21 | ],
22 | "author": "reactnativecn",
23 | "license": "ISC",
24 | "bugs": {
25 | "url": "https://github.com/reactnativecn/react-native-rong-imlib/issues"
26 | },
27 | "peerDependencies": {
28 | "react-native": ">=0.18.0"
29 | },
30 | "homepage": "https://github.com/reactnativecn/react-native-rong-imlib#readme",
31 | "dependencies": {
32 | "fbemitter": "^2.0.2"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by tdzl2003 on 4/13/16.
3 | */
4 |
5 | import {NativeModules, NativeAppEventEmitter} from 'react-native';
6 | import {EventEmitter} from 'fbemitter';
7 |
8 | const RongIMLib = NativeModules.RongIMLib;
9 |
10 | const eventEmitter = new EventEmitter();
11 | Object.assign(exports, RongIMLib);
12 |
13 | exports.eventEmitter = eventEmitter;
14 | exports.addListener = eventEmitter.addListener.bind(eventEmitter);
15 | exports.once = eventEmitter.once.bind(eventEmitter);
16 | exports.removeAllListeners = eventEmitter.removeAllListeners.bind(eventEmitter);
17 | exports.removeCurrentListener = eventEmitter.removeCurrentListener.bind(eventEmitter);
18 |
19 | NativeAppEventEmitter.addListener('rongIMMsgRecved', msg => {
20 | eventEmitter.emit('msgRecved', msg);
21 | });
22 |
23 | NativeAppEventEmitter.addListener('rongIMConnectionStatus', msg => {
24 | eventEmitter.emit('connectionStatus', msg);
25 | });
26 |
--------------------------------------------------------------------------------