createViewManagers(ReactApplicationContext reactContext) {
25 | return Collections.emptyList();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/SendMsgCallBack.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.facebook.react.bridge.ReadableMap;
5 | import com.openimsdkrn.utils.Emitter;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.bridge.WritableMap;
8 | import com.facebook.react.bridge.Arguments;
9 | import com.facebook.react.bridge.Promise;
10 |
11 | public class SendMsgCallBack extends Emitter implements open_im_sdk_callback.SendMsgCallBack {
12 | final ReactApplicationContext ctx;
13 | final private Promise promise;
14 | final private ReadableMap message;
15 |
16 | public SendMsgCallBack(ReactApplicationContext ctx, Promise promise, ReadableMap message) {
17 | this.ctx = ctx;
18 | this.promise = promise;
19 | this.message = message;
20 | }
21 |
22 | @Override
23 | public void onError(int ErrCode, String ErrString) {
24 | promise.reject(String.valueOf(ErrCode), ErrString);
25 | }
26 |
27 | @Override
28 | public void onProgress(long progress) {
29 | WritableMap params = Arguments.createMap();
30 | params.putInt("progress", (int) progress);
31 | params.putMap("message", Arguments.makeNativeMap(message.toHashMap()));
32 | send(ctx, "SendMessageProgress", params);
33 | }
34 |
35 | @Override
36 | public void onSuccess(String s) {
37 | promise.resolve(convertJsonToMap(JSON.parseObject(s)));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/AdvancedMsgListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.facebook.react.bridge.ReactApplicationContext;
4 |
5 | import com.openimsdkrn.utils.Emitter;
6 | import open_im_sdk_callback.OnAdvancedMsgListener;
7 |
8 | public class AdvancedMsgListener extends Emitter implements OnAdvancedMsgListener {
9 | private final ReactApplicationContext ctx;
10 | public AdvancedMsgListener(ReactApplicationContext ctx){
11 | this.ctx = ctx;
12 | }
13 |
14 |
15 | @Override
16 | public void onMsgDeleted(String s) {
17 | send(ctx,"onMsgDeleted",jsonStringToMap(s));
18 | }
19 |
20 | @Override
21 | public void onNewRecvMessageRevoked(String s) {
22 | send(ctx,"onNewRecvMessageRevoked",jsonStringToMap(s));
23 | }
24 |
25 | @Override
26 | public void onRecvC2CReadReceipt(String s) {
27 | send(ctx,"onRecvC2CReadReceipt",jsonStringToArray(s));
28 | }
29 |
30 | @Override
31 | public void onRecvNewMessage(String s) {
32 | send(ctx,"onRecvNewMessage",jsonStringToMap(s));
33 | }
34 |
35 | @Override
36 | public void onRecvOfflineNewMessage(String s) {
37 | send(ctx,"onRecvOfflineNewMessage",jsonStringToMap(s));
38 | }
39 |
40 | @Override
41 | public void onRecvOnlineOnlyMessage(String s) {
42 | send(ctx,"onRecvOnlineOnlyMessage",jsonStringToMap(s));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/BatchMsgListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.alibaba.fastjson.JSONArray;
5 | import com.alibaba.fastjson.JSONObject;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.bridge.WritableArray;
8 | import com.facebook.react.bridge.WritableNativeArray;
9 | import com.facebook.react.modules.core.DeviceEventManagerModule;
10 | import com.openimsdkrn.utils.Emitter;
11 |
12 | import open_im_sdk_callback.OnBatchMsgListener;
13 |
14 | public class BatchMsgListener extends Emitter implements OnBatchMsgListener {
15 | private final ReactApplicationContext ctx;
16 |
17 | public BatchMsgListener(ReactApplicationContext ctx) {
18 | this.ctx = ctx;
19 | }
20 |
21 | @Override
22 | public void onRecvNewMessages(String s) {
23 | send(ctx,"onRecvNewMessages",jsonStringToArray(s));
24 | }
25 |
26 | @Override
27 | public void onRecvOfflineNewMessages(String s) {
28 | send(ctx,"onRecvOfflineNewMessages",jsonStringToArray(s));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/InitSDKListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import android.util.Log;
4 |
5 | import com.facebook.react.bridge.Arguments;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.bridge.WritableMap;
8 |
9 | import com.facebook.react.bridge.WritableNativeMap;
10 | import com.openimsdkrn.utils.Emitter;
11 |
12 | import open_im_sdk_callback.OnConnListener;
13 |
14 | public class InitSDKListener extends Emitter implements OnConnListener {
15 | private final ReactApplicationContext ctx;
16 |
17 | public InitSDKListener(ReactApplicationContext ctx) {
18 | this.ctx = ctx;
19 | }
20 |
21 | @Override
22 | public void onConnectFailed(int errCode, String errMsg) {
23 | WritableMap params = Arguments.createMap();
24 | params.putInt("errCode", (int) errCode);
25 | params.putString("errMsg", errMsg);
26 | send(ctx, "onConnectFailed", params);
27 | }
28 |
29 | @Override
30 | public void onConnectSuccess() {
31 | send(ctx, "onConnectSuccess", null);
32 | }
33 |
34 | @Override
35 | public void onConnecting() {
36 | send(ctx, "onConnecting", null);
37 | }
38 |
39 | @Override
40 | public void onKickedOffline() {
41 | send(ctx, "onKickedOffline", null);
42 | }
43 |
44 | @Override
45 | public void onUserTokenExpired() {
46 | send(ctx, "onUserTokenExpired", null);
47 | }
48 |
49 | @Override
50 | public void onUserTokenInvalid(String s) {
51 | send(ctx, "onUserTokenInvalid", null);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/OnConversationListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.facebook.react.bridge.Arguments;
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 |
6 | import com.facebook.react.bridge.WritableMap;
7 | import com.openimsdkrn.utils.Emitter;
8 |
9 |
10 | public class OnConversationListener extends Emitter implements open_im_sdk_callback.OnConversationListener {
11 | private final ReactApplicationContext ctx;
12 |
13 | public OnConversationListener(ReactApplicationContext ctx) {
14 | this.ctx = ctx;
15 | }
16 |
17 |
18 | @Override
19 | public void onConversationChanged(String s) {
20 | send(ctx, "onConversationChanged", jsonStringToArray(s));
21 | }
22 |
23 | @Override
24 | public void onConversationUserInputStatusChanged(String s) {
25 | send(ctx, "onInputStatusChanged", jsonStringToMap(s));
26 | }
27 |
28 | @Override
29 | public void onNewConversation(String s) {
30 | send(ctx, "onNewConversation", jsonStringToArray(s));
31 | }
32 |
33 | @Override
34 | public void onSyncServerFailed(boolean b) {
35 | send(ctx, "onSyncServerFailed", b);
36 | }
37 |
38 | @Override
39 | public void onSyncServerFinish(boolean b) {
40 | send(ctx, "onSyncServerFinish", b);
41 | }
42 |
43 | @Override
44 | public void onSyncServerStart(boolean b) {
45 | send(ctx, "onSyncServerStart", b);
46 | }
47 |
48 | @Override
49 | public void onSyncServerProgress(long l) {
50 | int intValue = (int) l;
51 | send(ctx, "onSyncServerProgress", intValue);
52 | }
53 |
54 | @Override
55 | public void onTotalUnreadMessageCountChanged(int i) {
56 | send(ctx, "onTotalUnreadMessageCountChanged", i);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/OnFriendshipListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.facebook.react.bridge.ReactApplicationContext;
4 |
5 | import com.openimsdkrn.utils.Emitter;
6 |
7 | public class OnFriendshipListener extends Emitter implements open_im_sdk_callback.OnFriendshipListener {
8 | private final ReactApplicationContext ctx;
9 | public OnFriendshipListener(ReactApplicationContext ctx) {
10 | this.ctx = ctx;
11 | }
12 |
13 |
14 | @Override
15 | public void onBlackAdded(String s) {
16 | send(ctx,"onBlackAdded",jsonStringToMap(s));
17 | }
18 |
19 | @Override
20 | public void onBlackDeleted(String s) {
21 | send(ctx,"onBlackDeleted",jsonStringToMap(s));
22 | }
23 |
24 | @Override
25 | public void onFriendAdded(String s) {
26 | send(ctx,"onFriendAdded",jsonStringToMap(s));
27 | }
28 |
29 | @Override
30 | public void onFriendApplicationAccepted(String s) {
31 | send(ctx,"onFriendApplicationAccepted",jsonStringToMap(s));
32 | }
33 |
34 | @Override
35 | public void onFriendApplicationAdded(String s) {
36 | send(ctx,"onFriendApplicationAdded",jsonStringToMap(s));
37 | }
38 |
39 | @Override
40 | public void onFriendApplicationDeleted(String s) {
41 | send(ctx,"onFriendApplicationDeleted",jsonStringToMap(s));
42 | }
43 |
44 | @Override
45 | public void onFriendApplicationRejected(String s) {
46 | send(ctx,"onFriendApplicationRejected",jsonStringToMap(s));
47 | }
48 |
49 | @Override
50 | public void onFriendDeleted(String s) {
51 | send(ctx,"onFriendDeleted",jsonStringToMap(s));
52 | }
53 |
54 | @Override
55 | public void onFriendInfoChanged(String s) {
56 | send(ctx,"onFriendInfoChanged",jsonStringToMap(s));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/OnGroupListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.facebook.react.bridge.Arguments;
5 | import com.facebook.react.bridge.Callback;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.bridge.WritableMap;
8 |
9 | import java.util.HashMap;
10 | import java.util.Map;
11 |
12 | import com.openimsdkrn.utils.Emitter;
13 |
14 | public class OnGroupListener extends Emitter implements open_im_sdk_callback.OnGroupListener {
15 |
16 | private final ReactApplicationContext ctx;
17 |
18 | public OnGroupListener(ReactApplicationContext ctx){
19 | this.ctx = ctx;
20 | }
21 |
22 |
23 | @Override
24 | public void onGroupApplicationAccepted(String s) {
25 | send(ctx,"onGroupApplicationAccepted",jsonStringToMap(s));
26 | }
27 |
28 | @Override
29 | public void onGroupApplicationAdded(String s) {
30 | send(ctx,"onGroupApplicationAdded",jsonStringToMap(s));
31 | }
32 |
33 | @Override
34 | public void onGroupApplicationDeleted(String s) {
35 | send(ctx,"onGroupApplicationDeleted",jsonStringToMap(s));
36 | }
37 |
38 | @Override
39 | public void onGroupApplicationRejected(String s) {
40 | send(ctx,"onGroupApplicationRejected",jsonStringToMap(s));
41 | }
42 |
43 | @Override
44 | public void onGroupDismissed(String s) {
45 | send(ctx,"onGroupDismissed",jsonStringToMap(s));
46 | }
47 |
48 | @Override
49 | public void onGroupInfoChanged(String s) {
50 | send(ctx,"onGroupInfoChanged",jsonStringToMap(s));
51 | }
52 |
53 | @Override
54 | public void onGroupMemberAdded(String s) {
55 | send(ctx,"onGroupMemberAdded",jsonStringToMap(s));
56 | }
57 |
58 | @Override
59 | public void onGroupMemberDeleted(String s) {
60 | send(ctx,"onGroupMemberDeleted",jsonStringToMap(s));
61 | }
62 |
63 | @Override
64 | public void onGroupMemberInfoChanged(String s) {
65 | send(ctx,"onGroupMemberInfoChanged",jsonStringToMap(s));
66 | }
67 |
68 | @Override
69 | public void onJoinedGroupAdded(String s) {
70 | send(ctx,"onJoinedGroupAdded",jsonStringToMap(s));
71 | }
72 |
73 | @Override
74 | public void onJoinedGroupDeleted(String s) {
75 | send(ctx,"onJoinedGroupDeleted",jsonStringToMap(s));
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/OnSignalingListener.java:
--------------------------------------------------------------------------------
1 | //package com.openimsdkrn.listener;
2 | //
3 | //import com.facebook.react.bridge.ReactApplicationContext;
4 | //import com.openimsdkrn.utils.Emitter;
5 | //
6 | //
7 | //public class OnSignalingListener extends Emitter implements open_im_sdk_callback.OnSignalingListener {
8 | // private final ReactApplicationContext ctx;
9 | //
10 | // public OnSignalingListener(ReactApplicationContext ctx){
11 | // this.ctx = ctx;
12 | // }
13 | //
14 | //
15 | // @Override
16 | // public void onHangUp(String s) {
17 | // send(ctx,"onHangUp",getParams(0,"",s));
18 | // }
19 | //
20 | // @Override
21 | // public void onInvitationCancelled(String s) {
22 | // send(ctx,"onInvitationCancelled",getParams(0,"",s));
23 | // }
24 | //
25 | // @Override
26 | // public void onInvitationTimeout(String s) {
27 | // send(ctx,"onInvitationTimeout",getParams(0,"",s));
28 | // }
29 | //
30 | // @Override
31 | // public void onInviteeAccepted(String s) {
32 | // send(ctx,"onInviteeAccepted",getParams(0,"",s));
33 | // }
34 | //
35 | // @Override
36 | // public void onInviteeAcceptedByOtherDevice(String s) {
37 | // send(ctx,"onInviteeAcceptedByOtherDevice",getParams(0,"",s));
38 | // }
39 | //
40 | // @Override
41 | // public void onInviteeRejected(String s) {
42 | // send(ctx,"onInviteeRejected",getParams(0,"",s));
43 | // }
44 | //
45 | // @Override
46 | // public void onInviteeRejectedByOtherDevice(String s) {
47 | // send(ctx,"onInviteeRejectedByOtherDevice",getParams(0,"",s));
48 | // }
49 | //
50 | // @Override
51 | // public void onReceiveNewInvitation(String s) {
52 | // send(ctx,"onReceiveNewInvitation",getParams(0,"",s));
53 | // }
54 | //
55 | // @Override
56 | // public void onRoomParticipantConnected(String s) {
57 | //
58 | // }
59 | //
60 | // @Override
61 | // public void onRoomParticipantDisconnected(String s) {
62 | //
63 | // }
64 | //}
65 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/SetCustomBusinessListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.facebook.react.bridge.ReactApplicationContext;
4 | import com.openimsdkrn.utils.Emitter;
5 |
6 | import open_im_sdk_callback.OnCustomBusinessListener;
7 |
8 | public class SetCustomBusinessListener extends Emitter implements OnCustomBusinessListener {
9 | private final ReactApplicationContext ctx;
10 |
11 | public SetCustomBusinessListener(ReactApplicationContext ctx) {
12 | this.ctx = ctx;
13 | }
14 |
15 | @Override
16 | public void onRecvCustomBusinessMessage(String s) {
17 | send(ctx,"onRecvCustomBusinessMessage",jsonStringToMap(s));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/UploadFileCallbackListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.facebook.react.bridge.Arguments;
5 | import com.facebook.react.bridge.ReactApplicationContext;
6 | import com.facebook.react.bridge.WritableMap;
7 | import com.facebook.react.bridge.WritableNativeMap;
8 | import com.openimsdkrn.utils.Emitter;
9 |
10 | import open_im_sdk_callback.UploadFileCallback;
11 |
12 | public class UploadFileCallbackListener extends Emitter implements UploadFileCallback {
13 | private final ReactApplicationContext ctx;
14 | private final String operationID;
15 | public UploadFileCallbackListener(ReactApplicationContext ctx,String operationID){
16 | this.ctx = ctx;
17 | this.operationID = operationID;
18 | }
19 |
20 | @Override
21 | public void complete(long l, String s, long l1) {
22 |
23 | }
24 |
25 | @Override
26 | public void hashPartComplete(String s, String s1) {
27 |
28 | }
29 |
30 | @Override
31 | public void hashPartProgress(long l, long l1, String s) {
32 |
33 | }
34 |
35 | @Override
36 | public void open(long l) {
37 |
38 | }
39 |
40 | @Override
41 | public void partSize(long l, long l1) {
42 |
43 | }
44 |
45 | @Override
46 | public void uploadComplete(long l, long l1, long l2) {
47 | WritableMap params = Arguments.createMap();WritableMap data = new WritableNativeMap();
48 | data.putInt("fileSize", (int) l);
49 | data.putInt("streamSize", (int) l1);
50 | data.putInt("storageSize", (int) l2);
51 | data.putString("operationID", operationID);
52 | params.putMap("data", data);
53 | send(ctx,"uploadComplete",params);
54 | }
55 |
56 | @Override
57 | public void uploadID(String s) {
58 |
59 | }
60 |
61 | @Override
62 | public void uploadPartComplete(long l, long l1, String s) {
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/UploadLogProgressListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.facebook.react.bridge.Arguments;
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 | import com.facebook.react.bridge.WritableMap;
6 | import com.openimsdkrn.utils.Emitter;
7 |
8 | import open_im_sdk_callback.UploadLogProgress;
9 |
10 | public class UploadLogProgressListener extends Emitter implements UploadLogProgress {
11 | private final ReactApplicationContext ctx;
12 | private final String operationID;
13 | public UploadLogProgressListener(ReactApplicationContext ctx, String operationID) {
14 | this.ctx = ctx;
15 | this.operationID = operationID;
16 | }
17 |
18 | @Override
19 | public void onProgress(long l, long l1) {
20 | WritableMap params = Arguments.createMap();
21 | params.putInt("current", (int) l);
22 | params.putInt("size", (int) l1);
23 | params.putString("operationID", operationID);
24 | send(ctx,"uploadOnProgress",params);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/listener/UserListener.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.listener;
2 |
3 | import com.facebook.react.bridge.ReactApplicationContext;
4 | import com.openimsdkrn.utils.Emitter;
5 |
6 | import open_im_sdk_callback.OnUserListener;
7 |
8 | public class UserListener extends Emitter implements OnUserListener {
9 | private final ReactApplicationContext ctx;
10 |
11 | public UserListener(ReactApplicationContext ctx) {
12 | this.ctx = ctx;
13 | }
14 |
15 | @Override
16 | public void onSelfInfoUpdated(String s) {
17 | send(ctx, "onSelfInfoUpdated", jsonStringToMap(s));
18 | }
19 |
20 | @Override
21 | public void onUserCommandAdd(String s) {
22 |
23 | }
24 |
25 | @Override
26 | public void onUserCommandDelete(String s) {
27 |
28 | }
29 |
30 | @Override
31 | public void onUserCommandUpdate(String s) {
32 |
33 | }
34 |
35 | @Override
36 | public void onUserStatusChanged(String s) {
37 | send(ctx, "onUserStatusChanged", jsonStringToMap(s));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/android/src/main/java/com/openimsdkrn/utils/Emitter.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrn.utils;
2 |
3 | import androidx.annotation.Nullable;
4 |
5 | import com.alibaba.fastjson.JSON;
6 | import com.alibaba.fastjson.JSONArray;
7 | import com.alibaba.fastjson.JSONObject;
8 | import com.facebook.react.bridge.Arguments;
9 | import com.facebook.react.bridge.ReactContext;
10 | import com.facebook.react.bridge.ReadableMap;
11 | import com.facebook.react.bridge.WritableArray;
12 | import com.facebook.react.bridge.WritableMap;
13 |
14 | import com.facebook.react.bridge.WritableNativeArray;
15 | import com.facebook.react.modules.core.DeviceEventManagerModule;
16 |
17 | import java.math.BigDecimal;
18 |
19 |
20 | public class Emitter {
21 | public void send(ReactContext reactContext, String eventName, @Nullable Object params) {
22 | reactContext
23 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
24 | .emit(eventName, params);
25 | }
26 |
27 | public WritableMap jsonStringToMap(String data) {
28 | JSONObject parsedData = JSON.parseObject(data);
29 | return convertJsonToMap(parsedData);
30 | }
31 |
32 | public WritableArray jsonStringToArray(String data) {
33 | JSONArray parsedArray = JSON.parseArray(data);
34 | WritableArray dataArray = new WritableNativeArray();
35 | for (Object item : parsedArray) {
36 | dataArray.pushMap(convertJsonToMap((JSONObject) item));
37 | }
38 |
39 | return dataArray;
40 | }
41 |
42 | public WritableMap convertJsonToMap(JSONObject jsonObject) {
43 | WritableMap writableMap = Arguments.createMap();
44 | for (String key : jsonObject.keySet()) {
45 | Object value = jsonObject.get(key);
46 | if (value instanceof String) {
47 | writableMap.putString(key, (String) value);
48 | } else if (value instanceof Integer) {
49 | writableMap.putInt(key, (Integer) value);
50 | } else if (value instanceof Long) {
51 | writableMap.putDouble(key, ((Long) value).doubleValue());
52 | } else if (value instanceof BigDecimal) {
53 | BigDecimal bd = (BigDecimal) value;
54 | try {
55 | writableMap.putInt(key, bd.intValueExact());
56 | } catch (ArithmeticException e) {
57 | writableMap.putDouble(key, bd.doubleValue());
58 | }
59 | } else if (value instanceof Boolean) {
60 | writableMap.putBoolean(key, (Boolean) value);
61 | } else if (value instanceof JSONObject) {
62 | writableMap.putMap(key, convertJsonToMap((JSONObject) value));
63 | } else if (value instanceof JSONArray) {
64 | writableMap.putArray(key, convertJsonToArray((JSONArray) value));
65 | } else {
66 | writableMap.putNull(key);
67 | }
68 | }
69 | return writableMap;
70 | }
71 |
72 | public WritableArray convertJsonToArray(JSONArray jsonArray) {
73 | WritableArray writableArray = Arguments.createArray();
74 | for (int i = 0; i < jsonArray.size(); i++) {
75 | Object item = jsonArray.get(i);
76 | if (item instanceof JSONObject) {
77 | writableArray.pushMap(convertJsonToMap((JSONObject) item));
78 | } else if (item instanceof JSONArray) {
79 | writableArray.pushArray(convertJsonToArray((JSONArray) item));
80 | } else if (item instanceof String) {
81 | writableArray.pushString((String) item);
82 | } else if (item instanceof Integer) {
83 | writableArray.pushInt((Integer) item);
84 | } else if (item instanceof Long) {
85 | writableArray.pushDouble(((Long) item).doubleValue());
86 | } else if (item instanceof Double) {
87 | writableArray.pushDouble((Double) item);
88 | } else if (item instanceof Boolean) {
89 | writableArray.pushBoolean((Boolean) item);
90 | } else {
91 | writableArray.pushNull();
92 | }
93 | }
94 | return writableArray;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/example/.bundle/config:
--------------------------------------------------------------------------------
1 | BUNDLE_PATH: "vendor/bundle"
2 | BUNDLE_FORCE_RUBY_PLATFORM: 1
3 |
--------------------------------------------------------------------------------
/example/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/example/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4 | ruby ">= 2.6.10"
5 |
6 | gem 'cocoapods', '~> 1.12'
7 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2 |
3 | # Getting Started
4 |
5 | > **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
6 |
7 | ## Step 1: Start the Metro Server
8 |
9 | First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
10 |
11 | To start Metro, run the following command from the _root_ of your React Native project:
12 |
13 | ```bash
14 | # using npm
15 | npm start
16 |
17 | # OR using Yarn
18 | yarn start
19 | ```
20 |
21 | ## Step 2: Start your Application
22 |
23 | Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
24 |
25 | ### For Android
26 |
27 | ```bash
28 | # using npm
29 | npm run android
30 |
31 | # OR using Yarn
32 | yarn android
33 | ```
34 |
35 | ### For iOS
36 |
37 | ```bash
38 | # using npm
39 | npm run ios
40 |
41 | # OR using Yarn
42 | yarn ios
43 | ```
44 |
45 | If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
46 |
47 | This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
48 |
49 | ## Step 3: Modifying your App
50 |
51 | Now that you have successfully run the app, let's modify it.
52 |
53 | 1. Open `App.tsx` in your text editor of choice and edit some lines.
54 | 2. For **Android**: Press the R key twice or select **"Reload"** from the **Developer Menu** (Ctrl + M (on Window and Linux) or Cmd ⌘ + M (on macOS)) to see your changes!
55 |
56 | For **iOS**: Hit Cmd ⌘ + R in your iOS Simulator to reload the app and see your changes!
57 |
58 | ## Congratulations! :tada:
59 |
60 | You've successfully run and modified your React Native App. :partying_face:
61 |
62 | ### Now what?
63 |
64 | - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65 | - If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
66 |
67 | # Troubleshooting
68 |
69 | If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
70 |
71 | # Learn More
72 |
73 | To learn more about React Native, take a look at the following resources:
74 |
75 | - [React Native Website](https://reactnative.dev) - learn more about React Native.
76 | - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
77 | - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
78 | - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
79 | - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
80 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 | apply plugin: "com.facebook.react"
3 |
4 | /**
5 | * This is the configuration block to customize your React Native Android app.
6 | * By default you don't need to apply any configuration, just uncomment the lines you need.
7 | */
8 | react {
9 | /* Folders */
10 | // The root of your project, i.e. where "package.json" lives. Default is '..'
11 | // root = file("../")
12 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native
13 | // reactNativeDir = file("../node_modules/react-native")
14 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
15 | // codegenDir = file("../node_modules/@react-native/codegen")
16 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
17 | // cliFile = file("../node_modules/react-native/cli.js")
18 |
19 | /* Variants */
20 | // The list of variants to that are debuggable. For those we're going to
21 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
22 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
23 | // debuggableVariants = ["liteDebug", "prodDebug"]
24 |
25 | /* Bundling */
26 | // A list containing the node command and its flags. Default is just 'node'.
27 | // nodeExecutableAndArgs = ["node"]
28 | //
29 | // The command to run when bundling. By default is 'bundle'
30 | // bundleCommand = "ram-bundle"
31 | //
32 | // The path to the CLI configuration file. Default is empty.
33 | // bundleConfig = file(../rn-cli.config.js)
34 | //
35 | // The name of the generated asset file containing your JS bundle
36 | // bundleAssetName = "MyApplication.android.bundle"
37 | //
38 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
39 | // entryFile = file("../js/MyApplication.android.js")
40 | //
41 | // A list of extra flags to pass to the 'bundle' commands.
42 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
43 | // extraPackagerArgs = []
44 |
45 | /* Hermes Commands */
46 | // The hermes compiler command to run. By default it is 'hermesc'
47 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
48 | //
49 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
50 | // hermesFlags = ["-O", "-output-source-map"]
51 | }
52 |
53 | /**
54 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
55 | */
56 | def enableProguardInReleaseBuilds = false
57 |
58 | /**
59 | * The preferred build flavor of JavaScriptCore (JSC)
60 | *
61 | * For example, to use the international variant, you can use:
62 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
63 | *
64 | * The international variant includes ICU i18n library and necessary data
65 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
66 | * give correct results when using with locales other than en-US. Note that
67 | * this variant is about 6MiB larger per architecture than default.
68 | */
69 | def jscFlavor = 'org.webkit:android-jsc:+'
70 |
71 | android {
72 | ndkVersion rootProject.ext.ndkVersion
73 |
74 | compileSdkVersion rootProject.ext.compileSdkVersion
75 | buildToolsVersion "30.0.3"
76 |
77 | namespace "com.openimsdkrnexample"
78 | defaultConfig {
79 | applicationId "com.openimsdkrnexample"
80 | minSdkVersion rootProject.ext.minSdkVersion
81 | targetSdkVersion rootProject.ext.targetSdkVersion
82 | versionCode 1
83 | versionName "1.0"
84 | }
85 | signingConfigs {
86 | debug {
87 | storeFile file('debug.keystore')
88 | storePassword 'android'
89 | keyAlias 'androiddebugkey'
90 | keyPassword 'android'
91 | }
92 | }
93 | buildTypes {
94 | debug {
95 | signingConfig signingConfigs.debug
96 | }
97 | release {
98 | // Caution! In production, you need to generate your own keystore file.
99 | // see https://reactnative.dev/docs/signed-apk-android.
100 | signingConfig signingConfigs.debug
101 | minifyEnabled enableProguardInReleaseBuilds
102 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
103 | }
104 | }
105 | }
106 |
107 | dependencies {
108 | // The version of react-native is set by the React Native Gradle Plugin
109 | implementation("com.facebook.react:react-android")
110 |
111 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
112 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
113 | exclude group:'com.squareup.okhttp3', module:'okhttp'
114 | }
115 |
116 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
117 | if (hermesEnabled.toBoolean()) {
118 | implementation("com.facebook.react:hermes-android")
119 | } else {
120 | implementation jscFlavor
121 | }
122 | }
123 |
124 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
125 |
--------------------------------------------------------------------------------
/example/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/debug.keystore
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/java/com/openimsdkrnexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.openimsdkrnexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21 | import com.facebook.react.ReactInstanceEventListener;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | /**
28 | * Class responsible of loading Flipper inside your React Native application. This is the debug
29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30 | */
31 | public class ReactNativeFlipper {
32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33 | if (FlipperUtils.shouldEnableFlipper(context)) {
34 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
35 |
36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37 | client.addPlugin(new DatabasesFlipperPlugin(context));
38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39 | client.addPlugin(CrashReporterPlugin.getInstance());
40 |
41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42 | NetworkingModule.setCustomClientBuilder(
43 | new NetworkingModule.CustomClientBuilder() {
44 | @Override
45 | public void apply(OkHttpClient.Builder builder) {
46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47 | }
48 | });
49 | client.addPlugin(networkFlipperPlugin);
50 | client.start();
51 |
52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53 | // Hence we run if after all native modules have been initialized
54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55 | if (reactContext == null) {
56 | reactInstanceManager.addReactInstanceEventListener(
57 | new ReactInstanceEventListener() {
58 | @Override
59 | public void onReactContextInitialized(ReactContext reactContext) {
60 | reactInstanceManager.removeReactInstanceEventListener(this);
61 | reactContext.runOnNativeModulesQueueThread(
62 | new Runnable() {
63 | @Override
64 | public void run() {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | });
68 | }
69 | });
70 | } else {
71 | client.addPlugin(new FrescoFlipperPlugin());
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/openimsdkrnexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrnexample;
2 |
3 | import com.facebook.react.ReactActivity;
4 | import com.facebook.react.ReactActivityDelegate;
5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate;
7 |
8 | public class MainActivity extends ReactActivity {
9 |
10 | /**
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule
12 | * rendering of the component.
13 | */
14 | @Override
15 | protected String getMainComponentName() {
16 | return "OpenImSdkRnExample";
17 | }
18 |
19 | /**
20 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
21 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
22 | * (aka React 18) with two boolean flags.
23 | */
24 | @Override
25 | protected ReactActivityDelegate createReactActivityDelegate() {
26 | return new DefaultReactActivityDelegate(
27 | this,
28 | getMainComponentName(),
29 | // If you opted-in for the New Architecture, we enable the Fabric Renderer.
30 | DefaultNewArchitectureEntryPoint.getFabricEnabled());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/openimsdkrnexample/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.openimsdkrnexample;
2 |
3 | import android.app.Application;
4 | import com.facebook.react.PackageList;
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9 | import com.facebook.react.defaults.DefaultReactNativeHost;
10 | import com.facebook.soloader.SoLoader;
11 | import com.openimsdkrn.OpenImSdkRnPackage;
12 |
13 | import java.util.List;
14 |
15 | public class MainApplication extends Application implements ReactApplication {
16 |
17 | private final ReactNativeHost mReactNativeHost =
18 | new DefaultReactNativeHost(this) {
19 | @Override
20 | public boolean getUseDeveloperSupport() {
21 | return BuildConfig.DEBUG;
22 | }
23 |
24 | @Override
25 | protected List getPackages() {
26 | @SuppressWarnings("UnnecessaryLocalVariable")
27 | List packages = new PackageList(this).getPackages();
28 | // Packages that cannot be autolinked yet can be added manually here, for example:
29 | // packages.add(new OpenImSdkRnPackage());
30 | return packages;
31 | }
32 |
33 | @Override
34 | protected String getJSMainModuleName() {
35 | return "index";
36 | }
37 |
38 | @Override
39 | protected boolean isNewArchEnabled() {
40 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
41 | }
42 |
43 | @Override
44 | protected Boolean isHermesEnabled() {
45 | return BuildConfig.IS_HERMES_ENABLED;
46 | }
47 | };
48 |
49 | @Override
50 | public ReactNativeHost getReactNativeHost() {
51 | return mReactNativeHost;
52 | }
53 |
54 | @Override
55 | public void onCreate() {
56 | super.onCreate();
57 | SoLoader.init(this, /* native exopackage */ false);
58 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
59 | // If you opted-in for the New Architecture, we load the native entry point for this app.
60 | DefaultNewArchitectureEntryPoint.load();
61 | }
62 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | OpenImSdkRnExample
3 |
4 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/android/app/src/release/java/com/openimsdkrnexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.openimsdkrnexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "33.0.0"
6 | minSdkVersion = 21
7 | compileSdkVersion = 33
8 | targetSdkVersion = 33
9 |
10 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
11 | ndkVersion = "23.1.7779620"
12 | }
13 | repositories {
14 | google()
15 | mavenCentral()
16 | }
17 | dependencies {
18 | classpath("com.android.tools.build:gradle")
19 | classpath("com.facebook.react:react-native-gradle-plugin")
20 | }
21 | }
22 | allprojects {
23 | repositories {
24 | google()
25 | mavenCentral()
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | FLIPPER_VERSION=0.182.0
29 |
30 | # Use this property to specify which architecture you want to build.
31 | # You can also override it from the CLI using
32 | # ./gradlew -PreactNativeArchitectures=x86_64
33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 |
35 | # Use this property to enable support to the new architecture.
36 | # This will allow you to use TurboModules and the Fabric render in
37 | # your application. You should enable this flag either if you want
38 | # to write custom TurboModules/Fabric components OR use libraries that
39 | # are providing them.
40 | newArchEnabled=false
41 |
42 | # Use this property to enable or disable the Hermes JS engine.
43 | # If set to false, you will be using JSC instead.
44 | hermesEnabled=true
45 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openimsdk/open-im-sdk-reactnative/ad4169bed6778c60bf1e887fad9952fdd5288dcc/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
4 | networkTimeout=10000
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147 | # shellcheck disable=SC3045
148 | MAX_FD=$( ulimit -H -n ) ||
149 | warn "Could not query maximum file descriptor limit"
150 | esac
151 | case $MAX_FD in #(
152 | '' | soft) :;; #(
153 | *)
154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155 | # shellcheck disable=SC3045
156 | ulimit -n "$MAX_FD" ||
157 | warn "Could not set maximum file descriptor limit to $MAX_FD"
158 | esac
159 | fi
160 |
161 | # Collect all arguments for the java command, stacking in reverse order:
162 | # * args from the command line
163 | # * the main class name
164 | # * -classpath
165 | # * -D...appname settings
166 | # * --module-path (only if needed)
167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
168 |
169 | # For Cygwin or MSYS, switch paths to Windows format before running java
170 | if "$cygwin" || "$msys" ; then
171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
173 |
174 | JAVACMD=$( cygpath --unix "$JAVACMD" )
175 |
176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
177 | for arg do
178 | if
179 | case $arg in #(
180 | -*) false ;; # don't mess with options #(
181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
182 | [ -e "$t" ] ;; #(
183 | *) false ;;
184 | esac
185 | then
186 | arg=$( cygpath --path --ignore --mixed "$arg" )
187 | fi
188 | # Roll the args list around exactly as many times as the number of
189 | # args, so each arg winds up back in the position where it started, but
190 | # possibly modified.
191 | #
192 | # NB: a `for` loop captures its iteration list before it begins, so
193 | # changing the positional parameters here affects neither the number of
194 | # iterations, nor the values presented in `arg`.
195 | shift # remove old arg
196 | set -- "$@" "$arg" # push replacement arg
197 | done
198 | fi
199 |
200 | # Collect all arguments for the java command;
201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202 | # shell script including quotes and variable substitutions, so put them in
203 | # double quotes to make sure that they get re-expanded; and
204 | # * put everything else in single quotes, so that it's not re-expanded.
205 |
206 | set -- \
207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
208 | -classpath "$CLASSPATH" \
209 | org.gradle.wrapper.GradleWrapperMain \
210 | "$@"
211 |
212 | # Stop when "xargs" is not available.
213 | if ! command -v xargs >/dev/null 2>&1
214 | then
215 | die "xargs is not available"
216 | fi
217 |
218 | # Use "xargs" to parse quoted args.
219 | #
220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
221 | #
222 | # In Bash we could simply go:
223 | #
224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
225 | # set -- "${ARGS[@]}" "$@"
226 | #
227 | # but POSIX shell has neither arrays nor command substitution, so instead we
228 | # post-process each arg (as a line of input to sed) to backslash-escape any
229 | # character that might be a shell metacharacter, then use eval to reverse
230 | # that process (while maintaining the separation between arguments), and wrap
231 | # the whole thing up as a single "set" statement.
232 | #
233 | # This will of course break if any of these variables contains a newline or
234 | # an unmatched quote.
235 | #
236 |
237 | eval "set -- $(
238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
239 | xargs -n1 |
240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
241 | tr '\n' ' '
242 | )" '"$@"'
243 |
244 | exec "$JAVACMD" "$@"
245 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/example/android/hs_err_pid20108.log:
--------------------------------------------------------------------------------
1 | #
2 | # There is insufficient memory for the Java Runtime Environment to continue.
3 | # Native memory allocation (mmap) failed to map 260046848 bytes for G1 virtual space
4 | # Possible reasons:
5 | # The system is out of physical RAM or swap space
6 | # The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
7 | # Possible solutions:
8 | # Reduce memory load on the system
9 | # Increase physical memory or swap space
10 | # Check if swap backing store is full
11 | # Decrease Java heap size (-Xmx/-Xms)
12 | # Decrease number of Java threads
13 | # Decrease Java thread stack sizes (-Xss)
14 | # Set larger code cache with -XX:ReservedCodeCacheSize=
15 | # JVM is running with Zero Based Compressed Oops mode in which the Java heap is
16 | # placed in the first 32GB address space. The Java Heap base address is the
17 | # maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
18 | # to set the Java Heap base and to place the Java Heap above 32GB virtual address.
19 | # This output file may be truncated or incomplete.
20 | #
21 | # Out of Memory Error (os_windows.cpp:3550), pid=20108, tid=19564
22 | #
23 | # JRE version: (17.0.8+9) (build )
24 | # Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.8+9-LTS-211, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
25 | # No core dump will be written. Minidumps are not enabled by default on client versions of Windows
26 | #
27 |
28 | --------------- S U M M A R Y ------------
29 |
30 | Command Line:
31 |
32 | Host: AMD Ryzen 7 5700G with Radeon Graphics , 16 cores, 15G, Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
33 | Time: Tue Dec 26 12:19:44 2023 Windows 11 , 64 bit Build 22621 (10.0.22621.2506) elapsed time: 0.117696 seconds (0d 0h 0m 0s)
34 |
35 | --------------- T H R E A D ---------------
36 |
37 | Current thread (0x0000018f0fbd0b60): JavaThread "Unknown thread" [_thread_in_vm, id=19564, stack(0x0000000d92600000,0x0000000d92700000)]
38 |
39 | Stack: [0x0000000d92600000,0x0000000d92700000]
40 | Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
41 | V [jvm.dll+0x677d0a]
42 | V [jvm.dll+0x7d8c54]
43 | V [jvm.dll+0x7da3fe]
44 | V [jvm.dll+0x7daa63]
45 | V [jvm.dll+0x245c5f]
46 | V [jvm.dll+0x674bb9]
47 | V [jvm.dll+0x6694f2]
48 | V [jvm.dll+0x3031d6]
49 | V [jvm.dll+0x30a756]
50 | V [jvm.dll+0x359f9e]
51 | V [jvm.dll+0x35a1cf]
52 | V [jvm.dll+0x2da3e8]
53 | V [jvm.dll+0x2db354]
54 | V [jvm.dll+0x7aa711]
55 | V [jvm.dll+0x367b51]
56 | V [jvm.dll+0x789979]
57 | V [jvm.dll+0x3eb05f]
58 | V [jvm.dll+0x3ecae1]
59 | C [jli.dll+0x5297]
60 | C [ucrtbase.dll+0x29363]
61 | C [KERNEL32.DLL+0x1257d]
62 | C [ntdll.dll+0x5aa58]
63 |
64 |
65 | --------------- P R O C E S S ---------------
66 |
67 | Threads class SMR info:
68 | _java_thread_list=0x00007ff8b45759d8, length=0, elements={
69 | }
70 |
71 | Java Threads: ( => current thread )
72 |
73 | Other Threads:
74 | 0x0000018f0fc39550 GCTaskThread "GC Thread#0" [stack: 0x0000000d92700000,0x0000000d92800000] [id=18256]
75 | 0x0000018f0fc4a280 ConcurrentGCThread "G1 Main Marker" [stack: 0x0000000d92800000,0x0000000d92900000] [id=19864]
76 | 0x0000018f0fc4cba0 ConcurrentGCThread "G1 Conc#0" [stack: 0x0000000d92900000,0x0000000d92a00000] [id=17636]
77 |
78 | [error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8b3dab047]
79 |
80 | VM state: not at safepoint (not fully initialized)
81 |
82 | VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
83 | [0x0000018f0fbca6c0] Heap_lock - owner thread: 0x0000018f0fbd0b60
84 |
85 | Heap address: 0x0000000709a00000, size: 3942 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
86 |
87 | CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 1.
88 | Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0
89 |
90 | GC Precious Log:
91 |
92 |
93 | Heap:
94 | garbage-first heap total 0K, used 0K [0x0000000709a00000, 0x0000000800000000)
95 | region size 2048K, 0 young (0K), 0 survivors (0K)
96 |
97 | [error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8b4191499]
98 |
99 | GC Heap History (0 events):
100 | No events
101 |
102 | Deoptimization events (0 events):
103 | No events
104 |
105 | Classes unloaded (0 events):
106 | No events
107 |
108 | Classes redefined (0 events):
109 | No events
110 |
111 | Internal exceptions (0 events):
112 | No events
113 |
114 | VM Operations (0 events):
115 | No events
116 |
117 | Events (1 events):
118 | Event: 0.100 Loaded shared library D:\java sdk\jdk-17.0.8\bin\java.dll
119 |
120 |
121 | Dynamic libraries:
122 | 0x00007ff788310000 - 0x00007ff788320000 D:\java sdk\jdk-17.0.8\bin\java.exe
123 | 0x00007ff921c10000 - 0x00007ff921e27000 C:\Windows\SYSTEM32\ntdll.dll
124 | 0x00007ff920960000 - 0x00007ff920a24000 C:\Windows\System32\KERNEL32.DLL
125 | 0x00007ff91f0a0000 - 0x00007ff91f446000 C:\Windows\System32\KERNELBASE.dll
126 | 0x00007ff91f840000 - 0x00007ff91f951000 C:\Windows\System32\ucrtbase.dll
127 | 0x00007ff8b8060000 - 0x00007ff8b8079000 D:\java sdk\jdk-17.0.8\bin\jli.dll
128 | 0x00007ff8b5dd0000 - 0x00007ff8b5deb000 D:\java sdk\jdk-17.0.8\bin\VCRUNTIME140.dll
129 | 0x00007ff9204b0000 - 0x00007ff920561000 C:\Windows\System32\ADVAPI32.dll
130 | 0x00007ff91f960000 - 0x00007ff91fa07000 C:\Windows\System32\msvcrt.dll
131 | 0x00007ff91fc00000 - 0x00007ff91fca5000 C:\Windows\System32\sechost.dll
132 | 0x00007ff920c60000 - 0x00007ff920d77000 C:\Windows\System32\RPCRT4.dll
133 | 0x00007ff920dd0000 - 0x00007ff920f7e000 C:\Windows\System32\USER32.dll
134 | 0x00007ff91f640000 - 0x00007ff91f666000 C:\Windows\System32\win32u.dll
135 | 0x00007ff904f70000 - 0x00007ff905203000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100\COMCTL32.dll
136 | 0x00007ff920da0000 - 0x00007ff920dc9000 C:\Windows\System32\GDI32.dll
137 | 0x00007ff91ef80000 - 0x00007ff91f098000 C:\Windows\System32\gdi32full.dll
138 | 0x00007ff91f7a0000 - 0x00007ff91f83a000 C:\Windows\System32\msvcp_win.dll
139 | 0x00007ff917050000 - 0x00007ff91705a000 C:\Windows\SYSTEM32\VERSION.dll
140 | 0x00007ff91fcd0000 - 0x00007ff91fd01000 C:\Windows\System32\IMM32.DLL
141 | 0x00007ff9035d0000 - 0x00007ff9035dc000 D:\java sdk\jdk-17.0.8\bin\vcruntime140_1.dll
142 | 0x00007ff8b46a0000 - 0x00007ff8b472e000 D:\java sdk\jdk-17.0.8\bin\msvcp140.dll
143 | 0x00007ff8b3ac0000 - 0x00007ff8b469e000 D:\java sdk\jdk-17.0.8\bin\server\jvm.dll
144 | 0x00007ff9218e0000 - 0x00007ff9218e8000 C:\Windows\System32\PSAPI.DLL
145 | 0x00007ff91c210000 - 0x00007ff91c219000 C:\Windows\SYSTEM32\WSOCK32.dll
146 | 0x00007ff915ce0000 - 0x00007ff915d14000 C:\Windows\SYSTEM32\WINMM.dll
147 | 0x00007ff920ff0000 - 0x00007ff921061000 C:\Windows\System32\WS2_32.dll
148 | 0x00007ff91df60000 - 0x00007ff91df78000 C:\Windows\SYSTEM32\kernel.appcore.dll
149 | 0x00007ff902da0000 - 0x00007ff902daa000 D:\java sdk\jdk-17.0.8\bin\jimage.dll
150 | 0x00007ff9180d0000 - 0x00007ff918303000 C:\Windows\SYSTEM32\DBGHELP.DLL
151 | 0x00007ff9205d0000 - 0x00007ff920959000 C:\Windows\System32\combase.dll
152 | 0x00007ff91fb20000 - 0x00007ff91fbf7000 C:\Windows\System32\OLEAUT32.dll
153 | 0x00007ff909d00000 - 0x00007ff909d32000 C:\Windows\SYSTEM32\dbgcore.DLL
154 | 0x00007ff91f5c0000 - 0x00007ff91f63a000 C:\Windows\System32\bcryptPrimitives.dll
155 | 0x00007ff8b3a90000 - 0x00007ff8b3ab5000 D:\java sdk\jdk-17.0.8\bin\java.dll
156 |
157 | dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
158 | symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;D:\java sdk\jdk-17.0.8\bin;C:\Windows\SYSTEM32;C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100;D:\java sdk\jdk-17.0.8\bin\server
159 |
160 | VM Arguments:
161 | java_command:
162 | java_class_path (initial):
163 | Launcher Type: SUN_STANDARD
164 |
165 | [Global flags]
166 | intx CICompilerCount = 12 {product} {ergonomic}
167 | uint ConcGCThreads = 3 {product} {ergonomic}
168 | uint G1ConcRefinementThreads = 13 {product} {ergonomic}
169 | size_t G1HeapRegionSize = 2097152 {product} {ergonomic}
170 | uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
171 | size_t InitialHeapSize = 260046848 {product} {ergonomic}
172 | size_t MarkStackSize = 4194304 {product} {ergonomic}
173 | size_t MaxHeapSize = 4133486592 {product} {ergonomic}
174 | size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic}
175 | size_t MinHeapSize = 8388608 {product} {ergonomic}
176 | uintx NonNMethodCodeHeapSize = 7602480 {pd product} {ergonomic}
177 | uintx NonProfiledCodeHeapSize = 122027880 {pd product} {ergonomic}
178 | uintx ProfiledCodeHeapSize = 122027880 {pd product} {ergonomic}
179 | uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic}
180 | bool SegmentedCodeCache = true {product} {ergonomic}
181 | size_t SoftMaxHeapSize = 4133486592 {manageable} {ergonomic}
182 | bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
183 | bool UseCompressedOops = true {product lp64_product} {ergonomic}
184 | bool UseG1GC = true {product} {ergonomic}
185 | bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
186 |
187 | Logging:
188 | Log output configuration:
189 | #0: stdout all=warning uptime,level,tags
190 | #1: stderr all=off uptime,level,tags
191 |
192 | Environment Variables:
193 | PATH=C:\Users\Admin\Desktop\open-im-sdk-reactnative\example\node_modules\.bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\example\node_modules\.bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\node_modules\.bin;C:\Users\Admin\Desktop\node_modules\.bin;C:\Users\Admin\node_modules\.bin;C:\Users\node_modules\.bin;C:\node_modules\.bin;C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\node-gyp-bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\example\node_modules\.bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\node_modules\.bin;C:\Users\Admin\Desktop\node_modules\.bin;C:\Users\Admin\node_modules\.bin;C:\Users\node_modules\.bin;C:\node_modules\.bin;C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\node-gyp-bin;D:\software\vmware\bin\;C:\Windows\system32 w10zj.com;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\go sdk\bin;D:\java sdk\jdk-17.0.8\bin;D:\MySQL\MySQL\bin;D:\go sdk\bin;C:\Windows\System32;C:\windows\System32;D:\software\Git\cmd;D:\software\Git\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Users\Admin\AppData\Local\Programs\Python\Launcher\;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;D:\software\GoLand 2023.2\bin;;C:\Users\Admin\go\bin;C:\Program Files\RedPanda-Cpp\MinGW64\bin;D:\software\Git\bin;D:\software\GoLand 2023.2\bin;C:\Program Files (x86)\Tencent\QQGameTempest\Hall.57938\;C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Admin\AppData\Roaming\npm;C:\Users\Admin\AppData\Local\GitHubDesktop\bin;
194 | USERNAME=Admin
195 | OS=Windows_NT
196 | PROCESSOR_IDENTIFIER=AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD
197 |
198 |
199 |
200 | --------------- S Y S T E M ---------------
201 |
202 | OS:
203 | Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
204 | OS uptime: 0 days 2:55 hours
205 |
206 | CPU: total 16 (initial active 16) (16 cores per cpu, 2 threads per core) family 25 model 80 stepping 0 microcode 0x0, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt
207 |
208 | Memory: 4k page, system-wide physical 15763M (617M free)
209 | TotalPageFile size 23946M (AvailPageFile size 146M)
210 | current process WorkingSet (physical memory assigned to process): 11M, peak: 11M
211 | current process commit charge ("private bytes"): 70M, peak: 318M
212 |
213 | vm_info: Java HotSpot(TM) 64-Bit Server VM (17.0.8+9-LTS-211) for windows-amd64 JRE (17.0.8+9-LTS-211), built on Jun 14 2023 10:34:31 by "mach5one" with MS VC++ 17.1 (VS2022)
214 |
215 | END.
216 |
--------------------------------------------------------------------------------
/example/android/hs_err_pid22216.log:
--------------------------------------------------------------------------------
1 | #
2 | # There is insufficient memory for the Java Runtime Environment to continue.
3 | # Native memory allocation (mmap) failed to map 260046848 bytes for G1 virtual space
4 | # Possible reasons:
5 | # The system is out of physical RAM or swap space
6 | # The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
7 | # Possible solutions:
8 | # Reduce memory load on the system
9 | # Increase physical memory or swap space
10 | # Check if swap backing store is full
11 | # Decrease Java heap size (-Xmx/-Xms)
12 | # Decrease number of Java threads
13 | # Decrease Java thread stack sizes (-Xss)
14 | # Set larger code cache with -XX:ReservedCodeCacheSize=
15 | # JVM is running with Zero Based Compressed Oops mode in which the Java heap is
16 | # placed in the first 32GB address space. The Java Heap base address is the
17 | # maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
18 | # to set the Java Heap base and to place the Java Heap above 32GB virtual address.
19 | # This output file may be truncated or incomplete.
20 | #
21 | # Out of Memory Error (os_windows.cpp:3550), pid=22216, tid=20456
22 | #
23 | # JRE version: (17.0.8+9) (build )
24 | # Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.8+9-LTS-211, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
25 | # No core dump will be written. Minidumps are not enabled by default on client versions of Windows
26 | #
27 |
28 | --------------- S U M M A R Y ------------
29 |
30 | Command Line:
31 |
32 | Host: AMD Ryzen 7 5700G with Radeon Graphics , 16 cores, 15G, Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
33 | Time: Tue Dec 26 14:36:39 2023 Windows 11 , 64 bit Build 22621 (10.0.22621.2506) elapsed time: 0.010172 seconds (0d 0h 0m 0s)
34 |
35 | --------------- T H R E A D ---------------
36 |
37 | Current thread (0x000002e7bcc607f0): JavaThread "Unknown thread" [_thread_in_vm, id=20456, stack(0x000000fcfa100000,0x000000fcfa200000)]
38 |
39 | Stack: [0x000000fcfa100000,0x000000fcfa200000]
40 | Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
41 | V [jvm.dll+0x677d0a]
42 | V [jvm.dll+0x7d8c54]
43 | V [jvm.dll+0x7da3fe]
44 | V [jvm.dll+0x7daa63]
45 | V [jvm.dll+0x245c5f]
46 | V [jvm.dll+0x674bb9]
47 | V [jvm.dll+0x6694f2]
48 | V [jvm.dll+0x3031d6]
49 | V [jvm.dll+0x30a756]
50 | V [jvm.dll+0x359f9e]
51 | V [jvm.dll+0x35a1cf]
52 | V [jvm.dll+0x2da3e8]
53 | V [jvm.dll+0x2db354]
54 | V [jvm.dll+0x7aa711]
55 | V [jvm.dll+0x367b51]
56 | V [jvm.dll+0x789979]
57 | V [jvm.dll+0x3eb05f]
58 | V [jvm.dll+0x3ecae1]
59 | C [jli.dll+0x5297]
60 | C [ucrtbase.dll+0x29363]
61 | C [KERNEL32.DLL+0x1257d]
62 | C [ntdll.dll+0x5aa58]
63 |
64 |
65 | --------------- P R O C E S S ---------------
66 |
67 | Threads class SMR info:
68 | _java_thread_list=0x00007ff87dec59d8, length=0, elements={
69 | }
70 |
71 | Java Threads: ( => current thread )
72 |
73 | Other Threads:
74 | 0x000002e7bccc8490 GCTaskThread "GC Thread#0" [stack: 0x000000fcfa200000,0x000000fcfa300000] [id=18572]
75 | 0x000002e7bccd8a20 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000fcfa300000,0x000000fcfa400000] [id=22932]
76 | 0x000002e7bccdbae0 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000fcfa400000,0x000000fcfa500000] [id=460]
77 |
78 | [error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff87d6fb047]
79 |
80 | VM state: not at safepoint (not fully initialized)
81 |
82 | VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
83 | [0x000002e7bcc5f900] Heap_lock - owner thread: 0x000002e7bcc607f0
84 |
85 | Heap address: 0x0000000709a00000, size: 3942 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
86 |
87 | CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 1.
88 | Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0
89 |
90 | GC Precious Log:
91 |
92 |
93 | Heap:
94 | garbage-first heap total 0K, used 0K [0x0000000709a00000, 0x0000000800000000)
95 | region size 2048K, 0 young (0K), 0 survivors (0K)
96 |
97 | [error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff87dae1499]
98 |
99 | GC Heap History (0 events):
100 | No events
101 |
102 | Deoptimization events (0 events):
103 | No events
104 |
105 | Classes unloaded (0 events):
106 | No events
107 |
108 | Classes redefined (0 events):
109 | No events
110 |
111 | Internal exceptions (0 events):
112 | No events
113 |
114 | VM Operations (0 events):
115 | No events
116 |
117 | Events (1 events):
118 | Event: 0.006 Loaded shared library D:\java sdk\jdk-17.0.8\bin\java.dll
119 |
120 |
121 | Dynamic libraries:
122 | 0x00007ff7b9890000 - 0x00007ff7b98a0000 D:\java sdk\jdk-17.0.8\bin\java.exe
123 | 0x00007ff921c10000 - 0x00007ff921e27000 C:\Windows\SYSTEM32\ntdll.dll
124 | 0x00007ff920960000 - 0x00007ff920a24000 C:\Windows\System32\KERNEL32.DLL
125 | 0x00007ff91f0a0000 - 0x00007ff91f446000 C:\Windows\System32\KERNELBASE.dll
126 | 0x00007ff91f840000 - 0x00007ff91f951000 C:\Windows\System32\ucrtbase.dll
127 | 0x00007ff910a00000 - 0x00007ff910a19000 D:\java sdk\jdk-17.0.8\bin\jli.dll
128 | 0x00007ff9109e0000 - 0x00007ff9109fb000 D:\java sdk\jdk-17.0.8\bin\VCRUNTIME140.dll
129 | 0x00007ff9204b0000 - 0x00007ff920561000 C:\Windows\System32\ADVAPI32.dll
130 | 0x00007ff91f960000 - 0x00007ff91fa07000 C:\Windows\System32\msvcrt.dll
131 | 0x00007ff91fc00000 - 0x00007ff91fca5000 C:\Windows\System32\sechost.dll
132 | 0x00007ff920c60000 - 0x00007ff920d77000 C:\Windows\System32\RPCRT4.dll
133 | 0x00007ff920dd0000 - 0x00007ff920f7e000 C:\Windows\System32\USER32.dll
134 | 0x00007ff91f640000 - 0x00007ff91f666000 C:\Windows\System32\win32u.dll
135 | 0x00007ff920da0000 - 0x00007ff920dc9000 C:\Windows\System32\GDI32.dll
136 | 0x00007ff904f70000 - 0x00007ff905203000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100\COMCTL32.dll
137 | 0x00007ff91ef80000 - 0x00007ff91f098000 C:\Windows\System32\gdi32full.dll
138 | 0x00007ff91f7a0000 - 0x00007ff91f83a000 C:\Windows\System32\msvcp_win.dll
139 | 0x00007ff917050000 - 0x00007ff91705a000 C:\Windows\SYSTEM32\VERSION.dll
140 | 0x00007ff91fcd0000 - 0x00007ff91fd01000 C:\Windows\System32\IMM32.DLL
141 | 0x00007ff900510000 - 0x00007ff90051c000 D:\java sdk\jdk-17.0.8\bin\vcruntime140_1.dll
142 | 0x00007ff8b34f0000 - 0x00007ff8b357e000 D:\java sdk\jdk-17.0.8\bin\msvcp140.dll
143 | 0x00007ff87d410000 - 0x00007ff87dfee000 D:\java sdk\jdk-17.0.8\bin\server\jvm.dll
144 | 0x00007ff9218e0000 - 0x00007ff9218e8000 C:\Windows\System32\PSAPI.DLL
145 | 0x00007ff915ce0000 - 0x00007ff915d14000 C:\Windows\SYSTEM32\WINMM.dll
146 | 0x00007ff91c210000 - 0x00007ff91c219000 C:\Windows\SYSTEM32\WSOCK32.dll
147 | 0x00007ff920ff0000 - 0x00007ff921061000 C:\Windows\System32\WS2_32.dll
148 | 0x00007ff91df60000 - 0x00007ff91df78000 C:\Windows\SYSTEM32\kernel.appcore.dll
149 | 0x00007ff8ffc10000 - 0x00007ff8ffc1a000 D:\java sdk\jdk-17.0.8\bin\jimage.dll
150 | 0x00007ff9180d0000 - 0x00007ff918303000 C:\Windows\SYSTEM32\DBGHELP.DLL
151 | 0x00007ff9205d0000 - 0x00007ff920959000 C:\Windows\System32\combase.dll
152 | 0x00007ff91fb20000 - 0x00007ff91fbf7000 C:\Windows\System32\OLEAUT32.dll
153 | 0x00007ff909d00000 - 0x00007ff909d32000 C:\Windows\SYSTEM32\dbgcore.DLL
154 | 0x00007ff91f5c0000 - 0x00007ff91f63a000 C:\Windows\System32\bcryptPrimitives.dll
155 | 0x00007ff8e4650000 - 0x00007ff8e4675000 D:\java sdk\jdk-17.0.8\bin\java.dll
156 |
157 | dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
158 | symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;D:\java sdk\jdk-17.0.8\bin;C:\Windows\SYSTEM32;C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2506_none_270c5ae97388e100;D:\java sdk\jdk-17.0.8\bin\server
159 |
160 | VM Arguments:
161 | java_command:
162 | java_class_path (initial):
163 | Launcher Type: SUN_STANDARD
164 |
165 | [Global flags]
166 | intx CICompilerCount = 12 {product} {ergonomic}
167 | uint ConcGCThreads = 3 {product} {ergonomic}
168 | uint G1ConcRefinementThreads = 13 {product} {ergonomic}
169 | size_t G1HeapRegionSize = 2097152 {product} {ergonomic}
170 | uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
171 | size_t InitialHeapSize = 260046848 {product} {ergonomic}
172 | size_t MarkStackSize = 4194304 {product} {ergonomic}
173 | size_t MaxHeapSize = 4133486592 {product} {ergonomic}
174 | size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic}
175 | size_t MinHeapSize = 8388608 {product} {ergonomic}
176 | uintx NonNMethodCodeHeapSize = 7602480 {pd product} {ergonomic}
177 | uintx NonProfiledCodeHeapSize = 122027880 {pd product} {ergonomic}
178 | uintx ProfiledCodeHeapSize = 122027880 {pd product} {ergonomic}
179 | uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic}
180 | bool SegmentedCodeCache = true {product} {ergonomic}
181 | size_t SoftMaxHeapSize = 4133486592 {manageable} {ergonomic}
182 | bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
183 | bool UseCompressedOops = true {product lp64_product} {ergonomic}
184 | bool UseG1GC = true {product} {ergonomic}
185 | bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
186 |
187 | Logging:
188 | Log output configuration:
189 | #0: stdout all=warning uptime,level,tags
190 | #1: stderr all=off uptime,level,tags
191 |
192 | Environment Variables:
193 | PATH=C:\Users\Admin\Desktop\open-im-sdk-reactnative\example\node_modules\.bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\example\node_modules\.bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\node_modules\.bin;C:\Users\Admin\Desktop\node_modules\.bin;C:\Users\Admin\node_modules\.bin;C:\Users\node_modules\.bin;C:\node_modules\.bin;C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\node-gyp-bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\example\node_modules\.bin;C:\Users\Admin\Desktop\open-im-sdk-reactnative\node_modules\.bin;C:\Users\Admin\Desktop\node_modules\.bin;C:\Users\Admin\node_modules\.bin;C:\Users\node_modules\.bin;C:\node_modules\.bin;C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\node-gyp-bin;D:\software\vmware\bin\;C:\Windows\system32 w10zj.com;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\go sdk\bin;D:\java sdk\jdk-17.0.8\bin;D:\MySQL\MySQL\bin;D:\go sdk\bin;C:\Windows\System32;C:\windows\System32;D:\software\Git\cmd;D:\software\Git\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Users\Admin\AppData\Local\Programs\Python\Launcher\;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;D:\software\GoLand 2023.2\bin;;C:\Users\Admin\go\bin;C:\Program Files\RedPanda-Cpp\MinGW64\bin;D:\software\Git\bin;D:\software\GoLand 2023.2\bin;C:\Program Files (x86)\Tencent\QQGameTempest\Hall.57938\;C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Admin\AppData\Roaming\npm;C:\Users\Admin\AppData\Local\GitHubDesktop\bin;
194 | USERNAME=Admin
195 | OS=Windows_NT
196 | PROCESSOR_IDENTIFIER=AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD
197 |
198 |
199 |
200 | --------------- S Y S T E M ---------------
201 |
202 | OS:
203 | Windows 11 , 64 bit Build 22621 (10.0.22621.2506)
204 | OS uptime: 0 days 5:11 hours
205 |
206 | CPU: total 16 (initial active 16) (16 cores per cpu, 2 threads per core) family 25 model 80 stepping 0 microcode 0x0, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt
207 |
208 | Memory: 4k page, system-wide physical 15763M (471M free)
209 | TotalPageFile size 23940M (AvailPageFile size 74M)
210 | current process WorkingSet (physical memory assigned to process): 11M, peak: 11M
211 | current process commit charge ("private bytes"): 70M, peak: 318M
212 |
213 | vm_info: Java HotSpot(TM) 64-Bit Server VM (17.0.8+9-LTS-211) for windows-amd64 JRE (17.0.8+9-LTS-211), built on Jun 14 2023 10:34:31 by "mach5one" with MS VC++ 17.1 (VS2022)
214 |
215 | END.
216 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'OpenImSdkRnExample'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 | includeBuild('../node_modules/@react-native/gradle-plugin')
5 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "OpenImSdkRnExample",
3 | "displayName": "OpenImSdkRnExample"
4 | }
5 |
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = {
5 | presets: ['module:metro-react-native-babel-preset'],
6 | plugins: [
7 | [
8 | 'module-resolver',
9 | {
10 | extensions: ['.tsx', '.ts', '.js', '.json'],
11 | alias: {
12 | [pak.name]: path.join(__dirname, '..', pak.source),
13 | },
14 | },
15 | ],
16 | ],
17 | };
18 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native';
2 | import App from './src/App';
3 | import { name as appName } from './app.json';
4 |
5 | AppRegistry.registerComponent(appName, () => App);
6 |
--------------------------------------------------------------------------------
/example/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/example/ios/File.swift:
--------------------------------------------------------------------------------
1 | //
2 | // File.swift
3 | // OpenImSdkRnExample
4 | //
5 |
6 | import Foundation
7 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample.xcodeproj/xcshareddata/xcschemes/OpenImSdkRnExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : RCTAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"OpenImSdkRnExample";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | #if DEBUG
20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
21 | #else
22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23 | #endif
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "iphone",
5 | "scale": "2x",
6 | "size": "20x20"
7 | },
8 | {
9 | "idiom": "iphone",
10 | "scale": "3x",
11 | "size": "20x20"
12 | },
13 | {
14 | "idiom": "iphone",
15 | "scale": "2x",
16 | "size": "29x29"
17 | },
18 | {
19 | "idiom": "iphone",
20 | "scale": "3x",
21 | "size": "29x29"
22 | },
23 | {
24 | "idiom": "iphone",
25 | "scale": "2x",
26 | "size": "40x40"
27 | },
28 | {
29 | "idiom": "iphone",
30 | "scale": "3x",
31 | "size": "40x40"
32 | },
33 | {
34 | "idiom": "iphone",
35 | "scale": "2x",
36 | "size": "60x60"
37 | },
38 | {
39 | "idiom": "iphone",
40 | "scale": "3x",
41 | "size": "60x60"
42 | },
43 | {
44 | "idiom": "ios-marketing",
45 | "scale": "1x",
46 | "size": "1024x1024"
47 | }
48 | ],
49 | "info": {
50 | "author": "xcode",
51 | "version": 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info": {
3 | "version": 1,
4 | "author": "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | OpenImSdkRnExample
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExample/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | @autoreleasepool {
8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/OpenImSdkRnExampleTests/OpenImSdkRnExampleTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface OpenImSdkRnExampleTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation OpenImSdkRnExampleTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Resolve react_native_pods.rb with node to allow for hoisting
2 | require Pod::Executable.execute_command('node', ['-p',
3 | 'require.resolve(
4 | "react-native/scripts/react_native_pods.rb",
5 | {paths: [process.argv[1]]},
6 | )', __dir__]).strip
7 |
8 | platform :ios, min_ios_version_supported
9 | prepare_react_native_project!
10 |
11 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
12 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
13 | #
14 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
15 | # ```js
16 | # module.exports = {
17 | # dependencies: {
18 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
19 | # ```
20 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
21 |
22 | linkage = ENV['USE_FRAMEWORKS']
23 | if linkage != nil
24 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
25 | use_frameworks! :linkage => linkage.to_sym
26 | end
27 |
28 | target 'OpenImSdkRnExample' do
29 | config = use_native_modules!
30 |
31 | # Flags change depending on the env values.
32 | flags = get_default_flags()
33 |
34 | use_react_native!(
35 | :path => config[:reactNativePath],
36 | # Hermes is now enabled by default. Disable by setting this flag to false.
37 | :hermes_enabled => flags[:hermes_enabled],
38 | :fabric_enabled => flags[:fabric_enabled],
39 | # Enables Flipper.
40 | #
41 | # Note that if you have use_frameworks! enabled, Flipper will not work and
42 | # you should disable the next line.
43 | :flipper_configuration => flipper_config,
44 | # An absolute path to your application root.
45 | :app_path => "#{Pod::Config.instance.installation_root}/.."
46 | )
47 | pod 'open-im-sdk-rn', :path => '../..'
48 | target 'OpenImSdkRnExampleTests' do
49 | inherit! :complete
50 | # Pods for testing
51 | end
52 |
53 | post_install do |installer|
54 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
55 | react_native_post_install(
56 | installer,
57 | config[:reactNativePath],
58 | :mac_catalyst_enabled => false
59 | )
60 | __apply_Xcode_12_5_M1_post_install_workaround(installer)
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/example/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'react-native',
3 | };
4 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2 | const path = require('path');
3 | const escape = require('escape-string-regexp');
4 | const exclusionList = require('metro-config/src/defaults/exclusionList');
5 | const pak = require('../package.json');
6 |
7 | const root = path.resolve(__dirname, '..');
8 | const modules = Object.keys({ ...pak.peerDependencies });
9 |
10 | /**
11 | * Metro configuration
12 | * https://facebook.github.io/metro/docs/configuration
13 | *
14 | * @type {import('metro-config').MetroConfig}
15 | */
16 | const config = {
17 | watchFolders: [root],
18 |
19 | // We need to make sure that only one version is loaded for peerDependencies
20 | // So we block them at the root, and alias them to the versions in example's node_modules
21 | resolver: {
22 | blacklistRE: exclusionList(
23 | modules.map(
24 | (m) =>
25 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
26 | )
27 | ),
28 |
29 | extraNodeModules: modules.reduce((acc, name) => {
30 | acc[name] = path.join(__dirname, 'node_modules', name);
31 | return acc;
32 | }, {}),
33 | },
34 |
35 | transformer: {
36 | getTransformOptions: async () => ({
37 | transform: {
38 | experimentalImportSupport: false,
39 | inlineRequires: true,
40 | },
41 | }),
42 | },
43 | };
44 |
45 | module.exports = mergeConfig(getDefaultConfig(__dirname), config);
46 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "OpenImSdkRnExample",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "start": "react-native start",
9 | "pods": "pod-install --quiet"
10 | },
11 | "dependencies": {
12 | "open-im-sdk-rn": "^3.4.2",
13 | "react": "18.2.0",
14 | "react-native": "0.72.4",
15 | "react-native-fs": "^2.20.0"
16 | },
17 | "devDependencies": {
18 | "@babel/core": "^7.20.0",
19 | "@babel/preset-env": "^7.20.0",
20 | "@babel/runtime": "^7.20.0",
21 | "@react-native/eslint-config": "^0.72.2",
22 | "@react-native/metro-config": "^0.72.11",
23 | "babel-plugin-module-resolver": "^5.0.0",
24 | "metro-react-native-babel-preset": "0.76.8"
25 | },
26 | "engines": {
27 | "node": ">=16"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/example/react-native.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = {
5 | dependencies: {
6 | [pak.name]: {
7 | root: path.join(__dirname, '..'),
8 | },
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/example/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import OpenIMSDKRN, { OpenIMEmitter } from 'open-im-sdk-rn';
3 | import RNFS from 'react-native-fs';
4 | import { Button, StyleSheet, View } from 'react-native';
5 | import { MessageItem } from 'src/types/entity';
6 |
7 | function App(): React.JSX.Element {
8 | RNFS.mkdir(RNFS.DocumentDirectoryPath + '/tmp');
9 | const init = async () => {
10 | try {
11 | await OpenIMSDKRN.initSDK(
12 | {
13 | apiAddr: 'http://127.0.0.1:10002',
14 | wsAddr: 'ws://127.0.0.1:10001',
15 | dataDir: RNFS.DocumentDirectoryPath + '/tmp',
16 | logLevel: 5,
17 | isLogStandardOutput: true,
18 | },
19 | 'hrtyy45t'
20 | );
21 | console.log('initSDK success');
22 | } catch (error) {
23 | console.log('initSDK error');
24 | }
25 | };
26 |
27 | const iosLogin = async () => {
28 | try {
29 | await OpenIMSDKRN.login(
30 | {
31 | userID: '3742375535',
32 | token: 'xxx',
33 | },
34 | 'hrtyy45t'
35 | );
36 | console.log(await OpenIMSDKRN.getLoginStatus('hrtyy45t'));
37 | } catch (error) {
38 | console.error('login error', error);
39 | }
40 | };
41 |
42 | const androidLogin = async () => {
43 | try {
44 | await OpenIMSDKRN.login(
45 | {
46 | userID: '3742375535',
47 | token: 'xx',
48 | },
49 | 'hrtyy45t'
50 | );
51 | console.log(await OpenIMSDKRN.getLoginStatus('hrtyy45t'));
52 | } catch (error) {
53 | console.error('login error', error);
54 | }
55 | };
56 |
57 | const sendTextMsg = async () => {
58 | try {
59 | const message = await OpenIMSDKRN.createTextMessage(
60 | 'sendTextMsg',
61 | 'hrtyy45t'
62 | );
63 | console.info('createTextMessage', typeof message, message);
64 | await sendMsg(message);
65 | } catch (error) {
66 | console.error('Error createCardMessage:', error);
67 | }
68 | };
69 |
70 | const sendCardMsg = async () => {
71 | try {
72 | const message = await OpenIMSDKRN.createCardMessage(
73 | {
74 | userID: '6265276311',
75 | nickname: 'kevin1',
76 | faceURL: '',
77 | ex: '',
78 | },
79 | 'hrtyy45t'
80 | );
81 | console.info('createCardMessage', message);
82 | await sendMsg(message);
83 | } catch (error) {
84 | console.error('Error createCardMessage:', error);
85 | }
86 | };
87 |
88 | const sendLocationMsg = async () => {
89 | try {
90 | const message = await OpenIMSDKRN.createLocationMessage(
91 | {
92 | description: 'location',
93 | longitude: 22.2,
94 | latitude: 33.3,
95 | },
96 | 'hrtyy45t'
97 | );
98 | console.info('createLocationMessage', message);
99 | await sendMsg(message);
100 | } catch (error) {
101 | console.error('Error createLocationMessage:', error);
102 | }
103 | };
104 |
105 | const sendGroupMsg = async (message: MessageItem) => {
106 | try {
107 | const res = await OpenIMSDKRN.sendMessage(
108 | {
109 | recvID: '',
110 | groupID: '1944501993',
111 | message,
112 | },
113 | 'hrtyy45t'
114 | );
115 | console.info('sendGroupMsg', typeof res, res);
116 | } catch (error) {
117 | console.error('Error sendGroupMsg:', error);
118 | }
119 | };
120 |
121 | const sendMsg = async (message: MessageItem) => {
122 | try {
123 | const res = await OpenIMSDKRN.sendMessage(
124 | {
125 | recvID: '6265276311',
126 | groupID: '',
127 | message,
128 | },
129 | 'hrtyy45t'
130 | );
131 | console.info('sendMessage', typeof res, res);
132 | } catch (error) {
133 | console.error('Error sendMsg:', error);
134 | }
135 | };
136 |
137 | const getMessageList = async () => {
138 | const { messageList } = await OpenIMSDKRN.getAdvancedHistoryMessageList(
139 | {
140 | lastMinSeq: 0,
141 | count: 20,
142 | startClientMsgID: '',
143 | conversationID: 'si_3742375535_6265276311',
144 | },
145 | 'hrtyy45t'
146 | );
147 | console.info('getAdvancedHistoryMessageList', messageList);
148 | };
149 |
150 | const getConversationListSplit = async () => {
151 | try {
152 | const res = await OpenIMSDKRN.getConversationListSplit(
153 | {
154 | offset: 0,
155 | count: 10,
156 | },
157 | 'hrtyy45t'
158 | );
159 | console.info('getConversationListSplit', res);
160 | } catch (error) {
161 | console.error('Error getConversationListSplit:', error);
162 | }
163 | };
164 |
165 | const getConversationIDBySessionType = async () => {
166 | try {
167 | const res = await OpenIMSDKRN.getConversationIDBySessionType(
168 | {
169 | sourceID: '3742375535',
170 | sessionType: 3,
171 | },
172 | 'hrtyy45t'
173 | );
174 | console.info('getConversationIDBySessionType', res);
175 | } catch (error) {
176 | console.error('Error getConversationIDBySessionType:', error);
177 | }
178 | };
179 |
180 | const getUserInfo = async () => {
181 | try {
182 | const data = await OpenIMSDKRN.getSelfUserInfo('operationID');
183 | console.log('getSelfUserInfo', data);
184 | } catch (error) {
185 | console.error('Error getSelfUserInfo', error);
186 | }
187 | };
188 |
189 | const updateInfo = async () => {
190 | try {
191 | await OpenIMSDKRN.setSelfInfo(
192 | {
193 | nickname: 'k0',
194 | faceURL: '',
195 | ex: '',
196 | },
197 | 'hrtyy45t'
198 | );
199 | console.info('setSelfInfo');
200 | } catch (error) {
201 | console.error('Error getConversationListSplit:', error);
202 | }
203 | };
204 |
205 | const at = async () => {
206 | try {
207 | const message = await OpenIMSDKRN.createTextAtMessage(
208 | {
209 | text: '123 @6265276311 123',
210 | atUserIDList: ['6265276311'],
211 | atUsersInfo: [
212 | {
213 | atUserID: '6265276311',
214 | groupNickname: 'kevin1',
215 | },
216 | ],
217 | },
218 | 'hrtyy45t'
219 | );
220 | console.info('createTextAtMessage', typeof message, message);
221 | await sendGroupMsg(message);
222 | } catch (error) {
223 | console.error('Error createTextAtMessage:', error);
224 | }
225 | };
226 |
227 | const joinGroup = async () => {
228 | try {
229 | await OpenIMSDKRN.joinGroup(
230 | {
231 | groupID: '2602656113',
232 | reqMsg: 'join',
233 | joinSource: 2,
234 | },
235 | 'hrtyy45t'
236 | );
237 | console.info('joinGroup');
238 | } catch (error) {
239 | console.error('Error joinGroup');
240 | }
241 | };
242 |
243 | const pinConversation = async (isPinned: boolean) => {
244 | OpenIMSDKRN.setConversationBurnDuration;
245 | try {
246 | await OpenIMSDKRN.pinConversation(
247 | {
248 | conversationID: 'si_3742375535_6265276311',
249 | isPinned,
250 | },
251 | 'hrtyy45t'
252 | );
253 | console.info('pinConversation');
254 | } catch (error) {
255 | console.error('Error pinConversation');
256 | }
257 | };
258 |
259 | OpenIMEmitter.addListener('onConnecting', () => {
260 | console.warn('onConnecting');
261 | });
262 |
263 | OpenIMEmitter.addListener('onConnectSuccess', () => {
264 | console.warn('onConnectSuccess');
265 | });
266 |
267 | OpenIMEmitter.addListener('onConnectFailed', (res) => {
268 | console.warn('onConnectFailed', res);
269 | });
270 |
271 | OpenIMEmitter.addListener('onUserTokenExpired', () => {
272 | console.warn('onUserTokenExpired');
273 | });
274 |
275 | OpenIMEmitter.addListener('onRecvNewMessages', (data: MessageItem[]) => {
276 | console.warn('onRecvNewMessages', data);
277 | });
278 |
279 | OpenIMEmitter.addListener('onSelfInfoUpdated', (data) => {
280 | console.warn('onSelfInfoUpdated', data);
281 | });
282 |
283 | OpenIMEmitter.addListener('onConversationChanged', (res) => {
284 | console.warn('onConversationChanged', typeof res, res);
285 | });
286 |
287 | return (
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
299 |
300 |
301 |
302 |
303 |
307 |
308 |
314 | );
315 | }
316 |
317 | const styles = StyleSheet.create({
318 | container: {
319 | flex: 1,
320 | alignItems: 'center',
321 | justifyContent: 'center',
322 | },
323 | box: {
324 | width: 60,
325 | height: 60,
326 | marginVertical: 20,
327 | },
328 | });
329 |
330 | export default App;
331 |
--------------------------------------------------------------------------------
/ios/CallbackProxy.h:
--------------------------------------------------------------------------------
1 |
2 | #if __has_include("RCTBridgeModule.h")
3 | #import "RCTBridgeModule.h"
4 | #import "RCTEventEmitter.h"
5 | #else
6 | #import
7 | #import
8 | #endif
9 |
10 | @import OpenIMCore;
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface RNCallbackProxy : NSObject
15 |
16 | - (id)initWithCallback:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter;
17 |
18 | @end
19 |
20 | NS_ASSUME_NONNULL_END
21 |
--------------------------------------------------------------------------------
/ios/CallbackProxy.m:
--------------------------------------------------------------------------------
1 | #import "CallbackProxy.h"
2 |
3 | @interface RNCallbackProxy()
4 |
5 | @property (nonatomic, copy) RCTPromiseResolveBlock resolver;
6 | @property (nonatomic, copy) RCTPromiseRejectBlock rejecter;
7 |
8 | @end
9 |
10 | @implementation RNCallbackProxy
11 |
12 | - (id)initWithCallback:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter {
13 | if (self = [super init]) {
14 | self.resolver = resolver;
15 | self.rejecter = rejecter;
16 | }
17 | return self;
18 | }
19 |
20 | - (NSDictionary *)parseJsonStr2Dict:(NSString *)jsonStr {
21 | NSData *jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
22 | NSError *error = nil;
23 | id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
24 | if (error) {
25 | return nil;
26 | }
27 | NSDictionary *data = (NSDictionary *)jsonObject;
28 | return data;
29 | }
30 |
31 | - (NSArray *)parseJsonStr2Array:(NSString *)jsonStr {
32 | NSData *jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
33 | NSError *error = nil;
34 | id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
35 | if (error) {
36 | return nil;
37 | }
38 | NSArray *data = (NSArray *)jsonObject;
39 | return data;
40 | }
41 |
42 | - (void)onError:(int32_t)errCode errMsg:(NSString * _Nullable)errMsg {
43 | self.rejecter([NSString stringWithFormat:@"%d",errCode],errMsg,nil);
44 | }
45 |
46 | - (void)onSuccess:(NSString * _Nullable)data {
47 | NSDictionary *dataDict = [self parseJsonStr2Dict:data];
48 | if (dataDict) {
49 | self.resolver(dataDict);
50 | } else {
51 | NSArray *dataArray = [self parseJsonStr2Array:data];
52 | if (dataArray) {
53 | self.resolver(dataArray);
54 | } else {
55 | self.resolver(data);
56 | }
57 | }
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/ios/OpenImSdkRn.h:
--------------------------------------------------------------------------------
1 | @import OpenIMCore;
2 | #import "CallbackProxy.h"
3 |
4 | #if __has_include("RCTBridgeModule.h")
5 | #import "RCTBridgeModule.h"
6 | #import "RCTEventEmitter.h"
7 | #else
8 | #import
9 | #import
10 | #endif
11 |
12 | @interface OpenIMSDKRN : RCTEventEmitter
13 |
14 | - (void)pushEvent:(NSString *) eventName data:(id) data;
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/ios/OpenImSdkRn.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 |
11 | 5E555C0D2413F4C50049A1A2 /* OpenImSdkRn.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* OpenImSdkRn.m */; };
12 |
13 | /* End PBXBuildFile section */
14 |
15 | /* Begin PBXCopyFilesBuildPhase section */
16 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
17 | isa = PBXCopyFilesBuildPhase;
18 | buildActionMask = 2147483647;
19 | dstPath = "include/$(PRODUCT_NAME)";
20 | dstSubfolderSpec = 16;
21 | files = (
22 | );
23 | runOnlyForDeploymentPostprocessing = 0;
24 | };
25 | /* End PBXCopyFilesBuildPhase section */
26 |
27 | /* Begin PBXFileReference section */
28 | 134814201AA4EA6300B7C361 /* libOpenImSdkRn.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOpenImSdkRn.a; sourceTree = BUILT_PRODUCTS_DIR; };
29 |
30 | B3E7B5881CC2AC0600A0062D /* OpenImSdkRn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenImSdkRn.h; sourceTree = ""; };
31 | B3E7B5891CC2AC0600A0062D /* OpenImSdkRn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenImSdkRn.m; sourceTree = ""; };
32 |
33 | /* End PBXFileReference section */
34 |
35 | /* Begin PBXFrameworksBuildPhase section */
36 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
37 | isa = PBXFrameworksBuildPhase;
38 | buildActionMask = 2147483647;
39 | files = (
40 | );
41 | runOnlyForDeploymentPostprocessing = 0;
42 | };
43 | /* End PBXFrameworksBuildPhase section */
44 |
45 | /* Begin PBXGroup section */
46 | 134814211AA4EA7D00B7C361 /* Products */ = {
47 | isa = PBXGroup;
48 | children = (
49 | 134814201AA4EA6300B7C361 /* libOpenImSdkRn.a */,
50 | );
51 | name = Products;
52 | sourceTree = "";
53 | };
54 | 58B511D21A9E6C8500147676 = {
55 | isa = PBXGroup;
56 | children = (
57 |
58 | B3E7B5881CC2AC0600A0062D /* OpenImSdkRn.h */,
59 | B3E7B5891CC2AC0600A0062D /* OpenImSdkRn.m */,
60 |
61 | 134814211AA4EA7D00B7C361 /* Products */,
62 | );
63 | sourceTree = "";
64 | };
65 | /* End PBXGroup section */
66 |
67 | /* Begin PBXNativeTarget section */
68 | 58B511DA1A9E6C8500147676 /* OpenImSdkRn */ = {
69 | isa = PBXNativeTarget;
70 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "OpenImSdkRn" */;
71 | buildPhases = (
72 | 58B511D71A9E6C8500147676 /* Sources */,
73 | 58B511D81A9E6C8500147676 /* Frameworks */,
74 | 58B511D91A9E6C8500147676 /* CopyFiles */,
75 | );
76 | buildRules = (
77 | );
78 | dependencies = (
79 | );
80 | name = OpenImSdkRn;
81 | productName = RCTDataManager;
82 | productReference = 134814201AA4EA6300B7C361 /* libOpenImSdkRn.a */;
83 | productType = "com.apple.product-type.library.static";
84 | };
85 | /* End PBXNativeTarget section */
86 |
87 | /* Begin PBXProject section */
88 | 58B511D31A9E6C8500147676 /* Project object */ = {
89 | isa = PBXProject;
90 | attributes = {
91 | LastUpgradeCheck = 0920;
92 | ORGANIZATIONNAME = Facebook;
93 | TargetAttributes = {
94 | 58B511DA1A9E6C8500147676 = {
95 | CreatedOnToolsVersion = 6.1.1;
96 | };
97 | };
98 | };
99 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "OpenImSdkRn" */;
100 | compatibilityVersion = "Xcode 3.2";
101 | developmentRegion = English;
102 | hasScannedForEncodings = 0;
103 | knownRegions = (
104 | English,
105 | en,
106 | );
107 | mainGroup = 58B511D21A9E6C8500147676;
108 | productRefGroup = 58B511D21A9E6C8500147676;
109 | projectDirPath = "";
110 | projectRoot = "";
111 | targets = (
112 | 58B511DA1A9E6C8500147676 /* OpenImSdkRn */,
113 | );
114 | };
115 | /* End PBXProject section */
116 |
117 | /* Begin PBXSourcesBuildPhase section */
118 | 58B511D71A9E6C8500147676 /* Sources */ = {
119 | isa = PBXSourcesBuildPhase;
120 | buildActionMask = 2147483647;
121 | files = (
122 |
123 | B3E7B58A1CC2AC0600A0062D /* OpenImSdkRn.m in Sources */,
124 |
125 | );
126 | runOnlyForDeploymentPostprocessing = 0;
127 | };
128 | /* End PBXSourcesBuildPhase section */
129 |
130 | /* Begin XCBuildConfiguration section */
131 | 58B511ED1A9E6C8500147676 /* Debug */ = {
132 | isa = XCBuildConfiguration;
133 | buildSettings = {
134 | ALWAYS_SEARCH_USER_PATHS = NO;
135 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
136 | CLANG_CXX_LIBRARY = "libc++";
137 | CLANG_ENABLE_MODULES = YES;
138 | CLANG_ENABLE_OBJC_ARC = YES;
139 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
140 | CLANG_WARN_BOOL_CONVERSION = YES;
141 | CLANG_WARN_COMMA = YES;
142 | CLANG_WARN_CONSTANT_CONVERSION = YES;
143 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
144 | CLANG_WARN_EMPTY_BODY = YES;
145 | CLANG_WARN_ENUM_CONVERSION = YES;
146 | CLANG_WARN_INFINITE_RECURSION = YES;
147 | CLANG_WARN_INT_CONVERSION = YES;
148 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
149 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
150 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
151 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
152 | CLANG_WARN_STRICT_PROTOTYPES = YES;
153 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
154 | CLANG_WARN_UNREACHABLE_CODE = YES;
155 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
156 | COPY_PHASE_STRIP = NO;
157 | ENABLE_STRICT_OBJC_MSGSEND = YES;
158 | ENABLE_TESTABILITY = YES;
159 | GCC_C_LANGUAGE_STANDARD = gnu99;
160 | GCC_DYNAMIC_NO_PIC = NO;
161 | GCC_NO_COMMON_BLOCKS = YES;
162 | GCC_OPTIMIZATION_LEVEL = 0;
163 | GCC_PREPROCESSOR_DEFINITIONS = (
164 | "DEBUG=1",
165 | "$(inherited)",
166 | );
167 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
168 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
169 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
170 | GCC_WARN_UNDECLARED_SELECTOR = YES;
171 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
172 | GCC_WARN_UNUSED_FUNCTION = YES;
173 | GCC_WARN_UNUSED_VARIABLE = YES;
174 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
175 | MTL_ENABLE_DEBUG_INFO = YES;
176 | ONLY_ACTIVE_ARCH = YES;
177 | SDKROOT = iphoneos;
178 | };
179 | name = Debug;
180 | };
181 | 58B511EE1A9E6C8500147676 /* Release */ = {
182 | isa = XCBuildConfiguration;
183 | buildSettings = {
184 | ALWAYS_SEARCH_USER_PATHS = NO;
185 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
186 | CLANG_CXX_LIBRARY = "libc++";
187 | CLANG_ENABLE_MODULES = YES;
188 | CLANG_ENABLE_OBJC_ARC = YES;
189 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
190 | CLANG_WARN_BOOL_CONVERSION = YES;
191 | CLANG_WARN_COMMA = YES;
192 | CLANG_WARN_CONSTANT_CONVERSION = YES;
193 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
194 | CLANG_WARN_EMPTY_BODY = YES;
195 | CLANG_WARN_ENUM_CONVERSION = YES;
196 | CLANG_WARN_INFINITE_RECURSION = YES;
197 | CLANG_WARN_INT_CONVERSION = YES;
198 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
199 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
200 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
201 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
202 | CLANG_WARN_STRICT_PROTOTYPES = YES;
203 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
204 | CLANG_WARN_UNREACHABLE_CODE = YES;
205 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
206 | COPY_PHASE_STRIP = YES;
207 | ENABLE_NS_ASSERTIONS = NO;
208 | ENABLE_STRICT_OBJC_MSGSEND = YES;
209 | GCC_C_LANGUAGE_STANDARD = gnu99;
210 | GCC_NO_COMMON_BLOCKS = YES;
211 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
212 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
213 | GCC_WARN_UNDECLARED_SELECTOR = YES;
214 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
215 | GCC_WARN_UNUSED_FUNCTION = YES;
216 | GCC_WARN_UNUSED_VARIABLE = YES;
217 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
218 | MTL_ENABLE_DEBUG_INFO = NO;
219 | SDKROOT = iphoneos;
220 | VALIDATE_PRODUCT = YES;
221 | };
222 | name = Release;
223 | };
224 | 58B511F01A9E6C8500147676 /* Debug */ = {
225 | isa = XCBuildConfiguration;
226 | buildSettings = {
227 | HEADER_SEARCH_PATHS = (
228 | "$(inherited)",
229 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
230 | "$(SRCROOT)/../../../React/**",
231 | "$(SRCROOT)/../../react-native/React/**",
232 | );
233 | LIBRARY_SEARCH_PATHS = "$(inherited)";
234 | OTHER_LDFLAGS = "-ObjC";
235 | PRODUCT_NAME = OpenImSdkRn;
236 | SKIP_INSTALL = YES;
237 |
238 | };
239 | name = Debug;
240 | };
241 | 58B511F11A9E6C8500147676 /* Release */ = {
242 | isa = XCBuildConfiguration;
243 | buildSettings = {
244 | HEADER_SEARCH_PATHS = (
245 | "$(inherited)",
246 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
247 | "$(SRCROOT)/../../../React/**",
248 | "$(SRCROOT)/../../react-native/React/**",
249 | );
250 | LIBRARY_SEARCH_PATHS = "$(inherited)";
251 | OTHER_LDFLAGS = "-ObjC";
252 | PRODUCT_NAME = OpenImSdkRn;
253 | SKIP_INSTALL = YES;
254 |
255 | };
256 | name = Release;
257 | };
258 | /* End XCBuildConfiguration section */
259 |
260 | /* Begin XCConfigurationList section */
261 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "OpenImSdkRn" */ = {
262 | isa = XCConfigurationList;
263 | buildConfigurations = (
264 | 58B511ED1A9E6C8500147676 /* Debug */,
265 | 58B511EE1A9E6C8500147676 /* Release */,
266 | );
267 | defaultConfigurationIsVisible = 0;
268 | defaultConfigurationName = Release;
269 | };
270 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "OpenImSdkRn" */ = {
271 | isa = XCConfigurationList;
272 | buildConfigurations = (
273 | 58B511F01A9E6C8500147676 /* Debug */,
274 | 58B511F11A9E6C8500147676 /* Release */,
275 | );
276 | defaultConfigurationIsVisible = 0;
277 | defaultConfigurationName = Release;
278 | };
279 | /* End XCConfigurationList section */
280 | };
281 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
282 | }
283 |
--------------------------------------------------------------------------------
/ios/SendMessageCallbackProxy.h:
--------------------------------------------------------------------------------
1 | #import "OpenImSdkRn.h"
2 |
3 | #if __has_include("RCTBridgeModule.h")
4 | #import "RCTBridgeModule.h"
5 | #import "RCTEventEmitter.h"
6 | #else
7 | #import
8 | #import
9 | #endif
10 |
11 | @import OpenIMCore;
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | @interface RNSendMessageCallbackProxy : NSObject
16 |
17 | - (id)initWithMessage:(NSString *)msg module:(OpenIMSDKRN *)module resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter;
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/ios/SendMessageCallbackProxy.m:
--------------------------------------------------------------------------------
1 | #import "SendMessageCallbackProxy.h"
2 |
3 | @implementation NSDictionary (Extensions)
4 |
5 | - (NSString *)json {
6 | NSString *json = nil;
7 |
8 | NSError *error = nil;
9 | NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error];
10 | json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
11 |
12 | return (error ? nil : json);
13 | }
14 |
15 | @end
16 |
17 | @interface RNSendMessageCallbackProxy()
18 |
19 | @property (nonatomic, copy) RCTPromiseResolveBlock resolver;
20 | @property (nonatomic, copy) RCTPromiseRejectBlock rejecter;
21 | @property (nonatomic, copy) NSString* msg;
22 | @property (nonatomic, weak) OpenIMSDKRN* module;
23 |
24 | @end
25 |
26 | @implementation RNSendMessageCallbackProxy
27 |
28 | - (id)initWithMessage:(NSString *)msg module:(OpenIMSDKRN *)module resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter{
29 | if (self = [super init]) {
30 | self.msg = msg;
31 | self.module = module;
32 | self.resolver = resolver;
33 | self.rejecter = rejecter;
34 | }
35 | return self;
36 | }
37 |
38 | - (void)onError:(int32_t)errCode errMsg:(NSString * _Nullable)errMsg {
39 | self.rejecter([NSString stringWithFormat:@"%d",errCode],errMsg,nil);
40 | }
41 |
42 | - (NSDictionary *)parseJsonStr2Dict:(NSString *)jsonStr {
43 | NSData *jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
44 | NSError *error = nil;
45 | id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
46 | if (error) {
47 | NSLog(@"Error while parsing JSON: %@", error.localizedDescription);
48 | return nil;
49 | }
50 | NSDictionary *data = (NSDictionary *)jsonObject;
51 | return data;
52 | }
53 |
54 | - (void)onSuccess:(NSString * _Nullable)data {
55 | NSDictionary *messageDict = [self parseJsonStr2Dict:data];
56 | self.resolver(messageDict);
57 | }
58 |
59 | - (void)onProgress:(long)progress {
60 | NSDictionary *messageDict = [self parseJsonStr2Dict:self.msg];
61 | NSDictionary *data = @{
62 | @"progress":@(progress),
63 | @"message":messageDict
64 | };
65 | [self.module pushEvent:@"SendMessageProgress" data:data];
66 | }
67 | @end
68 |
--------------------------------------------------------------------------------
/ios/UploadFileCallbackProxy.h:
--------------------------------------------------------------------------------
1 | #import "OpenImSdkRn.h"
2 |
3 | #if __has_include("RCTBridgeModule.h")
4 | #import "RCTBridgeModule.h"
5 | #import "RCTEventEmitter.h"
6 | #else
7 | #import
8 | #import
9 | #endif
10 |
11 | @import OpenIMCore;
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | @interface RNUploadFileCallbackProxy : NSObject
16 |
17 | - (id)initWithOpid:(NSString *)operationID module:(OpenIMSDKRN *)module resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter;
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/ios/UploadFileCallbackProxy.m:
--------------------------------------------------------------------------------
1 | #import "UploadFileCallbackProxy.h"
2 |
3 | @implementation NSDictionary (Extensions)
4 |
5 | - (NSString *)json {
6 | NSString *json = nil;
7 |
8 | NSError *error = nil;
9 | NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error];
10 | json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
11 |
12 | return (error ? nil : json);
13 | }
14 |
15 | @end
16 |
17 | @interface RNUploadFileCallbackProxy()
18 |
19 | @property (nonatomic, copy) NSString* opid;
20 | @property (nonatomic, weak) OpenIMSDKRN* module;
21 |
22 | @end
23 |
24 | @implementation RNUploadFileCallbackProxy
25 |
26 | - (nonnull id)initWithOpid:(nonnull NSString *)operationID module:(nonnull OpenIMSDKRN *)module resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter {
27 | if (self = [super init]) {
28 | self.opid = operationID;
29 | self.module = module;
30 | }
31 | return self;
32 | }
33 |
34 | - (void)complete:(int64_t)size url:(NSString * _Nullable)url typ:(long)typ {
35 |
36 | }
37 |
38 | - (void)hashPartComplete:(NSString * _Nullable)partsHash fileHash:(NSString * _Nullable)fileHash {
39 |
40 | }
41 |
42 | - (void)hashPartProgress:(long)index size:(int64_t)size partHash:(NSString * _Nullable)partHash {
43 |
44 | }
45 |
46 | - (void)open:(int64_t)size {
47 |
48 | }
49 |
50 | - (void)partSize:(int64_t)partSize num:(long)num {
51 |
52 | }
53 |
54 | - (void)uploadComplete:(int64_t)fileSize streamSize:(int64_t)streamSize storageSize:(int64_t)storageSize {
55 | NSMutableDictionary *data = [NSMutableDictionary dictionary];
56 | [data setObject:[NSNumber numberWithLongLong:fileSize] forKey:@"fileSize"];
57 | [data setObject:[NSNumber numberWithLongLong:streamSize] forKey:@"streamSize"];
58 | [data setObject:[NSNumber numberWithLongLong:storageSize] forKey:@"storageSize"];
59 | [data setObject:self.opid forKey:@"operationID"];
60 |
61 | NSMutableDictionary *params = [NSMutableDictionary dictionary];
62 | [params setObject:data forKey:@"data"];
63 | params[@"errCode"] = @(0);
64 | params[@"errMsg"] = @"";
65 |
66 | [self.module pushEvent:@"uploadComplete" data:params];
67 | }
68 |
69 |
70 | - (void)uploadID:(NSString * _Nullable)uploadID {
71 |
72 | }
73 |
74 | - (void)uploadPartComplete:(long)index partSize:(int64_t)partSize partHash:(NSString * _Nullable)partHash {
75 |
76 | }
77 |
78 |
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/ios/UploadLogCallbackProxy.h:
--------------------------------------------------------------------------------
1 | #import "OpenImSdkRn.h"
2 |
3 | #if __has_include("RCTBridgeModule.h")
4 | #import "RCTBridgeModule.h"
5 | #import "RCTEventEmitter.h"
6 | #else
7 | #import
8 | #import
9 | #endif
10 |
11 | @import OpenIMCore;
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | @interface RNUploadLogCallbackProxy : NSObject
16 |
17 | - (id)initWithOpid:(NSString *)operationID module:(OpenIMSDKRN *)module resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter;
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/ios/UploadLogCallbackProxy.m:
--------------------------------------------------------------------------------
1 | #import "UploadLogCallbackProxy.h"
2 |
3 | @implementation NSDictionary (Extensions)
4 |
5 | - (NSString *)json {
6 | NSString *json = nil;
7 |
8 | NSError *error = nil;
9 | NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error];
10 | json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
11 |
12 | return (error ? nil : json);
13 | }
14 |
15 | @end
16 |
17 | @interface RNUploadLogCallbackProxy()
18 |
19 | @property (nonatomic, copy) NSString* opid;
20 | @property (nonatomic, weak) OpenIMSDKRN* module;
21 |
22 | @end
23 |
24 | @implementation RNUploadLogCallbackProxy
25 |
26 | - (nonnull id)initWithOpid:(nonnull NSString *)operationID module:(nonnull OpenIMSDKRN *)module resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter {
27 | if (self = [super init]) {
28 | self.opid = operationID;
29 | self.module = module;
30 | }
31 | return self;
32 | }
33 |
34 | - (void)onProgress:(int64_t)current size:(int64_t)size {
35 | NSMutableDictionary *params = [NSMutableDictionary dictionary];
36 | params[@"current"] = @(current);
37 | params[@"size"] = @(size);
38 | params[@"operationID"] = _opid;
39 | params[@"errCode"] = @(0);
40 | params[@"errMsg"] = @"";
41 | [self.module pushEvent:@"uploadOnProgress" data:params];
42 | }
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/lefthook.yml:
--------------------------------------------------------------------------------
1 | pre-commit:
2 | parallel: true
3 | commands:
4 | lint:
5 | files: git diff --name-only @{push}
6 | glob: '*.{js,ts,jsx,tsx}'
7 | run: npx eslint {files}
8 | types:
9 | files: git diff --name-only @{push}
10 | glob: '*.{js,ts, jsx, tsx}'
11 | run: npx tsc --noEmit
12 | commit-msg:
13 | parallel: true
14 | commands:
15 | commitlint:
16 | run: npx commitlint --edit
17 |
--------------------------------------------------------------------------------
/open-im-sdk-rn.podspec:
--------------------------------------------------------------------------------
1 | require "json"
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5 |
6 | Pod::Spec.new do |s|
7 | s.name = "open-im-sdk-rn"
8 | s.version = package["version"]
9 | s.summary = package["description"]
10 | s.homepage = package["homepage"]
11 | s.license = package["license"]
12 | s.authors = package["author"]
13 |
14 | s.platforms = { :ios => "11.0" }
15 | s.source = { :git => "https://github.com/OpenIMSDK/Open-IM-SDK-ReactNative.git.git", :tag => "#{s.version}" }
16 |
17 | s.source_files = "ios/**/*.{h,m,mm}"
18 |
19 | # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20 | # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21 | # if respond_to?(:install_modules_dependencies, true)
22 | # install_modules_dependencies(s)
23 | # else
24 | s.static_framework = true
25 | s.dependency "React-Core"
26 | s.dependency "OpenIMSDKCore","3.8.3+3"
27 | s.library = 'resolv'
28 | # Don't install the dependencies when we run `pod install` in the old architecture.
29 | if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
30 | s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
31 | s.pod_target_xcconfig = {
32 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
33 | "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
34 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
35 | }
36 | s.dependency "React-Codegen"
37 | s.dependency "RCT-Folly"
38 | s.dependency "RCTRequired"
39 | s.dependency "RCTTypeSafety"
40 | s.dependency "ReactCommon/turbomodule/core"
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "open-im-sdk-rn",
3 | "version": "3.8.3-2",
4 | "description": "OpenIM SDK for react-native",
5 | "main": "lib/commonjs/index",
6 | "module": "lib/module/index",
7 | "types": "lib/typescript/index.d.ts",
8 | "react-native": "src/index",
9 | "source": "src/index",
10 | "files": [
11 | "src",
12 | "lib",
13 | "android",
14 | "ios",
15 | "cpp",
16 | "*.podspec",
17 | "!lib/typescript/example",
18 | "!ios/build",
19 | "!android/build",
20 | "!android/gradle",
21 | "!android/gradlew",
22 | "!android/gradlew.bat",
23 | "!android/local.properties",
24 | "!**/__tests__",
25 | "!**/__fixtures__",
26 | "!**/__mocks__",
27 | "!**/.*"
28 | ],
29 | "scripts": {
30 | "test": "jest",
31 | "typecheck": "tsc --noEmit",
32 | "lint": "eslint \"**/*.{js,ts,tsx}\"",
33 | "prepack": "bob build",
34 | "release": "release-it",
35 | "example": "yarn --cwd example",
36 | "build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
37 | "build:ios": "cd example/ios && xcodebuild -workspace OpenImSdkRnExample.xcworkspace -scheme OpenImSdkRnExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
38 | "bootstrap": "yarn example && yarn install && yarn example pods",
39 | "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
40 | },
41 | "keywords": [
42 | "react-native",
43 | "ios",
44 | "android"
45 | ],
46 | "repository": "https://github.com/OpenIMSDK/Open-IM-SDK-ReactNative.git",
47 | "author": "AndrewZuo01 (https://www.rentsoft.cn)",
48 | "license": "MIT",
49 | "bugs": {
50 | "url": "https://github.com/OpenIMSDK/Open-IM-SDK-ReactNative.git/issues"
51 | },
52 | "homepage": "https://github.com/OpenIMSDK/Open-IM-SDK-ReactNative.git#readme",
53 | "publishConfig": {
54 | "registry": "https://registry.npmjs.org/"
55 | },
56 | "devDependencies": {
57 | "@commitlint/config-conventional": "^17.0.2",
58 | "@evilmartians/lefthook": "^1.2.2",
59 | "@release-it/conventional-changelog": "^5.0.0",
60 | "@types/react": "~17.0.21",
61 | "@types/react-native": "0.70.0",
62 | "@types/uuid": "^9.0.8",
63 | "commitlint": "^17.0.2",
64 | "pod-install": "^0.1.0",
65 | "prettier": "^2.0.5",
66 | "react": "18.2.0",
67 | "react-native": "0.70.5",
68 | "react-native-builder-bob": "^0.20.0",
69 | "release-it": "^15.0.0",
70 | "turbo": "^1.10.7",
71 | "typescript": "^5.0.2"
72 | },
73 | "resolutions": {
74 | "@types/react": "17.0.21"
75 | },
76 | "peerDependencies": {
77 | "react": "*",
78 | "react-native": "*"
79 | },
80 | "engines": {
81 | "node": ">= 16.0.0"
82 | },
83 | "packageManager": "yarn@1.22.15",
84 | "jest": {
85 | "preset": "react-native",
86 | "modulePathIgnorePatterns": [
87 | "/example/node_modules",
88 | "/lib/"
89 | ]
90 | },
91 | "release-it": {
92 | "git": {
93 | "commitMessage": "chore: release ${version}",
94 | "tagName": "v${version}"
95 | },
96 | "npm": {
97 | "publish": true
98 | },
99 | "github": {
100 | "release": true
101 | },
102 | "plugins": {
103 | "@release-it/conventional-changelog": {
104 | "preset": "angular"
105 | }
106 | }
107 | },
108 | "eslintConfig": {
109 | "root": true,
110 | "extends": [
111 | "@react-native-community",
112 | "prettier"
113 | ],
114 | "rules": {
115 | "prettier/prettier": [
116 | "error",
117 | {
118 | "quoteProps": "consistent",
119 | "singleQuote": true,
120 | "tabWidth": 2,
121 | "trailingComma": "es5",
122 | "useTabs": false
123 | }
124 | ]
125 | }
126 | },
127 | "eslintIgnore": [
128 | "node_modules/",
129 | "lib/"
130 | ],
131 | "prettier": {
132 | "quoteProps": "consistent",
133 | "singleQuote": true,
134 | "tabWidth": 2,
135 | "trailingComma": "es5",
136 | "useTabs": false
137 | },
138 | "react-native-builder-bob": {
139 | "source": "src",
140 | "output": "lib",
141 | "targets": [
142 | "commonjs",
143 | "module",
144 | [
145 | "typescript",
146 | {
147 | "project": "tsconfig.build.json"
148 | }
149 | ]
150 | ]
151 | },
152 | "dependencies": {
153 | "uuid": "^9.0.1"
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/scripts/bootstrap.js:
--------------------------------------------------------------------------------
1 | const os = require('os');
2 | const path = require('path');
3 | const child_process = require('child_process');
4 |
5 | const root = path.resolve(__dirname, '..');
6 | const args = process.argv.slice(2);
7 | const options = {
8 | cwd: process.cwd(),
9 | env: process.env,
10 | stdio: 'inherit',
11 | encoding: 'utf-8',
12 | };
13 |
14 | if (os.type() === 'Windows_NT') {
15 | options.shell = true;
16 | }
17 |
18 | let result;
19 |
20 | if (process.cwd() !== root || args.length) {
21 | // We're not in the root of the project, or additional arguments were passed
22 | // In this case, forward the command to `yarn`
23 | result = child_process.spawnSync('yarn', args, options);
24 | } else {
25 | // If `yarn` is run without arguments, perform bootstrap
26 | result = child_process.spawnSync('yarn', ['bootstrap'], options);
27 | }
28 |
29 | process.exitCode = result.status;
30 |
--------------------------------------------------------------------------------
/src/types/entity.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | AllowType,
3 | ApplicationHandleResult,
4 | GroupAtType,
5 | GroupJoinSource,
6 | GroupMemberRole,
7 | GroupStatus,
8 | GroupType,
9 | GroupVerificationType,
10 | MessageReceiveOptType,
11 | MessageStatus,
12 | MessageType,
13 | OnlineState,
14 | Platform,
15 | Relationship,
16 | SessionType,
17 | } from './enum';
18 |
19 | export type MessageEntity = {
20 | type: string;
21 | offset: number;
22 | length: number;
23 | url?: string;
24 | info?: string;
25 | };
26 | export type PicBaseInfo = {
27 | uuid: string;
28 | type: string;
29 | size: number;
30 | width: number;
31 | height: number;
32 | url: string;
33 | };
34 | export type AtUsersInfoItem = {
35 | atUserID: string;
36 | groupNickname: string;
37 | };
38 | export type GroupApplicationItem = {
39 | createTime: number;
40 | creatorUserID: string;
41 | ex: string;
42 | groupFaceURL: string;
43 | groupID: string;
44 | groupName: string;
45 | groupType: GroupType;
46 | handleResult: ApplicationHandleResult;
47 | handleUserID: string;
48 | handledMsg: string;
49 | handledTime: number;
50 | introduction: string;
51 | memberCount: number;
52 | nickname: string;
53 | notification: string;
54 | ownerUserID: string;
55 | reqMsg: string;
56 | reqTime: number;
57 | joinSource: GroupJoinSource;
58 | status: GroupStatus;
59 | userFaceURL: string;
60 | userID: string;
61 | };
62 | export type FriendApplicationItem = {
63 | createTime: number;
64 | ex: string;
65 | fromFaceURL: string;
66 | fromNickname: string;
67 | fromUserID: string;
68 | handleMsg: string;
69 | handleResult: ApplicationHandleResult;
70 | handleTime: number;
71 | handlerUserID: string;
72 | reqMsg: string;
73 | toFaceURL: string;
74 | toNickname: string;
75 | toUserID: string;
76 | };
77 | export type PublicUserItem = {
78 | nickname: string;
79 | userID: string;
80 | faceURL: string;
81 | ex: string;
82 | };
83 | export type SelfUserInfo = {
84 | createTime: number;
85 | ex: string;
86 | faceURL: string;
87 | nickname: string;
88 | userID: string;
89 | globalRecvMsgOpt: MessageReceiveOptType;
90 | };
91 | export type PartialUserInfo = {
92 | userID: string;
93 | } & Partial>;
94 | export type FriendUserItem = {
95 | addSource: number;
96 | createTime: number;
97 | ex: string;
98 | faceURL: string;
99 | userID: string;
100 | nickname: string;
101 | operatorUserID: string;
102 | ownerUserID: string;
103 | remark: string;
104 | isPinned: boolean;
105 | attachedInfo: string;
106 | };
107 | export type SearchedFriendsInfo = FriendUserItem & {
108 | relationship: Relationship;
109 | };
110 | export type FriendshipInfo = {
111 | result: number;
112 | userID: string;
113 | };
114 | export type BlackUserItem = {
115 | addSource: number;
116 | userID: string;
117 | createTime: number;
118 | ex: string;
119 | faceURL: string;
120 | nickname: string;
121 | operatorUserID: string;
122 | ownerUserID: string;
123 | };
124 | export type GroupItem = {
125 | groupID: string;
126 | groupName: string;
127 | notification: string;
128 | notificationUserID: string;
129 | notificationUpdateTime: number;
130 | introduction: string;
131 | faceURL: string;
132 | ownerUserID: string;
133 | createTime: number;
134 | memberCount: number;
135 | status: GroupStatus;
136 | creatorUserID: string;
137 | groupType: GroupType;
138 | needVerification: GroupVerificationType;
139 | ex: string;
140 | applyMemberFriend: AllowType;
141 | lookMemberInfo: AllowType;
142 | displayIsRead: boolean;
143 | };
144 | export type GroupMemberItem = {
145 | groupID: string;
146 | userID: string;
147 | nickname: string;
148 | faceURL: string;
149 | roleLevel: GroupMemberRole;
150 | muteEndTime: number;
151 | joinTime: number;
152 | joinSource: GroupJoinSource;
153 | inviterUserID: string;
154 | operatorUserID: string;
155 | ex: string;
156 | };
157 | export type ConversationItem = {
158 | conversationID: string;
159 | conversationType: SessionType;
160 | userID: string;
161 | groupID: string;
162 | showName: string;
163 | faceURL: string;
164 | recvMsgOpt: MessageReceiveOptType;
165 | unreadCount: number;
166 | groupAtType: GroupAtType;
167 | latestMsg: string;
168 | latestMsgSendTime: number;
169 | draftText: string;
170 | draftTextTime: number;
171 | burnDuration: number;
172 | msgDestructTime: number;
173 | isPinned: boolean;
174 | isNotInGroup: boolean;
175 | isPrivateChat: boolean;
176 | isMsgDestruct: boolean;
177 | attachedInfo: string;
178 | ex?: string;
179 | };
180 | export type MessageItem = {
181 | clientMsgID: string;
182 | serverMsgID: string;
183 | createTime: number;
184 | sendTime: number;
185 | sessionType: SessionType;
186 | sendID: string;
187 | recvID: string;
188 | msgFrom: number;
189 | contentType: MessageType;
190 | senderPlatformID: Platform;
191 | senderNickname: string;
192 | senderFaceUrl: string;
193 | groupID: string;
194 | content: string;
195 | seq: number;
196 | isRead: boolean;
197 | status: MessageStatus;
198 | isReact?: boolean;
199 | isExternalExtensions?: boolean;
200 | offlinePush?: OfflinePush;
201 | ex?: string;
202 | localEx?: string;
203 | textElem?: TextElem;
204 | cardElem?: CardElem;
205 | pictureElem?: PictureElem;
206 | soundElem?: SoundElem;
207 | videoElem?: VideoElem;
208 | fileElem?: FileElem;
209 | mergeElem?: MergeElem;
210 | atTextElem?: AtTextElem;
211 | faceElem?: FaceElem;
212 | locationElem?: LocationElem;
213 | customElem?: CustomElem;
214 | quoteElem?: QuoteElem;
215 | notificationElem?: NotificationElem;
216 | advancedTextElem?: AdvancedTextElem;
217 | typingElem?: TypingElem;
218 | attachedInfoElem: AttachedInfoElem;
219 | };
220 | export type TextElem = {
221 | content: string;
222 | };
223 | export type CardElem = {
224 | userID: string;
225 | nickname: string;
226 | faceURL: string;
227 | ex: string;
228 | };
229 | export type AtTextElem = {
230 | text: string;
231 | atUserList: string[];
232 | atUsersInfo?: AtUsersInfoItem[];
233 | quoteMessage?: MessageItem;
234 | isAtSelf?: boolean;
235 | };
236 | export type NotificationElem = {
237 | detail: string;
238 | };
239 | export type AdvancedTextElem = {
240 | text: string;
241 | messageEntityList: MessageEntity[];
242 | };
243 | export type TypingElem = {
244 | msgTips: string;
245 | };
246 | export type CustomElem = {
247 | data: string;
248 | description: string;
249 | extension: string;
250 | };
251 | export type FileElem = {
252 | filePath: string;
253 | uuid: string;
254 | sourceUrl: string;
255 | fileName: string;
256 | fileSize: number;
257 | };
258 | export type FaceElem = {
259 | index: number;
260 | data: string;
261 | };
262 | export type LocationElem = {
263 | description: string;
264 | longitude: number;
265 | latitude: number;
266 | };
267 | export type MergeElem = {
268 | title: string;
269 | abstractList: string[];
270 | multiMessage: MessageItem[];
271 | messageEntityList: MessageEntity[];
272 | };
273 | export type OfflinePush = {
274 | title: string;
275 | desc: string;
276 | ex: string;
277 | iOSPushSound: string;
278 | iOSBadgeCount: boolean;
279 | };
280 | export type PictureElem = {
281 | sourcePath: string;
282 | sourcePicture: Picture;
283 | bigPicture: Picture;
284 | snapshotPicture: Picture;
285 | };
286 | export type AttachedInfoElem = {
287 | groupHasReadInfo: GroupHasReadInfo;
288 | isPrivateChat: boolean;
289 | isEncryption: boolean;
290 | inEncryptStatus: boolean;
291 | burnDuration: number;
292 | hasReadTime: number;
293 | messageEntityList?: MessageEntity[];
294 | uploadProgress?: UploadProgress;
295 | };
296 | export type UploadProgress = {
297 | total: number;
298 | save: number;
299 | current: number;
300 | };
301 | export type GroupHasReadInfo = {
302 | hasReadCount: number;
303 | unreadCount: number;
304 | hasReadUserIDList: string[];
305 | groupMemberCount: number;
306 | };
307 | export type Picture = {
308 | uuid: string;
309 | type: string;
310 | size: number;
311 | width: number;
312 | height: number;
313 | url: string;
314 | };
315 | export type QuoteElem = {
316 | text: string;
317 | quoteMessage: MessageItem;
318 | };
319 | export type SoundElem = {
320 | uuid: string;
321 | soundPath: string;
322 | sourceUrl: string;
323 | dataSize: number;
324 | duration: number;
325 | };
326 | export type VideoElem = {
327 | videoPath: string;
328 | videoUUID: string;
329 | videoUrl: string;
330 | videoType: string;
331 | videoSize: number;
332 | duration: number;
333 | snapshotPath: string;
334 | snapshotUUID: string;
335 | snapshotSize: number;
336 | snapshotUrl: string;
337 | snapshotWidth: number;
338 | snapshotHeight: number;
339 | };
340 | export type AdvancedRevokeContent = {
341 | clientMsgID: string;
342 | revokeTime: number;
343 | revokerID: string;
344 | revokerNickname: string;
345 | revokerRole: number;
346 | seq: number;
347 | sessionType: SessionType;
348 | sourceMessageSendID: string;
349 | sourceMessageSendTime: number;
350 | sourceMessageSenderNickname: string;
351 | };
352 |
353 | export type RevokedInfo = {
354 | revokerID: string;
355 | revokerRole: number;
356 | clientMsgID: string;
357 | revokerNickname: string;
358 | revokeTime: number;
359 | sourceMessageSendTime: number;
360 | sourceMessageSendID: string;
361 | sourceMessageSenderNickname: string;
362 | sessionType: number;
363 | seq: number;
364 | ex: string;
365 | };
366 |
367 | export type ReceiptInfo = {
368 | userID: string;
369 | groupID: string;
370 | msgIDList: string[];
371 | readTime: number;
372 | msgFrom: number;
373 | contentType: MessageType;
374 | sessionType: SessionType;
375 | };
376 |
377 | export type SearchMessageResult = {
378 | totalCount: number;
379 | searchResultItems?: SearchMessageResultItem[];
380 | findResultItems?: SearchMessageResultItem[];
381 | };
382 |
383 | export type SearchMessageResultItem = {
384 | conversationID: string;
385 | messageCount: number;
386 | conversationType: SessionType;
387 | showName: string;
388 | faceURL: string;
389 | messageList: MessageItem[];
390 | };
391 |
392 | export type AdvancedGetMessageResult = {
393 | isEnd: boolean;
394 | errCode: number;
395 | errMsg: string;
396 | messageList: MessageItem[];
397 | };
398 |
399 | export type RtcInvite = {
400 | inviterUserID: string;
401 | inviteeUserIDList: string[];
402 | customData?: string;
403 | groupID: string;
404 | roomID: string;
405 | timeout: number;
406 | mediaType: string;
407 | sessionType: number;
408 | platformID: number;
409 | initiateTime?: number;
410 | busyLineUserIDList?: string[];
411 | };
412 |
413 | export type UserOnlineState = {
414 | platformIDs?: Platform[];
415 | status: OnlineState;
416 | userID: string;
417 | };
418 |
419 | export type ConversationInputStatus = {
420 | conversationID: string;
421 | userID: string;
422 | platformIDs: Platform[];
423 | };
424 |
425 | export type GroupMessageReceiptInfo = {
426 | conversationID: string;
427 | groupMessageReadInfo: GroupMessageReadInfo[];
428 | };
429 | export type GroupMessageReadInfo = {
430 | clientMsgID: string;
431 | hasReadCount: number;
432 | unreadCount: number;
433 | readMembers: GroupMemberItem[];
434 | };
435 |
--------------------------------------------------------------------------------
/src/types/enum.ts:
--------------------------------------------------------------------------------
1 | export enum MessageReceiveOptType {
2 | Nomal = 0,
3 | NotReceive = 1,
4 | NotNotify = 2,
5 | }
6 | export enum AllowType {
7 | Allowed = 0,
8 | NotAllowed = 1,
9 | }
10 | export enum GroupType {
11 | Group = 2,
12 | WorkingGroup = 2,
13 | }
14 | export enum GroupJoinSource {
15 | Invitation = 2,
16 | Search = 3,
17 | QrCode = 4,
18 | }
19 | export enum GroupMemberRole {
20 | Nomal = 20,
21 | Admin = 60,
22 | Owner = 100,
23 | }
24 | export enum GroupVerificationType {
25 | ApplyNeedInviteNot = 0,
26 | AllNeed = 1,
27 | AllNot = 2,
28 | }
29 | export enum MessageStatus {
30 | Sending = 1,
31 | Succeed = 2,
32 | Failed = 3,
33 | }
34 | export enum Platform {
35 | iOS = 1,
36 | Android = 2,
37 | Windows = 3,
38 | MacOSX = 4,
39 | Web = 5,
40 | Linux = 7,
41 | AndroidPad = 8,
42 | iPad = 9,
43 | }
44 | export enum LogLevel {
45 | Debug = 5,
46 | Info = 4,
47 | Warn = 3,
48 | Error = 2,
49 | Fatal = 1,
50 | Panic = 0,
51 | }
52 | export enum ApplicationHandleResult {
53 | Unprocessed = 0,
54 | Agree = 1,
55 | Reject = -1,
56 | }
57 | export enum MessageType {
58 | TextMessage = 101,
59 | PictureMessage = 102,
60 | VoiceMessage = 103,
61 | VideoMessage = 104,
62 | FileMessage = 105,
63 | AtTextMessage = 106,
64 | MergeMessage = 107,
65 | CardMessage = 108,
66 | LocationMessage = 109,
67 | CustomMessage = 110,
68 | TypingMessage = 113,
69 | QuoteMessage = 114,
70 | FaceMessage = 115,
71 | FriendAdded = 1201,
72 | OANotification = 1400,
73 |
74 | GroupCreated = 1501,
75 | GroupInfoUpdated = 1502,
76 | MemberQuit = 1504,
77 | GroupOwnerTransferred = 1507,
78 | MemberKicked = 1508,
79 | MemberInvited = 1509,
80 | MemberEnter = 1510,
81 | GroupDismissed = 1511,
82 | GroupMemberMuted = 1512,
83 | GroupMemberCancelMuted = 1513,
84 | GroupMuted = 1514,
85 | GroupCancelMuted = 1515,
86 | GroupAnnouncementUpdated = 1519,
87 | GroupNameUpdated = 1520,
88 | BurnMessageChange = 1701,
89 |
90 | // notification
91 | RevokeMessage = 2101,
92 | }
93 | export enum SessionType {
94 | Single = 1,
95 | Group = 3,
96 | WorkingGroup = 3,
97 | Notification = 4,
98 | }
99 | export enum GroupStatus {
100 | Nomal = 0,
101 | Baned = 1,
102 | Dismissed = 2,
103 | Muted = 3,
104 | }
105 | export enum GroupAtType {
106 | AtNormal = 0,
107 | AtMe = 1,
108 | AtAll = 2,
109 | AtAllAtMe = 3,
110 | AtGroupNotice = 4,
111 | }
112 | export enum GroupMemberFilter {
113 | All = 0,
114 | Owner = 1,
115 | Admin = 2,
116 | Nomal = 3,
117 | AdminAndNomal = 4,
118 | AdminAndOwner = 5,
119 | }
120 | export enum Relationship {
121 | isBlack = 0,
122 | isFriend = 1,
123 | }
124 | export enum LoginStatus {
125 | Logout = 1,
126 | Logging = 2,
127 | Logged = 3,
128 | }
129 | export enum OnlineState {
130 | Online = 1,
131 | Offline = 0,
132 | }
133 | export enum GroupMessageReaderFilter {
134 | Readed = 0,
135 | UnRead = 1,
136 | }
137 | export enum ViewType {
138 | History = 0,
139 | Search = 1,
140 | }
--------------------------------------------------------------------------------
/src/types/params.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | AtUsersInfoItem,
3 | GroupItem,
4 | MessageItem,
5 | OfflinePush,
6 | PicBaseInfo,
7 | SelfUserInfo,
8 | } from './entity';
9 | import type {
10 | GroupAtType,
11 | GroupJoinSource,
12 | GroupMemberFilter,
13 | GroupMemberRole,
14 | LogLevel,
15 | MessageReceiveOptType,
16 | MessageType,
17 | ViewType,
18 | } from './enum';
19 |
20 | export type InitOptions = {
21 | wsAddr: string;
22 | apiAddr: string;
23 | dataDir: string;
24 | logLevel: LogLevel;
25 | isLogStandardOutput: boolean;
26 | };
27 |
28 | export type LoginParams = {
29 | userID: string;
30 | token: string;
31 | };
32 |
33 | export type OffsetParams = {
34 | offset: number;
35 | count: number;
36 | };
37 |
38 | export type SetSelfInfoParams = Partial;
39 |
40 | export type GetUserInfoWithCacheParams = {
41 | userIDList: string[];
42 | groupID?: string;
43 | };
44 |
45 | export type SplitConversationParams = {
46 | offset: number;
47 | count: number;
48 | };
49 |
50 | export type GetOneConversationParams = {
51 | sourceID: string;
52 | sessionType: number;
53 | };
54 |
55 | export type setConversationParams = {
56 | conversationID: string;
57 | recvMsgOpt?: MessageReceiveOptType;
58 | groupAtType?: GroupAtType;
59 | burnDuration?: number;
60 | msgDestructTime?: number;
61 | isPinned?: boolean;
62 | isPrivateChat?: boolean;
63 | isMsgDestruct?: boolean;
64 | ex?: string;
65 | };
66 |
67 | export type SetConversationDraftParams = {
68 | conversationID: string;
69 | draftText: string;
70 | };
71 |
72 | export type PinConversationParams = {
73 | conversationID: string;
74 | isPinned: boolean;
75 | };
76 |
77 | export type SetConversationRecvOptParams = {
78 | conversationID: string;
79 | opt: MessageReceiveOptType;
80 | };
81 |
82 | export type SetConversationPrivateParams = {
83 | conversationID: string;
84 | isPrivate: boolean;
85 | };
86 |
87 | export type SetBurnDurationParams = {
88 | conversationID: string;
89 | burnDuration: number;
90 | };
91 |
92 | export declare type GetSpecifiedFriendsParams = {
93 | userIDList: string[];
94 | filterBlack?: boolean;
95 | };
96 |
97 | export type UpdateFriendsParams = {
98 | friendUserIDs: string[];
99 | isPinned?: boolean;
100 | remark?: boolean;
101 | ex?: boolean;
102 | };
103 |
104 | export type AccessFriendParams = {
105 | toUserID: string;
106 | handleMsg: string;
107 | };
108 |
109 | export type AddBlackParams = {
110 | toUserID: string;
111 | ex?: string;
112 | };
113 |
114 | export type AddFriendParams = {
115 | toUserID: string;
116 | reqMsg: string;
117 | };
118 |
119 | export type SearchFriendParams = {
120 | keywordList: string[];
121 | isSearchUserID: boolean;
122 | isSearchNickname: boolean;
123 | isSearchRemark: boolean;
124 | };
125 |
126 | export type RemarkFriendParams = {
127 | friendUserIDs: string;
128 | remark: string;
129 | };
130 |
131 | export type CreateGroupParams = {
132 | memberUserIDs: string[];
133 | groupInfo: Partial;
134 | adminUserIDs?: string[];
135 | ownerUserID?: string;
136 | };
137 |
138 | export type JoinGroupParams = {
139 | groupID: string;
140 | reqMsg: string;
141 | joinSource: GroupJoinSource;
142 | ex?: string;
143 | };
144 |
145 | export type OpreateGroupParams = {
146 | groupID: string;
147 | reason: string;
148 | userIDList: string[];
149 | };
150 |
151 | export type SearchGroupParams = {
152 | keywordList: string[];
153 | isSearchGroupID: boolean;
154 | isSearchGroupName: boolean;
155 | };
156 |
157 | export type SetGroupinfoParams = Partial & { groupID: string };
158 |
159 | export type AccessGroupParams = {
160 | groupID: string;
161 | fromUserID: string;
162 | handleMsg: string;
163 | };
164 |
165 | export declare type GetGroupMemberParams = {
166 | groupID: string;
167 | filter: GroupMemberFilter;
168 | offset: number;
169 | count: number;
170 | };
171 |
172 | export type getGroupMembersInfoParams = {
173 | groupID: string;
174 | userIDList: string[];
175 | };
176 |
177 | export type SearchGroupMemberParams = {
178 | groupID: string;
179 | keywordList: string[];
180 | isSearchUserID: boolean;
181 | isSearchMemberNickname: boolean;
182 | offset: number;
183 | count: number;
184 | };
185 |
186 | export type UpdateMemberInfoParams = {
187 | groupID: string;
188 | userID: string;
189 | nickname?: string;
190 | faceURL?: string;
191 | roleLevel?: GroupMemberRole;
192 | ex?: string;
193 | };
194 |
195 | export type GetGroupMemberByTimeParams = {
196 | groupID: string;
197 | filterUserIDList: string[];
198 | offset: number;
199 | count: number;
200 | joinTimeBegin: number;
201 | joinTimeEnd: number;
202 | };
203 |
204 | export type ChangeGroupMemberMuteParams = {
205 | groupID: string;
206 | userID: string;
207 | mutedSeconds: number;
208 | };
209 |
210 | export type ChangeGroupMuteParams = {
211 | groupID: string;
212 | isMute: boolean;
213 | };
214 |
215 | export type TransferGroupParams = {
216 | groupID: string;
217 | newOwnerUserID: string;
218 | };
219 |
220 | export type SoundMsgByPathParams = {
221 | soundPath: string;
222 | duration: number;
223 | };
224 |
225 | export type VideoMsgByPathParams = {
226 | videoPath: string;
227 | videoType: string;
228 | duration: number;
229 | snapshotPath: string;
230 | };
231 |
232 | export type FileMsgByPathParams = {
233 | filePath: string;
234 | fileName: string;
235 | };
236 |
237 | export type AtMsgParams = {
238 | text: string;
239 | atUserIDList: string[];
240 | atUsersInfo?: AtUsersInfoItem[];
241 | message?: MessageItem;
242 | };
243 |
244 | export type ImageMsgParams = {
245 | sourcePicture: PicBaseInfo;
246 | bigPicture: PicBaseInfo;
247 | snapshotPicture: PicBaseInfo;
248 | sourcePath: string;
249 | };
250 |
251 | export type SoundMsgParams = {
252 | uuid: string;
253 | soundPath: string;
254 | sourceUrl: string;
255 | dataSize: number;
256 | duration: number;
257 | soundType?: string;
258 | };
259 |
260 | export type VideoMsgParams = {
261 | videoPath: string;
262 | duration: number;
263 | videoType: string;
264 | snapshotPath: string;
265 | videoUUID: string;
266 | videoUrl: string;
267 | videoSize: number;
268 | snapshotUUID: string;
269 | snapshotSize: number;
270 | snapshotUrl: string;
271 | snapshotWidth: number;
272 | snapshotHeight: number;
273 | snapShotType?: string;
274 | };
275 |
276 | export type FileMsgParams = {
277 | filePath: string;
278 | fileName: string;
279 | uuid: string;
280 | sourceUrl: string;
281 | fileSize: number;
282 | fileType?: string;
283 | };
284 |
285 | export type MergerMsgParams = {
286 | messageList: MessageItem[];
287 | title: string;
288 | summaryList: string[];
289 | };
290 |
291 | export type LocationMsgParams = {
292 | description: string;
293 | longitude: number;
294 | latitude: number;
295 | };
296 |
297 | export type QuoteMsgParams = {
298 | text: string;
299 | message: MessageItem;
300 | };
301 |
302 | export type CustomMsgParams = {
303 | data: string;
304 | extension: string;
305 | description: string;
306 | };
307 |
308 | export type FaceMessageParams = {
309 | index: number;
310 | data: string;
311 | };
312 |
313 | export type SendMsgParams = {
314 | recvID: string;
315 | groupID: string;
316 | offlinePushInfo?: OfflinePush;
317 | message: MessageItem;
318 | isOnlineOnly?: boolean;
319 | };
320 |
321 | export type TypingUpdateParams = {
322 | recvID: string;
323 | msgTip: string;
324 | };
325 |
326 | export type ChangeInputStatesParams = {
327 | conversationID: string;
328 | focus: boolean;
329 | };
330 |
331 | export type GetInputStatesParams = {
332 | conversationID: string;
333 | userID: string;
334 | };
335 |
336 | export type OpreateMessageParams = {
337 | conversationID: string;
338 | clientMsgID: string;
339 | };
340 |
341 | export type SearchLocalParams = {
342 | conversationID: string;
343 | keywordList: string[];
344 | keywordListMatchType?: number;
345 | senderUserIDList?: string[];
346 | messageTypeList?: MessageType[];
347 | searchTimePosition?: number;
348 | searchTimePeriod?: number;
349 | pageIndex?: number;
350 | count?: number;
351 | };
352 |
353 | export type GetAdvancedHistoryMsgParams = {
354 | viewType: ViewType;
355 | count: number;
356 | startClientMsgID: string;
357 | conversationID: string;
358 | };
359 |
360 | export type FindMessageParams = {
361 | conversationID: string;
362 | clientMsgIDList: string[];
363 | };
364 |
365 | export type InsertGroupMsgParams = {
366 | message: MessageItem;
367 | groupID: string;
368 | sendID: string;
369 | };
370 |
371 | export type InsertSingleMsgParams = {
372 | message: MessageItem;
373 | recvID: string;
374 | sendID: string;
375 | };
376 |
377 | export type SetMessageLocalExParams = {
378 | conversationID: string;
379 | clientMsgID: string;
380 | localEx: string;
381 | };
382 |
383 | export declare type UploadFileParams = {
384 | name: string;
385 | contentType: string;
386 | uuid: string;
387 | cause?: string;
388 | filepath: string;
389 | };
390 |
391 | export type UploadLogsParams = {
392 | line: number;
393 | ex?: string;
394 | };
395 |
396 | export type LogsParams = {
397 | logLevel: number;
398 | file: string;
399 | line: number;
400 | msgs: string;
401 | err: string;
402 | keyAndValue: string;
403 | };
404 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "exclude": ["example"]
4 | }
5 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "paths": {
5 | "open-im-sdk-rn": ["./src/index"]
6 | },
7 | "allowUnreachableCode": false,
8 | "allowUnusedLabels": false,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "jsx": "react",
12 | "lib": ["esnext"],
13 | "module": "esnext",
14 | "moduleResolution": "node",
15 | "noFallthroughCasesInSwitch": true,
16 | "noImplicitReturns": true,
17 | "noImplicitUseStrict": false,
18 | "noStrictGenericChecks": false,
19 | "noUncheckedIndexedAccess": true,
20 | "noUnusedLocals": true,
21 | "noUnusedParameters": true,
22 | "resolveJsonModule": true,
23 | "skipLibCheck": true,
24 | "strict": true,
25 | "target": "esnext"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://turbo.build/schema.json",
3 | "pipeline": {
4 | "build:android": {
5 | "inputs": [
6 | "package.json",
7 | "android",
8 | "!android/build",
9 | "src/*.ts",
10 | "src/*.tsx",
11 | "example/package.json",
12 | "example/android",
13 | "!example/android/.gradle",
14 | "!example/android/build",
15 | "!example/android/app/build"
16 | ],
17 | "outputs": []
18 | },
19 | "build:ios": {
20 | "inputs": [
21 | "package.json",
22 | "*.podspec",
23 | "ios",
24 | "src/*.ts",
25 | "src/*.tsx",
26 | "example/package.json",
27 | "example/ios",
28 | "!example/ios/build",
29 | "!example/ios/Pods"
30 | ],
31 | "outputs": []
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------