juggleim-rnsdk 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build/.transforms/1525b0d13d9826ed3233f1973214d849/results.bin +1 -0
- package/android/build/.transforms/1525b0d13d9826ed3233f1973214d849/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/32937366d2d155289e73cba3894468b5/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/results.bin +1 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/BuildConfig.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/FileUtils.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$1.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$10.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$11.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$12.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$13.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$14.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$15.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$16.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$17.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$18.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$2.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$3.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$4.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$5.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$6.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$7.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$8.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$9.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMPackage.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/RNTypeConverter$1.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/RNTypeConverter.dex +0 -0
- package/android/build/.transforms/5a7ea9416fd710e97c2bb8d5954b2c2c/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/.transforms/9a2afda83c396e5ec45393e60e403432/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/RNTypeConverter$1.dex +0 -0
- package/android/build/.transforms/9a2afda83c396e5ec45393e60e403432/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/RNTypeConverter.dex +0 -0
- package/android/build/.transforms/9a2afda83c396e5ec45393e60e403432/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/RNTypeConverter$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/RNTypeConverter.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/RNTypeConverter$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/RNTypeConverter.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$1.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$10.class.uniqueId6 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$11.class.uniqueId11 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$12.class.uniqueId13 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$13.class.uniqueId16 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$14.class.uniqueId5 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$15.class.uniqueId8 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$16.class.uniqueId3 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$17.class.uniqueId20 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$2.class.uniqueId0 → JuggleIMManager$18.class.uniqueId12} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$2.class.uniqueId4 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$3.class.uniqueId7 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$4.class.uniqueId14 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$5.class.uniqueId19 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$6.class.uniqueId18 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$7.class.uniqueId10 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$8.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$9.class.uniqueId17 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNTypeConverter$1.class.uniqueId9 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNTypeConverter.class.uniqueId15 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/src/main/java/com/juggleim/JuggleIMManager.java +64 -43
- package/android/src/main/java/com/juggleim/RNTypeConverter.java +17 -6
- package/im-rn-sdk.podspec +1 -1
- package/ios/JuggleIMManager.m +22 -0
- package/package.json +2 -2
- package/src/index.d.ts +7 -0
- package/src/index.js +21 -7
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$1.class.uniqueId3 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMPackage.class.uniqueId2 +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
o/classes
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
o/bundleLibRuntimeToDirDebug
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
#Mon Dec 01
|
|
1
|
+
#Mon Dec 01 20:30:27 CST 2025
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/roger/juggleim/im-rn-sdk/sample/node_modules/
|
|
2
|
+
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/roger/juggleim/im-rn-sdk/sample/node_modules/juggleim-rnsdk/android/src/main/jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/roger/juggleim/im-rn-sdk/sample/node_modules/juggleim-rnsdk/android/src/debug/jniLibs"/></dataSet></merger>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -60,13 +60,13 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
60
60
|
public String getName() {
|
|
61
61
|
return MODULE_NAME;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
// 添加这两个方法以解决React Native的警告
|
|
65
65
|
@ReactMethod
|
|
66
66
|
public void addListener(String eventName) {
|
|
67
67
|
// Keep: Required for RN built in Event Emitter Calls.
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
@ReactMethod
|
|
71
71
|
public void removeListeners(Integer count) {
|
|
72
72
|
// Keep: Required for RN built in Event Emitter Calls.
|
|
@@ -96,7 +96,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
96
96
|
JIM.InitConfig.Builder builder = new JIM.InitConfig.Builder();
|
|
97
97
|
JLogConfig.Builder logBuilder = new JLogConfig.Builder(getReactApplicationContext());
|
|
98
98
|
logBuilder.setLogConsoleLevel(JLogLevel.JLogLevelVerbose);
|
|
99
|
-
builder.setJLogConfig(new JLogConfig(logBuilder));
|
|
99
|
+
builder.setJLogConfig(new JLogConfig(logBuilder));
|
|
100
100
|
JIM.getInstance().init(getCurrentActivity(), appKey, builder.build());
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -550,7 +550,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
550
550
|
JIMConst.PullDirection direction = pullDirection == 0 ?
|
|
551
551
|
JIMConst.PullDirection.NEWER : JIMConst.PullDirection.OLDER;
|
|
552
552
|
|
|
553
|
-
List<ConversationInfo> conversationInfos = com.juggle.im.JIM.getInstance().getConversationManager().getConversationInfoList(count, (long)ts, direction);
|
|
553
|
+
List<ConversationInfo> conversationInfos = com.juggle.im.JIM.getInstance().getConversationManager().getConversationInfoList(count, (long) ts, direction);
|
|
554
554
|
Log.d("getConversationInfoList", "conversationInfos: " + conversationInfos.size());
|
|
555
555
|
WritableArray result = new WritableNativeArray();
|
|
556
556
|
for (ConversationInfo info : conversationInfos) {
|
|
@@ -765,39 +765,60 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
765
765
|
*/
|
|
766
766
|
@ReactMethod
|
|
767
767
|
public void sendMessage(ReadableMap messageMap, String messageId, Promise promise) {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
768
|
+
Message message = convertMapToMessage(messageMap);
|
|
769
|
+
Log.d("sendMessage", message.toString());
|
|
770
|
+
Message sendMsg = JIM.getInstance().getMessageManager().sendMessage(
|
|
771
|
+
message.getContent(),
|
|
772
|
+
message.getConversation(),
|
|
773
|
+
new IMessageManager.ISendMessageCallback() {
|
|
774
|
+
@Override
|
|
775
|
+
public void onSuccess(Message sentMessage) {
|
|
776
|
+
WritableMap result = convertMessageToMap(sentMessage);
|
|
777
|
+
WritableMap event = new WritableNativeMap();
|
|
778
|
+
event.putString("messageId", messageId);
|
|
779
|
+
event.putMap("message", result);
|
|
780
|
+
sendEvent("onMessageSent", event);
|
|
781
|
+
}
|
|
783
782
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
783
|
+
@Override
|
|
784
|
+
public void onError(Message message, int errorCode) {
|
|
785
|
+
WritableMap errorResult = convertMessageToMap(message);
|
|
786
|
+
WritableMap event = new WritableNativeMap();
|
|
787
|
+
event.putString("messageId", messageId);
|
|
788
|
+
event.putMap("message", errorResult);
|
|
789
|
+
event.putInt("errorCode", errorCode);
|
|
790
|
+
sendEvent("onMessageSentError", event);
|
|
793
791
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
792
|
+
}
|
|
793
|
+
);
|
|
794
|
+
WritableMap result = convertMessageToMap(sendMsg);
|
|
795
|
+
result.putString("messageId", messageId);
|
|
796
|
+
promise.resolve(result);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* 根据clientMsgNo列表删除消息
|
|
801
|
+
*/
|
|
802
|
+
@ReactMethod
|
|
803
|
+
public void deleteMessagesByClientMsgNoList(ReadableMap conversationMap, ReadableArray clientMsgNos, Promise promise) {
|
|
804
|
+
Conversation conversation = convertMapToConversation(conversationMap);
|
|
805
|
+
List<Long> msgNoList = new ArrayList<>();
|
|
806
|
+
for (int i = 0; i < clientMsgNos.size(); i++) {
|
|
807
|
+
msgNoList.add((long) clientMsgNos.getDouble(i));
|
|
800
808
|
}
|
|
809
|
+
|
|
810
|
+
JIM.getInstance().getMessageManager()
|
|
811
|
+
.deleteMessagesByClientMsgNoList(conversation, msgNoList, new IMessageManager.ISimpleCallback() {
|
|
812
|
+
@Override
|
|
813
|
+
public void onSuccess() {
|
|
814
|
+
promise.resolve(true);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
@Override
|
|
818
|
+
public void onError(int errorCode) {
|
|
819
|
+
promise.reject("error", "Error code: " + errorCode);
|
|
820
|
+
}
|
|
821
|
+
});
|
|
801
822
|
}
|
|
802
823
|
|
|
803
824
|
/**
|
|
@@ -947,7 +968,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
947
968
|
try {
|
|
948
969
|
Conversation conversation = convertMapToConversation(messageMap);
|
|
949
970
|
ImageMessage imageMessage = new ImageMessage();
|
|
950
|
-
|
|
971
|
+
|
|
951
972
|
ReadableMap contentMap = messageMap.getMap("content");
|
|
952
973
|
if (contentMap.hasKey("localPath")) {
|
|
953
974
|
String path = FileUtils.convertContentUriToFile(getReactApplicationContext(), contentMap.getString("localPath"));
|
|
@@ -969,7 +990,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
969
990
|
if (contentMap.hasKey("height")) {
|
|
970
991
|
imageMessage.setHeight(contentMap.getInt("height"));
|
|
971
992
|
}
|
|
972
|
-
|
|
993
|
+
|
|
973
994
|
Message message = JIM.getInstance().getMessageManager().sendMediaMessage(
|
|
974
995
|
imageMessage,
|
|
975
996
|
conversation,
|
|
@@ -1010,7 +1031,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1010
1031
|
}
|
|
1011
1032
|
}
|
|
1012
1033
|
);
|
|
1013
|
-
|
|
1034
|
+
|
|
1014
1035
|
WritableMap result = convertMessageToMap(message);
|
|
1015
1036
|
result.putString("messageId", messageId);
|
|
1016
1037
|
promise.resolve(result);
|
|
@@ -1027,7 +1048,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1027
1048
|
try {
|
|
1028
1049
|
Conversation conversation = convertMapToConversation(messageMap);
|
|
1029
1050
|
FileMessage fileMessage = new FileMessage();
|
|
1030
|
-
|
|
1051
|
+
|
|
1031
1052
|
ReadableMap contentMap = messageMap.getMap("content");
|
|
1032
1053
|
if (contentMap.hasKey("localPath")) {
|
|
1033
1054
|
String path = FileUtils.convertContentUriToFile(getReactApplicationContext(), contentMap.getString("localPath"));
|
|
@@ -1045,7 +1066,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1045
1066
|
if (contentMap.hasKey("type")) {
|
|
1046
1067
|
fileMessage.setType(contentMap.getString("type"));
|
|
1047
1068
|
}
|
|
1048
|
-
|
|
1069
|
+
|
|
1049
1070
|
Message message = JIM.getInstance().getMessageManager().sendMediaMessage(
|
|
1050
1071
|
fileMessage,
|
|
1051
1072
|
conversation,
|
|
@@ -1085,7 +1106,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1085
1106
|
}
|
|
1086
1107
|
}
|
|
1087
1108
|
);
|
|
1088
|
-
|
|
1109
|
+
|
|
1089
1110
|
WritableMap result = convertMessageToMap(message);
|
|
1090
1111
|
result.putString("messageId", messageId);
|
|
1091
1112
|
promise.resolve(result);
|
|
@@ -1102,7 +1123,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1102
1123
|
try {
|
|
1103
1124
|
Conversation conversation = convertMapToConversation(messageMap);
|
|
1104
1125
|
VoiceMessage voiceMessage = new VoiceMessage();
|
|
1105
|
-
|
|
1126
|
+
|
|
1106
1127
|
ReadableMap contentMap = messageMap.getMap("content");
|
|
1107
1128
|
if (contentMap.hasKey("localPath")) {
|
|
1108
1129
|
String path = FileUtils.convertContentUriToFile(getReactApplicationContext(), contentMap.getString("localPath"));
|
|
@@ -1114,7 +1135,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1114
1135
|
if (contentMap.hasKey("duration")) {
|
|
1115
1136
|
voiceMessage.setDuration(contentMap.getInt("duration"));
|
|
1116
1137
|
}
|
|
1117
|
-
|
|
1138
|
+
|
|
1118
1139
|
Message message = JIM.getInstance().getMessageManager().sendMediaMessage(
|
|
1119
1140
|
voiceMessage,
|
|
1120
1141
|
conversation,
|
|
@@ -1150,7 +1171,7 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1150
1171
|
}
|
|
1151
1172
|
}
|
|
1152
1173
|
);
|
|
1153
|
-
|
|
1174
|
+
|
|
1154
1175
|
WritableMap result = convertMessageToMap(message);
|
|
1155
1176
|
promise.resolve(result);
|
|
1156
1177
|
} catch (Exception e) {
|
|
@@ -13,24 +13,35 @@ public class RNTypeConverter {
|
|
|
13
13
|
|
|
14
14
|
// === 对象 -> WritableMap ===
|
|
15
15
|
public static WritableMap toWritableMap(Object obj) {
|
|
16
|
+
return toWritableMap(obj, new HashSet<>());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private static WritableMap toWritableMap(Object obj, Set<Integer> visited) {
|
|
16
20
|
WritableMap map = new WritableNativeMap();
|
|
17
21
|
if (obj == null) return map;
|
|
18
22
|
|
|
23
|
+
int identityHashCode = System.identityHashCode(obj);
|
|
24
|
+
if (visited.contains(identityHashCode)) {
|
|
25
|
+
return map;
|
|
26
|
+
}
|
|
27
|
+
visited.add(identityHashCode);
|
|
28
|
+
|
|
19
29
|
try {
|
|
20
30
|
for (Field field : obj.getClass().getDeclaredFields()) {
|
|
21
31
|
field.setAccessible(true);
|
|
22
32
|
Object value = field.get(obj);
|
|
23
33
|
if (value == null) continue;
|
|
24
|
-
putValue(map, field.getName(), value);
|
|
34
|
+
putValue(map, field.getName(), value, visited);
|
|
25
35
|
}
|
|
26
36
|
} catch (IllegalAccessException e) {
|
|
27
37
|
e.printStackTrace();
|
|
28
38
|
}
|
|
29
|
-
|
|
39
|
+
|
|
40
|
+
visited.remove(identityHashCode);
|
|
30
41
|
return map;
|
|
31
42
|
}
|
|
32
43
|
|
|
33
|
-
private static void putValue(WritableMap map, String key, Object value) {
|
|
44
|
+
private static void putValue(WritableMap map, String key, Object value, Set<Integer> visited) {
|
|
34
45
|
if (value instanceof String) {
|
|
35
46
|
map.putString(key, (String) value);
|
|
36
47
|
} else if (value instanceof Integer) {
|
|
@@ -50,7 +61,7 @@ public class RNTypeConverter {
|
|
|
50
61
|
if (isPrimitive(item)) {
|
|
51
62
|
putArrayValue(array, item);
|
|
52
63
|
} else {
|
|
53
|
-
array.pushMap(toWritableMap(item));
|
|
64
|
+
array.pushMap(toWritableMap(item, visited));
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
67
|
map.putArray(key, array);
|
|
@@ -59,13 +70,13 @@ public class RNTypeConverter {
|
|
|
59
70
|
Map<?, ?> vMap = (Map<?, ?>) value;
|
|
60
71
|
for (Map.Entry<?, ?> entry : vMap.entrySet()) {
|
|
61
72
|
if (entry.getKey() != null && entry.getValue() != null) {
|
|
62
|
-
putValue(nested, entry.getKey().toString(), entry.getValue());
|
|
73
|
+
putValue(nested, entry.getKey().toString(), entry.getValue(), visited);
|
|
63
74
|
}
|
|
64
75
|
}
|
|
65
76
|
map.putMap(key, nested);
|
|
66
77
|
} else {
|
|
67
78
|
// 嵌套对象
|
|
68
|
-
map.putMap(key, toWritableMap(value));
|
|
79
|
+
map.putMap(key, toWritableMap(value, visited));
|
|
69
80
|
}
|
|
70
81
|
}
|
|
71
82
|
|
package/im-rn-sdk.podspec
CHANGED
package/ios/JuggleIMManager.m
CHANGED
|
@@ -1102,6 +1102,28 @@ RCT_EXPORT_METHOD(recallMessage:(NSDictionary *)messageDict
|
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
1104
|
|
|
1105
|
+
/**
|
|
1106
|
+
* 根据clientMsgNo列表删除消息
|
|
1107
|
+
*/
|
|
1108
|
+
RCT_EXPORT_METHOD(deleteMessagesByClientMsgNoList:(NSArray<NSNumber *> *)clientMsgNos
|
|
1109
|
+
conversation:(NSDictionary *)conversationMap
|
|
1110
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
1111
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
1112
|
+
@try {
|
|
1113
|
+
JConversation *conversation = [self convertDictionaryToConversation:conversationMap];
|
|
1114
|
+
|
|
1115
|
+
[JIM.shared.messageManager deleteMessagesByClientMsgNoList:clientMsgNos
|
|
1116
|
+
conversation:conversation
|
|
1117
|
+
success:^{
|
|
1118
|
+
resolve(@YES);
|
|
1119
|
+
} error:^(JErrorCode errorCode) {
|
|
1120
|
+
reject(@"DELETE_MESSAGES_ERROR", @"删除消息失败", [NSError errorWithDomain:@"JuggleIM" code:errorCode userInfo:nil]);
|
|
1121
|
+
}];
|
|
1122
|
+
} @catch (NSException *exception) {
|
|
1123
|
+
reject(@"DELETE_MESSAGES_ERROR", exception.reason, nil);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1105
1127
|
/**
|
|
1106
1128
|
* 添加消息反应
|
|
1107
1129
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "juggleim-rnsdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "React Native wrapper for Juggle IM SDK",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
"@types/react": "^18.2.45",
|
|
43
43
|
"@types/react-native": "^0.73.0"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -666,6 +666,13 @@ declare module "im-rn-sdk" {
|
|
|
666
666
|
extras?: { [key: string]: any }
|
|
667
667
|
): Promise<Boolean>;
|
|
668
668
|
|
|
669
|
+
/**
|
|
670
|
+
* 根据clientMsgNo列表删除消息
|
|
671
|
+
* @param conversation 会话
|
|
672
|
+
* @param clientMsgNos clientMsgNo列表
|
|
673
|
+
*/
|
|
674
|
+
static deleteMessagesByClientMsgNoList(conversation: Conversation, clientMsgNos: number[]): Promise<boolean>;
|
|
675
|
+
|
|
669
676
|
/**
|
|
670
677
|
* 添加消息反应
|
|
671
678
|
* @param messageId 消息ID
|
package/src/index.js
CHANGED
|
@@ -544,10 +544,10 @@ class JuggleIM {
|
|
|
544
544
|
callback = {}
|
|
545
545
|
) {
|
|
546
546
|
console.log("sendMessage message:", message);
|
|
547
|
-
|
|
547
|
+
|
|
548
548
|
// 生成唯一标识符以避免回调冲突
|
|
549
549
|
const messageId = Math.random().toString(36).substr(2, 9) + Date.now();
|
|
550
|
-
|
|
550
|
+
|
|
551
551
|
const successListener = juggleIMEmitter.addListener(
|
|
552
552
|
"onMessageSent",
|
|
553
553
|
(event) => {
|
|
@@ -592,10 +592,10 @@ class JuggleIM {
|
|
|
592
592
|
callback = {}
|
|
593
593
|
) {
|
|
594
594
|
console.log("sendImageMessage message...:", message);
|
|
595
|
-
|
|
595
|
+
|
|
596
596
|
// 生成唯一标识符以避免回调冲突
|
|
597
597
|
const messageId = Math.random().toString(36).substr(2, 9) + Date.now();
|
|
598
|
-
|
|
598
|
+
|
|
599
599
|
const progressListener = juggleIMEmitter.addListener(
|
|
600
600
|
"onMediaMessageProgress",
|
|
601
601
|
(event) => {
|
|
@@ -671,7 +671,7 @@ class JuggleIM {
|
|
|
671
671
|
) {
|
|
672
672
|
// 生成唯一标识符以避免回调冲突
|
|
673
673
|
const messageId = Math.random().toString(36).substr(2, 9) + Date.now();
|
|
674
|
-
|
|
674
|
+
|
|
675
675
|
// 添加监听器
|
|
676
676
|
const progressListener = juggleIMEmitter.addListener(
|
|
677
677
|
"onMediaMessageProgress",
|
|
@@ -748,7 +748,7 @@ class JuggleIM {
|
|
|
748
748
|
) {
|
|
749
749
|
// 生成唯一标识符以避免回调冲突
|
|
750
750
|
const messageId = Math.random().toString(36).substr(2, 9) + Date.now();
|
|
751
|
-
|
|
751
|
+
|
|
752
752
|
// 添加监听器
|
|
753
753
|
const progressListener = juggleIMEmitter.addListener(
|
|
754
754
|
"onMediaMessageProgress",
|
|
@@ -829,7 +829,21 @@ class JuggleIM {
|
|
|
829
829
|
* @param {Object} extras - kv 扩展信息
|
|
830
830
|
*/
|
|
831
831
|
static recallMessage(message, extras = {}) {
|
|
832
|
-
return JMI.recallMessage(message, extras
|
|
832
|
+
return JMI.recallMessage(message, extras);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* 根据clientMsgNo列表删除消息
|
|
837
|
+
* @param {object} conversation - 会话对象
|
|
838
|
+
* @param {number[]} clientMsgNos - clientMsgNo列表
|
|
839
|
+
* @returns {Promise<boolean>} 删除结果
|
|
840
|
+
*/
|
|
841
|
+
static deleteMessagesByClientMsgNoList(conversation, clientMsgNos) {
|
|
842
|
+
if (Platform.OS === "android") {
|
|
843
|
+
return JMI.deleteMessagesByClientMsgNoList(conversation, clientMsgNos);
|
|
844
|
+
} else if (Platform.OS === "ios") {
|
|
845
|
+
return JMI.deleteMessagesByClientMsgNoList(conversation, clientMsgNos);
|
|
846
|
+
}
|
|
833
847
|
}
|
|
834
848
|
|
|
835
849
|
/**
|
|
Binary file
|
|
Binary file
|