juggleim-rnsdk 1.0.0 → 1.0.1
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/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$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/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$23.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$24.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$25.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$26.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$27.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$28.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$29.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$30.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$31.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$32.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/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$1.class.uniqueId29 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$10.class.uniqueId21 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$11.class.uniqueId5 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$12.class.uniqueId15 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$13.class.uniqueId12 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$14.class.uniqueId24 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$15.class.uniqueId26 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$16.class.uniqueId10 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$17.class.uniqueId33 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$18.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$19.class.uniqueId23 +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.uniqueId20 +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$22.class.uniqueId32 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$23.class.uniqueId11 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$24.class.uniqueId27 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$25.class.uniqueId25 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$26.class.uniqueId13 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$27.class.uniqueId14 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$28.class.uniqueId4 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$29.class.uniqueId19 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$3.class.uniqueId16 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$30.class.uniqueId22 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$31.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$32.class.uniqueId31 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$4.class.uniqueId30 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$5.class.uniqueId9 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$6.class.uniqueId28 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$7.class.uniqueId7 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$8.class.uniqueId17 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$9.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager.class.uniqueId18 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/src/main/java/com/juggleim/JuggleIMManager.java +78 -0
- package/ios/JModelFactory.m +2 -2
- package/ios/JuggleIMManager.m +25 -0
- package/package.json +2 -1
- package/src/types.d.ts +25 -0
- package/src/types.js +15 -0
|
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
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -585,6 +585,17 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
585
585
|
map.putString("localPath", img.getLocalPath());
|
|
586
586
|
map.putString("thumbnailLocalPath", img.getThumbnailLocalPath());
|
|
587
587
|
map.putString("thumbnailUrl", img.getThumbnailUrl());
|
|
588
|
+
} else if (content instanceof VideoMessage) {
|
|
589
|
+
VideoMessage video = (VideoMessage) content;
|
|
590
|
+
map.putString("localPath", video.getLocalPath());
|
|
591
|
+
map.putString("url", video.getUrl());
|
|
592
|
+
map.putString("snapshotLocalPath", video.getSnapshotLocalPath());
|
|
593
|
+
map.putString("snapshotUrl", video.getSnapshotUrl());
|
|
594
|
+
map.putInt("width", video.getWidth());
|
|
595
|
+
map.putInt("height", video.getHeight());
|
|
596
|
+
map.putDouble("size", video.getSize());
|
|
597
|
+
map.putInt("duration", video.getDuration());
|
|
598
|
+
map.putString("extra", video.getExtra());
|
|
588
599
|
} else if (content instanceof StreamTextMessage) {
|
|
589
600
|
StreamTextMessage streamText = (StreamTextMessage) content;
|
|
590
601
|
map.putBoolean("isFinished", streamText.isFinished());
|
|
@@ -592,6 +603,49 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
592
603
|
return map;
|
|
593
604
|
}
|
|
594
605
|
|
|
606
|
+
/**
|
|
607
|
+
* 读取字符串字段,不存在或为空时返回空字符串。
|
|
608
|
+
*
|
|
609
|
+
* @param map 原始消息内容
|
|
610
|
+
* @param key 字段名
|
|
611
|
+
* @return 字符串字段值
|
|
612
|
+
*/
|
|
613
|
+
private String getOptionalString(ReadableMap map, String key) {
|
|
614
|
+
if (map.hasKey(key) && !map.isNull(key)) {
|
|
615
|
+
return map.getString(key);
|
|
616
|
+
}
|
|
617
|
+
return "";
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* 读取整数字段,不存在或为空时返回 0。
|
|
622
|
+
*
|
|
623
|
+
* @param map 原始消息内容
|
|
624
|
+
* @param key 字段名
|
|
625
|
+
* @return 整数字段值
|
|
626
|
+
*/
|
|
627
|
+
private int getOptionalInt(ReadableMap map, String key) {
|
|
628
|
+
if (map.hasKey(key) && !map.isNull(key)) {
|
|
629
|
+
return map.getInt(key);
|
|
630
|
+
}
|
|
631
|
+
return 0;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* 读取文件路径并兼容 content:// 和 file://。
|
|
636
|
+
*
|
|
637
|
+
* @param map 原始消息内容
|
|
638
|
+
* @param key 字段名
|
|
639
|
+
* @return 原生 SDK 可读取的本地文件路径
|
|
640
|
+
*/
|
|
641
|
+
private String getOptionalFilePath(ReadableMap map, String key) {
|
|
642
|
+
String path = getOptionalString(map, key);
|
|
643
|
+
if (path.isEmpty()) {
|
|
644
|
+
return "";
|
|
645
|
+
}
|
|
646
|
+
return FileUtils.convertContentUriToFile(getReactApplicationContext(), path);
|
|
647
|
+
}
|
|
648
|
+
|
|
595
649
|
private MessageContent convertMapToMessageContent(ReadableMap map) {
|
|
596
650
|
String contentType = map.getString("contentType");
|
|
597
651
|
switch (contentType) {
|
|
@@ -632,6 +686,30 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
632
686
|
voice.setExtra(map.getString("extra"));
|
|
633
687
|
}
|
|
634
688
|
return voice;
|
|
689
|
+
case "jg:video":
|
|
690
|
+
VideoMessage video = new VideoMessage();
|
|
691
|
+
String localPath = getOptionalFilePath(map, "localPath");
|
|
692
|
+
if (localPath.isEmpty()) {
|
|
693
|
+
localPath = getOptionalFilePath(map, "local");
|
|
694
|
+
}
|
|
695
|
+
video.setLocalPath(localPath);
|
|
696
|
+
video.setUrl(getOptionalString(map, "url"));
|
|
697
|
+
String snapshotUrl = getOptionalString(map, "snapshotUrl");
|
|
698
|
+
if (snapshotUrl.isEmpty()) {
|
|
699
|
+
snapshotUrl = getOptionalString(map, "poster");
|
|
700
|
+
}
|
|
701
|
+
video.setSnapshotUrl(snapshotUrl);
|
|
702
|
+
video.setSnapshotLocalPath(getOptionalFilePath(map, "snapshotLocalPath"));
|
|
703
|
+
video.setWidth(getOptionalInt(map, "width"));
|
|
704
|
+
video.setHeight(getOptionalInt(map, "height"));
|
|
705
|
+
if (map.hasKey("size") && !map.isNull("size")) {
|
|
706
|
+
video.setSize((long) map.getDouble("size"));
|
|
707
|
+
}
|
|
708
|
+
video.setDuration(getOptionalInt(map, "duration"));
|
|
709
|
+
if (map.hasKey("extra")) {
|
|
710
|
+
video.setExtra(map.getString("extra"));
|
|
711
|
+
}
|
|
712
|
+
return video;
|
|
635
713
|
case "jg:streamtext":
|
|
636
714
|
StreamTextMessage streamText = new StreamTextMessage();
|
|
637
715
|
if (map.hasKey("content")) {
|
package/ios/JModelFactory.m
CHANGED
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
JVideoMessage *video = (JVideoMessage *)content;
|
|
102
102
|
NSDictionary *dic = @{
|
|
103
103
|
@"url" : video.url ?: @"",
|
|
104
|
-
@"
|
|
105
|
-
@"
|
|
104
|
+
@"localPath" : video.localPath ?: @"",
|
|
105
|
+
@"snapshotUrl" : video.snapshotUrl ?: @"",
|
|
106
106
|
@"height" : @(video.height),
|
|
107
107
|
@"width" : @(video.width),
|
|
108
108
|
@"size" : @(video.size),
|
package/ios/JuggleIMManager.m
CHANGED
|
@@ -511,6 +511,17 @@ RCT_EXPORT_METHOD(addConversationDelegate) {
|
|
|
511
511
|
dict[@"localPath"] = voiceMsg.localPath ?: @"";
|
|
512
512
|
dict[@"duration"] = @(voiceMsg.duration);
|
|
513
513
|
dict[@"extra"] = voiceMsg.extra ?: @"";
|
|
514
|
+
} else if ([content isKindOfClass:[JVideoMessage class]]) {
|
|
515
|
+
JVideoMessage *videoMsg = (JVideoMessage *)content;
|
|
516
|
+
dict[@"url"] = videoMsg.url ?: @"";
|
|
517
|
+
dict[@"localPath"] = videoMsg.localPath ?: @"";
|
|
518
|
+
dict[@"snapshotUrl"] = videoMsg.snapshotUrl ?: @"";
|
|
519
|
+
dict[@"snapshotLocalPath"] = videoMsg.snapshotLocalPath ?: @"";
|
|
520
|
+
dict[@"width"] = @(videoMsg.width);
|
|
521
|
+
dict[@"height"] = @(videoMsg.height);
|
|
522
|
+
dict[@"size"] = @(videoMsg.size);
|
|
523
|
+
dict[@"duration"] = @(videoMsg.duration);
|
|
524
|
+
dict[@"extra"] = videoMsg.extra ?: @"";
|
|
514
525
|
} else if ([content isKindOfClass:[JStreamTextMessage class]]) {
|
|
515
526
|
JStreamTextMessage *streamMsg = (JStreamTextMessage *)content;
|
|
516
527
|
dict[@"content"] = streamMsg.content ?: @"";
|
|
@@ -1685,6 +1696,20 @@ RCT_EXPORT_METHOD(removeMessageReaction : (
|
|
|
1685
1696
|
voice.extra = messageDict[@"extra"];
|
|
1686
1697
|
}
|
|
1687
1698
|
return voice;
|
|
1699
|
+
} else if ([contentType isEqualToString:@"jg:video"]) {
|
|
1700
|
+
JVideoMessage *video = [[JVideoMessage alloc] init];
|
|
1701
|
+
video.url = messageDict[@"url"];
|
|
1702
|
+
video.localPath = messageDict[@"localPath"] ?: messageDict[@"local"];
|
|
1703
|
+
video.snapshotUrl = messageDict[@"snapshotUrl"] ?: messageDict[@"poster"];
|
|
1704
|
+
video.snapshotLocalPath = messageDict[@"snapshotLocalPath"];
|
|
1705
|
+
video.width = [messageDict[@"width"] integerValue];
|
|
1706
|
+
video.height = [messageDict[@"height"] integerValue];
|
|
1707
|
+
video.size = [messageDict[@"size"] longLongValue];
|
|
1708
|
+
video.duration = [messageDict[@"duration"] integerValue];
|
|
1709
|
+
if (messageDict[@"extra"]) {
|
|
1710
|
+
video.extra = messageDict[@"extra"];
|
|
1711
|
+
}
|
|
1712
|
+
return video;
|
|
1688
1713
|
} else if ([contentType isEqualToString:@"jg:streamtext"]) {
|
|
1689
1714
|
JStreamTextMessage *streamText = [[JStreamTextMessage alloc] init];
|
|
1690
1715
|
streamText.content = messageDict[@"content"] ?: @"";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "juggleim-rnsdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React Native wrapper for Juggle IM SDK",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
22
|
+
"test:video-media-bridge": "node scripts/check-video-media-bridge.js",
|
|
22
23
|
"app": "cd app && npm start",
|
|
23
24
|
"prepare": "npm run build",
|
|
24
25
|
"build": "echo \"Build completed\""
|
package/src/types.d.ts
CHANGED
|
@@ -198,6 +198,31 @@ export class VoiceMessageContent extends MessageContent {
|
|
|
198
198
|
contentType: string;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
/**
|
|
202
|
+
* 视频消息内容
|
|
203
|
+
* @property {string} localPath - 视频本地路径:支持 /、file://、content://
|
|
204
|
+
* @property {string} [url] - 视频远程URL
|
|
205
|
+
* @property {string} [snapshotUrl] - 视频封面远程URL
|
|
206
|
+
* @property {string} [snapshotLocalPath] - 视频封面本地路径
|
|
207
|
+
* @property {number} width - 视频宽度
|
|
208
|
+
* @property {number} height - 视频高度
|
|
209
|
+
* @property {number} size - 视频文件大小,单位字节
|
|
210
|
+
* @property {number} duration - 视频时长,单位秒
|
|
211
|
+
*/
|
|
212
|
+
export class VideoMessageContent extends MessageContent {
|
|
213
|
+
localPath: string;
|
|
214
|
+
url?: string;
|
|
215
|
+
snapshotUrl?: string;
|
|
216
|
+
snapshotLocalPath?: string;
|
|
217
|
+
width: number;
|
|
218
|
+
height: number;
|
|
219
|
+
size: number;
|
|
220
|
+
duration: number;
|
|
221
|
+
extra?: string;
|
|
222
|
+
|
|
223
|
+
contentType: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
201
226
|
/**
|
|
202
227
|
* 通话结束通知消息内容: jg:callfinishntf
|
|
203
228
|
* @property {number} reason - 结束原因
|
package/src/types.js
CHANGED
|
@@ -133,6 +133,21 @@ export class VoiceMessageContent extends MessageContent {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
/**
|
|
137
|
+
* 视频消息内容
|
|
138
|
+
*/
|
|
139
|
+
export class VideoMessageContent extends MessageContent {
|
|
140
|
+
constructor(localPath, width, height, duration, size = 0) {
|
|
141
|
+
super();
|
|
142
|
+
this.contentType = "jg:video";
|
|
143
|
+
this.localPath = localPath;
|
|
144
|
+
this.width = width;
|
|
145
|
+
this.height = height;
|
|
146
|
+
this.duration = duration;
|
|
147
|
+
this.size = size;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
136
151
|
/**
|
|
137
152
|
* 流式文本消息内容
|
|
138
153
|
*/
|