juggleim-rnsdk 0.1.3 → 0.1.5
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/README.md +1 -1
- package/android/.settings/org.eclipse.buildship.core.prefs +1 -1
- package/android/.settings/org.eclipse.jdt.core.prefs +4 -0
- package/android/build/.transforms/42b8ab7e96b9440b0e91d2ecba5f579c/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$1.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$10.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$11.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$12.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$13.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$14.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$15.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$16.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$17.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$18.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$19.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$2.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$20.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$21.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$22.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$23.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$3.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$4.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$5.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$6.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$7.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$8.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$9.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/RNTypeConverter$1.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/RNTypeConverter.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/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/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$10.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$11.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$12.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$13.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$14.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$15.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$16.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$17.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$18.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$19.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$20.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$21.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$22.class +0 -0
- package/android/build/{tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$22.class.uniqueId14 → intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$23.class} +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$3.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$4.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$5.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$6.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$7.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$8.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$9.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager.class +0 -0
- 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/JuggleIMManager$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$10.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$11.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$12.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$13.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$14.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$15.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$16.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$17.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$18.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$19.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$20.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$21.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$22.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$23.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$3.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$4.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$5.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$6.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$7.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$8.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$9.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager.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/previous-compilation-data.bin +0 -0
- package/android/src/main/java/com/juggleim/JuggleIMManager.java +124 -127
- package/android/src/main/java/com/juggleim/RNTypeConverter.java +79 -0
- package/ios/JModelFactory.h +53 -0
- package/ios/JModelFactory.m +783 -0
- package/ios/JuggleIMManager.m +52 -36
- package/package.json +1 -1
- package/src/index.d.ts +26 -1
- package/src/index.js +23 -1
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/GenericCustomMessage.dex +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/GenericCustomMessage.class +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$1.class.uniqueId23 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$10.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$11.class.uniqueId4 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$12.class.uniqueId20 +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.uniqueId7 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$15.class.uniqueId13 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$16.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$17.class.uniqueId22 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$18.class.uniqueId19 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$19.class.uniqueId17 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$2.class.uniqueId8 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$20.class.uniqueId12 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$21.class.uniqueId3 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$3.class.uniqueId10 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$4.class.uniqueId18 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$5.class.uniqueId21 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$6.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$7.class.uniqueId11 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$8.class.uniqueId9 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$9.class.uniqueId15 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager.class.uniqueId5 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMPackage.class.uniqueId6 +0 -0
- package/android/src/main/java/com/juggleim/GenericCustomMessage.java +0 -45
- package/ios/GenericCustomMessage.h +0 -24
- package/ios/GenericCustomMessage.m +0 -29
- /package/android/build/{intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/GenericCustomMessage.class → tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GenericCustomMessage.class.uniqueId0} +0 -0
package/ios/JuggleIMManager.m
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#import "JuggleIMManager.h"
|
|
2
|
-
#import "GenericCustomMessage.h"
|
|
3
2
|
#import <JuggleIM/JuggleIM.h>
|
|
4
3
|
#import <React/RCTEventEmitter.h>
|
|
5
4
|
|
|
@@ -33,7 +32,6 @@ RCT_EXPORT_METHOD(setServerUrls : (NSArray *)urls) {
|
|
|
33
32
|
RCT_EXPORT_METHOD(initWithAppKey : (NSString *)appKey) {
|
|
34
33
|
[[JIM shared] initWithAppKey:appKey];
|
|
35
34
|
[JIM.shared setConsoleLogLevel:JLogLevelVerbose];
|
|
36
|
-
[JIM.shared.messageManager registerContentType:[GenericCustomMessage class]];
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
/**
|
|
@@ -390,12 +388,17 @@ RCT_EXPORT_METHOD(addConversationDelegate) {
|
|
|
390
388
|
dict[@"senderUserId"] = message.senderUserId ?: @"";
|
|
391
389
|
dict[@"conversation"] =
|
|
392
390
|
[self convertConversationToDictionary:message.conversation];
|
|
393
|
-
|
|
391
|
+
NSDictionary *contentDic =
|
|
392
|
+
[self convertMessageContentToDictionary:message.content
|
|
393
|
+
type:message.contentType];
|
|
394
|
+
dict[@"content"] = contentDic;
|
|
394
395
|
dict[@"direction"] = @(message.direction);
|
|
395
396
|
dict[@"messageState"] = @(message.messageState);
|
|
396
397
|
|
|
397
398
|
// 添加是否已读
|
|
398
399
|
dict[@"hasRead"] = @(message.hasRead);
|
|
400
|
+
dict[@"isEdit"] = @(message.isEdit);
|
|
401
|
+
dict[@"isDeleted"] = @(message.isDeleted);
|
|
399
402
|
|
|
400
403
|
// 添加群消息阅读信息
|
|
401
404
|
if (message.groupReadInfo) {
|
|
@@ -441,10 +444,11 @@ RCT_EXPORT_METHOD(addConversationDelegate) {
|
|
|
441
444
|
/**
|
|
442
445
|
* 将消息内容转换为字典
|
|
443
446
|
*/
|
|
444
|
-
- (NSDictionary *)convertMessageContentToDictionary:(JMessageContent *)content
|
|
447
|
+
- (NSDictionary *)convertMessageContentToDictionary:(JMessageContent *)content
|
|
448
|
+
type:(NSString *)contentType {
|
|
445
449
|
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
|
446
|
-
NSString *
|
|
447
|
-
dict[@"contentType"] =
|
|
450
|
+
NSString *ct = [[content class] contentType];
|
|
451
|
+
dict[@"contentType"] = ct ?: @"";
|
|
448
452
|
|
|
449
453
|
if ([content isKindOfClass:[JTextMessage class]]) {
|
|
450
454
|
JTextMessage *textMsg = (JTextMessage *)content;
|
|
@@ -472,9 +476,9 @@ RCT_EXPORT_METHOD(addConversationDelegate) {
|
|
|
472
476
|
dict[@"localPath"] = voiceMsg.localPath ?: @"";
|
|
473
477
|
dict[@"duration"] = @(voiceMsg.duration);
|
|
474
478
|
dict[@"extra"] = voiceMsg.extra ?: @"";
|
|
475
|
-
} else if ([contentType
|
|
479
|
+
} else if (self.customMessageTypes[contentType]) {
|
|
476
480
|
// 处理自定义消息:解析 JSON 数据
|
|
477
|
-
|
|
481
|
+
JUnknownMessage *customMsg = (JUnknownMessage *)content;
|
|
478
482
|
NSData *data = [customMsg encode];
|
|
479
483
|
if (data) {
|
|
480
484
|
NSError *error = nil;
|
|
@@ -1334,8 +1338,18 @@ RCT_EXPORT_METHOD(removeMessageReaction : (
|
|
|
1334
1338
|
voice.duration = [messageDict[@"duration"] integerValue];
|
|
1335
1339
|
return voice;
|
|
1336
1340
|
} else if (self.customMessageTypes[contentType]) {
|
|
1337
|
-
|
|
1338
|
-
|
|
1341
|
+
NSString *contenType = messageDict[@"contentType"];
|
|
1342
|
+
NSError *error = nil;
|
|
1343
|
+
JUnknownMessage *unknown = [JUnknownMessage new];
|
|
1344
|
+
unknown.flags = JMessageFlagIsSave | JMessageFlagIsCountable;
|
|
1345
|
+
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:messageDict
|
|
1346
|
+
options:0
|
|
1347
|
+
error:&error];
|
|
1348
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData
|
|
1349
|
+
encoding:NSUTF8StringEncoding];
|
|
1350
|
+
unknown.content = jsonString;
|
|
1351
|
+
unknown.messageType = contenType;
|
|
1352
|
+
return unknown;
|
|
1339
1353
|
}
|
|
1340
1354
|
|
|
1341
1355
|
return nil;
|
|
@@ -1451,32 +1465,6 @@ RCT_EXPORT_METHOD(removeMessageReaction : (
|
|
|
1451
1465
|
return userInfo;
|
|
1452
1466
|
}
|
|
1453
1467
|
|
|
1454
|
-
/**
|
|
1455
|
-
* 创建自定义消息对象
|
|
1456
|
-
*/
|
|
1457
|
-
- (JMessageContent *)createCustomMessageFromDict:(NSDictionary *)dict {
|
|
1458
|
-
@try {
|
|
1459
|
-
// 将字典转换为 JSON 数据
|
|
1460
|
-
NSError *error = nil;
|
|
1461
|
-
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict
|
|
1462
|
-
options:0
|
|
1463
|
-
error:&error];
|
|
1464
|
-
if (error || !jsonData) {
|
|
1465
|
-
NSLog(@"创建自定义消息失败: %@", error.localizedDescription);
|
|
1466
|
-
return nil;
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
// 创建通用自定义消息对象
|
|
1470
|
-
GenericCustomMessage *customMsg = [[GenericCustomMessage alloc] init];
|
|
1471
|
-
[customMsg setData:jsonData];
|
|
1472
|
-
|
|
1473
|
-
return customMsg;
|
|
1474
|
-
} @catch (NSException *exception) {
|
|
1475
|
-
NSLog(@"创建自定义消息异常: %@", exception.reason);
|
|
1476
|
-
return nil;
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
1468
|
/**
|
|
1481
1469
|
* 发送消息已读回执
|
|
1482
1470
|
*/
|
|
@@ -1498,6 +1486,34 @@ RCT_EXPORT_METHOD(
|
|
|
1498
1486
|
}];
|
|
1499
1487
|
}
|
|
1500
1488
|
|
|
1489
|
+
/**
|
|
1490
|
+
* 更新消息
|
|
1491
|
+
*/
|
|
1492
|
+
RCT_EXPORT_METHOD(updateMessage : (NSString *)messageId content : (
|
|
1493
|
+
NSDictionary *)contentMap conversation : (NSDictionary *)
|
|
1494
|
+
conversationMap resolver : (RCTPromiseResolveBlock)
|
|
1495
|
+
resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
1496
|
+
@try {
|
|
1497
|
+
JMessageContent *content = [self convertDictToMessageContent:contentMap];
|
|
1498
|
+
JConversation *conversation =
|
|
1499
|
+
[self convertDictionaryToConversation:conversationMap];
|
|
1500
|
+
|
|
1501
|
+
[JIM.shared.messageManager updateMessage:content
|
|
1502
|
+
messageId:messageId
|
|
1503
|
+
inConversation:conversation
|
|
1504
|
+
success:^(JMessage *message) {
|
|
1505
|
+
resolve([self convertMessageToDictionary:message]);
|
|
1506
|
+
}
|
|
1507
|
+
error:^(JErrorCode code) {
|
|
1508
|
+
reject(@"error",
|
|
1509
|
+
[NSString stringWithFormat:@"Error code: %ld", (long)code],
|
|
1510
|
+
nil);
|
|
1511
|
+
}];
|
|
1512
|
+
} @catch (NSException *exception) {
|
|
1513
|
+
reject(@"UPDATE_MESSAGE_ERROR", exception.reason, nil);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1501
1517
|
/**
|
|
1502
1518
|
* 设置消息置顶
|
|
1503
1519
|
*/
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -202,12 +202,14 @@ declare module "juggleim-rnsdk" {
|
|
|
202
202
|
* @property {Conversation} conversation - 会话对象
|
|
203
203
|
* @property {MessageContent} content - 消息内容
|
|
204
204
|
* @property {GroupMessageReadInfo} [groupMessageReadInfo] - 群消息阅读信息(可选)
|
|
205
|
+
* @property {MessageMentionInfo} mentionInfo - 消息提及信息
|
|
206
|
+
* @property {Message} [referredMessage] - 引用的消息
|
|
205
207
|
*/
|
|
206
208
|
export interface Message {
|
|
207
209
|
clientMsgNo: number;
|
|
208
210
|
localAttribute: string;
|
|
209
211
|
messageState: number;
|
|
210
|
-
|
|
212
|
+
isEdit: boolean;
|
|
211
213
|
direction: number;
|
|
212
214
|
isDelete: boolean;
|
|
213
215
|
senderUserId: string;
|
|
@@ -218,6 +220,7 @@ declare module "juggleim-rnsdk" {
|
|
|
218
220
|
content: MessageContent;
|
|
219
221
|
groupMessageReadInfo?: GroupMessageReadInfo;
|
|
220
222
|
mentionInfo: MessageMentionInfo;
|
|
223
|
+
referredMessage?: Message;
|
|
221
224
|
}
|
|
222
225
|
|
|
223
226
|
/**
|
|
@@ -364,6 +367,11 @@ declare module "juggleim-rnsdk" {
|
|
|
364
367
|
onError?: (message: Message, errorCode: number) => void;
|
|
365
368
|
}
|
|
366
369
|
|
|
370
|
+
export interface UpdateMessageCallback {
|
|
371
|
+
onSuccess?: (message: Message) => void;
|
|
372
|
+
onError?: (errorCode: number) => void;
|
|
373
|
+
}
|
|
374
|
+
|
|
367
375
|
// 获取消息相关接口
|
|
368
376
|
export interface GetMessageOptions {
|
|
369
377
|
count?: number;
|
|
@@ -377,6 +385,8 @@ declare module "juggleim-rnsdk" {
|
|
|
377
385
|
content: MessageContent;
|
|
378
386
|
mentionInfo?: MessageMentionInfo;
|
|
379
387
|
pushData?: PushData;
|
|
388
|
+
// 引用消息ID
|
|
389
|
+
referredMessageId?: string;
|
|
380
390
|
}
|
|
381
391
|
/**
|
|
382
392
|
* 连接状态监听器回调函数
|
|
@@ -853,6 +863,21 @@ declare module "juggleim-rnsdk" {
|
|
|
853
863
|
messageIds: string[],
|
|
854
864
|
): Promise<Boolean>;
|
|
855
865
|
|
|
866
|
+
/**
|
|
867
|
+
* 更新消息
|
|
868
|
+
* @param messageId 消息ID
|
|
869
|
+
* @param content 新的消息内容
|
|
870
|
+
* @param conversation 会话对象
|
|
871
|
+
* @param callback 回调函数
|
|
872
|
+
* @returns {Promise<Message>} 更新后的消息对象
|
|
873
|
+
*/
|
|
874
|
+
static updateMessage(
|
|
875
|
+
messageId: string,
|
|
876
|
+
content: MessageContent,
|
|
877
|
+
conversation: Conversation,
|
|
878
|
+
callback?: UpdateMessageCallback
|
|
879
|
+
): Promise<Message>;
|
|
880
|
+
|
|
856
881
|
/**
|
|
857
882
|
* 设置消息置顶
|
|
858
883
|
* @param messageId 消息ID
|
package/src/index.js
CHANGED
|
@@ -626,7 +626,7 @@ class JuggleIM {
|
|
|
626
626
|
const localMsg = await JMI.sendMessage(message, messageId);
|
|
627
627
|
return localMsg;
|
|
628
628
|
} catch (error) {
|
|
629
|
-
callback.onError?.(
|
|
629
|
+
callback.onError?.(JSON.stringify(error), -1);
|
|
630
630
|
successListener.remove();
|
|
631
631
|
errorListener.remove();
|
|
632
632
|
console.error("sendMessage error:", error);
|
|
@@ -938,6 +938,28 @@ class JuggleIM {
|
|
|
938
938
|
return JMI.sendReadReceipt(conversation, messageIds);
|
|
939
939
|
}
|
|
940
940
|
|
|
941
|
+
/**
|
|
942
|
+
* 更新消息
|
|
943
|
+
* @param {string} messageId - 消息ID
|
|
944
|
+
* @param {MessageContent} content - 新的消息内容
|
|
945
|
+
* @param {Conversation} conversation - 会话对象
|
|
946
|
+
* @param {UpdateMessageCallback} callback - 回调对象
|
|
947
|
+
* @returns {Promise<Message>} 更新后的消息对象
|
|
948
|
+
*/
|
|
949
|
+
static async updateMessage(messageId, content, conversation, callback = {}) {
|
|
950
|
+
try {
|
|
951
|
+
const updatedMessage = await JMI.updateMessage(messageId, content, conversation);
|
|
952
|
+
if (callback.onSuccess) {
|
|
953
|
+
callback.onSuccess(updatedMessage);
|
|
954
|
+
}
|
|
955
|
+
return updatedMessage;
|
|
956
|
+
} catch (error) {
|
|
957
|
+
if (callback.onError) {
|
|
958
|
+
callback.onError(error.code || -1);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
941
963
|
/**
|
|
942
964
|
* 设置消息置顶
|
|
943
965
|
* @param {string} messageId - 消息ID
|
|
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
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
package com.juggleim;
|
|
2
|
-
|
|
3
|
-
import com.juggle.im.model.MessageContent;
|
|
4
|
-
import java.nio.charset.StandardCharsets;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 通用自定义消息类
|
|
8
|
-
* 用于承载 RN 层自定义消息的 JSON 数据
|
|
9
|
-
*/
|
|
10
|
-
public class GenericCustomMessage extends MessageContent {
|
|
11
|
-
private String mContentType = "jgrn:custom";
|
|
12
|
-
private byte[] mData;
|
|
13
|
-
|
|
14
|
-
public GenericCustomMessage() {
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@Override
|
|
18
|
-
public String getContentType() {
|
|
19
|
-
return mContentType;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Override
|
|
23
|
-
public byte[] encode() {
|
|
24
|
-
return mData;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@Override
|
|
28
|
-
public void decode(byte[] data) {
|
|
29
|
-
this.mData = data;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public void setData(byte[] data) {
|
|
33
|
-
this.mData = data;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public byte[] getData() {
|
|
37
|
-
return mData;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Override
|
|
41
|
-
public String conversationDigest() {
|
|
42
|
-
// 返回默认摘要
|
|
43
|
-
return "[自定义消息]";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#import <JuggleIM/JuggleIM.h>
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 通用自定义消息类
|
|
5
|
-
* 用于承载 RN 层自定义消息的 JSON 数据
|
|
6
|
-
*/
|
|
7
|
-
@interface GenericCustomMessage : JMessageContent
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 消息数据
|
|
11
|
-
*/
|
|
12
|
-
@property(nonatomic, strong) NSData *data;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 设置消息数据
|
|
16
|
-
*/
|
|
17
|
-
- (void)setData:(NSData *)data;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 获取消息数据
|
|
21
|
-
*/
|
|
22
|
-
- (NSData *)getData;
|
|
23
|
-
|
|
24
|
-
@end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#import "GenericCustomMessage.h"
|
|
2
|
-
|
|
3
|
-
@implementation GenericCustomMessage
|
|
4
|
-
|
|
5
|
-
+ (NSString *)contentType {
|
|
6
|
-
return @"jgrn:custom";
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
- (NSData *)encode {
|
|
10
|
-
return self.data;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
- (void)decode:(NSData *)data {
|
|
14
|
-
self.data = data;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
- (void)setData:(NSData *)data {
|
|
18
|
-
_data = data;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
- (NSData *)getData {
|
|
22
|
-
return _data;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
- (NSString *)conversationDigest {
|
|
26
|
-
return @"[自定义消息]";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@end
|