juggleim-rnsdk 0.1.10 → 0.1.11
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/42b8ab7e96b9440b0e91d2ecba5f579c/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMPackage.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$1.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$10.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$2.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$3.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$4.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$5.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$6.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$7.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$8.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$9.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule.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/JuggleIMPackage.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$10.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$3.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$4.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$5.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$6.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$7.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$8.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$9.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMPackage.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$10.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$3.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$4.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$5.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$6.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$7.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$8.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$9.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule.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/JuggleIMCallModule$1.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMCallModule$2.class.uniqueId14 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMCallModule$3.class.uniqueId11 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMCallModule.class.uniqueId1 +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.uniqueId14 → JuggleIMManager$11.class.uniqueId18} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$12.class.uniqueId23 → JuggleIMManager$12.class.uniqueId27} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$13.class.uniqueId7 → JuggleIMManager$13.class.uniqueId9} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$14.class.uniqueId16 → JuggleIMManager$14.class.uniqueId20} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$15.class.uniqueId6 → JuggleIMManager$15.class.uniqueId8} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$16.class.uniqueId11 → JuggleIMManager$16.class.uniqueId15} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$17.class.uniqueId24 → JuggleIMManager$17.class.uniqueId28} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$18.class.uniqueId8 → JuggleIMManager$18.class.uniqueId10} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$19.class.uniqueId21 → JuggleIMManager$19.class.uniqueId25} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$20.class.uniqueId5 → JuggleIMManager$20.class.uniqueId7} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$21.class.uniqueId13 → JuggleIMManager$21.class.uniqueId17} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$22.class.uniqueId19 → JuggleIMManager$22.class.uniqueId23} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$23.class.uniqueId10 → JuggleIMManager$23.class.uniqueId13} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$6.class.uniqueId12 → JuggleIMManager$6.class.uniqueId16} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$7.class.uniqueId4 → JuggleIMManager$7.class.uniqueId6} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$8.class.uniqueId17 → JuggleIMManager$8.class.uniqueId21} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$9.class.uniqueId20 → JuggleIMManager$9.class.uniqueId24} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager.class.uniqueId1 → JuggleIMManager.class.uniqueId3} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/juggleim/JuggleIMPackage.java +2 -0
- package/android/src/main/java/com/juggleim/moment/JuggleIMMomentModule.java +376 -0
- package/ios/JModelFactory.m +14 -14
- package/ios/moment/JuggleIMMomentModule.h +5 -0
- package/ios/moment/JuggleIMMomentModule.m +207 -0
- package/juggleim-rnsdk.podspec +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +3 -0
- package/src/index.js +7 -0
- package/src/moment/index.ts +85 -0
- package/src/moment/types.ts +51 -0
- package/ios/call/README.md +0 -51
- /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$1.class.uniqueId25 → JuggleIMManager$1.class.uniqueId29} +0 -0
- /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$2.class.uniqueId3 → JuggleIMManager$2.class.uniqueId5} +0 -0
- /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$24.class.uniqueId15 → JuggleIMManager$24.class.uniqueId19} +0 -0
- /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$3.class.uniqueId18 → JuggleIMManager$3.class.uniqueId22} +0 -0
- /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$4.class.uniqueId22 → JuggleIMManager$4.class.uniqueId26} +0 -0
- /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$5.class.uniqueId9 → JuggleIMManager$5.class.uniqueId12} +0 -0
- /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMPackage.class.uniqueId2 → JuggleIMPackage.class.uniqueId4} +0 -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
|
package/android/build.gradle
CHANGED
|
@@ -44,7 +44,7 @@ repositories {
|
|
|
44
44
|
|
|
45
45
|
dependencies {
|
|
46
46
|
implementation 'com.facebook.react:react-native:0.71.1'
|
|
47
|
-
implementation 'com.juggle.im:juggle:1.8.
|
|
47
|
+
implementation 'com.juggle.im:juggle:1.8.28.1'
|
|
48
48
|
implementation 'com.juggle.call.zego:juggle:1.8.25'
|
|
49
49
|
implementation 'im.zego:express-video:3.17.3'
|
|
50
50
|
}
|
|
@@ -18,6 +18,8 @@ public class JuggleIMPackage implements ReactPackage {
|
|
|
18
18
|
List<NativeModule> modules = new ArrayList<>();
|
|
19
19
|
modules.add(new JuggleIMManager(reactContext));
|
|
20
20
|
modules.add(new com.juggleim.call.JuggleIMCallModule(reactContext));
|
|
21
|
+
modules.add(new com.juggleim.moment.JuggleIMMomentModule(reactContext));
|
|
22
|
+
|
|
21
23
|
return modules;
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
package com.juggleim.moment;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments;
|
|
4
|
+
import com.facebook.react.bridge.Promise;
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
7
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
8
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
9
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
10
|
+
import com.facebook.react.bridge.WritableArray;
|
|
11
|
+
import com.facebook.react.bridge.WritableMap;
|
|
12
|
+
import com.juggle.im.JIM;
|
|
13
|
+
import com.juggle.im.JIMConst;
|
|
14
|
+
import com.juggle.im.interfaces.IMessageManager;
|
|
15
|
+
import com.juggle.im.interfaces.IMomentManager;
|
|
16
|
+
import com.juggle.im.model.GetMomentCommentOption;
|
|
17
|
+
import com.juggle.im.model.GetMomentOption;
|
|
18
|
+
import com.juggle.im.model.Moment;
|
|
19
|
+
import com.juggle.im.model.MomentComment;
|
|
20
|
+
import com.juggle.im.model.MomentMedia;
|
|
21
|
+
import com.juggle.im.model.MomentMedia.MomentMediaType;
|
|
22
|
+
import com.juggle.im.model.MomentReaction;
|
|
23
|
+
import com.juggle.im.model.UserInfo;
|
|
24
|
+
|
|
25
|
+
import java.util.ArrayList;
|
|
26
|
+
import java.util.List;
|
|
27
|
+
|
|
28
|
+
import javax.annotation.Nonnull;
|
|
29
|
+
|
|
30
|
+
public class JuggleIMMomentModule extends ReactContextBaseJavaModule {
|
|
31
|
+
private static final String MODULE_NAME = "JuggleIMMomentModule";
|
|
32
|
+
|
|
33
|
+
public JuggleIMMomentModule(ReactApplicationContext reactContext) {
|
|
34
|
+
super(reactContext);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Nonnull
|
|
38
|
+
@Override
|
|
39
|
+
public String getName() {
|
|
40
|
+
return MODULE_NAME;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private IMomentManager getMomentManager() {
|
|
44
|
+
return JIM.getInstance().getMomentManager();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
public void addMoment(String content, ReadableArray mediaList, Promise promise) {
|
|
49
|
+
List<MomentMedia> list = new ArrayList<>();
|
|
50
|
+
if (mediaList != null) {
|
|
51
|
+
for (int i = 0; i < mediaList.size(); i++) {
|
|
52
|
+
list.add(convertReadableMapToMomentMedia(mediaList.getMap(i)));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
getMomentManager().addMoment(content, list, new JIMConst.IResultCallback<Moment>() {
|
|
56
|
+
@Override
|
|
57
|
+
public void onSuccess(Moment moment) {
|
|
58
|
+
promise.resolve(convertMomentToWritableMap(moment));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Override
|
|
62
|
+
public void onError(int errorCode) {
|
|
63
|
+
reject(promise, errorCode);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@ReactMethod
|
|
69
|
+
public void removeMoment(String momentId, Promise promise) {
|
|
70
|
+
getMomentManager().removeMoment(momentId, new IMessageManager.ISimpleCallback() {
|
|
71
|
+
@Override
|
|
72
|
+
public void onSuccess() {
|
|
73
|
+
promise.resolve(null);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Override
|
|
77
|
+
public void onError(int errorCode) {
|
|
78
|
+
reject(promise, errorCode);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@ReactMethod
|
|
84
|
+
public void getCachedMomentList(ReadableMap optionMap, Promise promise) {
|
|
85
|
+
GetMomentOption option = convertReadableMapToGetMomentOption(optionMap);
|
|
86
|
+
List<Moment> list = getMomentManager().getCachedMomentList(option);
|
|
87
|
+
WritableArray array = Arguments.createArray();
|
|
88
|
+
if (list != null) {
|
|
89
|
+
for (Moment moment : list) {
|
|
90
|
+
array.pushMap(convertMomentToWritableMap(moment));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
promise.resolve(array);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@ReactMethod
|
|
97
|
+
public void getMomentList(ReadableMap optionMap, Promise promise) {
|
|
98
|
+
GetMomentOption option = convertReadableMapToGetMomentOption(optionMap);
|
|
99
|
+
getMomentManager().getMomentList(option, new JIMConst.IResultListCallback<Moment>() {
|
|
100
|
+
@Override
|
|
101
|
+
public void onSuccess(List<Moment> moments, boolean isFinish) {
|
|
102
|
+
WritableMap result = Arguments.createMap();
|
|
103
|
+
WritableArray array = Arguments.createArray();
|
|
104
|
+
for (Moment moment : moments) {
|
|
105
|
+
array.pushMap(convertMomentToWritableMap(moment));
|
|
106
|
+
}
|
|
107
|
+
result.putArray("list", array);
|
|
108
|
+
result.putBoolean("isFinished", isFinish);
|
|
109
|
+
promise.resolve(result);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@Override
|
|
113
|
+
public void onError(int errorCode) {
|
|
114
|
+
reject(promise, errorCode);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@ReactMethod
|
|
120
|
+
public void getMoment(String momentId, Promise promise) {
|
|
121
|
+
getMomentManager().getMoment(momentId, new JIMConst.IResultCallback<Moment>() {
|
|
122
|
+
@Override
|
|
123
|
+
public void onSuccess(Moment moment) {
|
|
124
|
+
promise.resolve(convertMomentToWritableMap(moment));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@Override
|
|
128
|
+
public void onError(int errorCode) {
|
|
129
|
+
reject(promise, errorCode);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@ReactMethod
|
|
135
|
+
public void addComment(String momentId, String parentCommentId, String content, Promise promise) {
|
|
136
|
+
getMomentManager().addComment(momentId, parentCommentId, content,
|
|
137
|
+
new JIMConst.IResultCallback<MomentComment>() {
|
|
138
|
+
@Override
|
|
139
|
+
public void onSuccess(MomentComment comment) {
|
|
140
|
+
promise.resolve(convertMomentCommentToWritableMap(comment));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@Override
|
|
144
|
+
public void onError(int errorCode) {
|
|
145
|
+
reject(promise, errorCode);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@ReactMethod
|
|
151
|
+
public void removeComment(String momentId, String commentId, Promise promise) {
|
|
152
|
+
getMomentManager().removeComment(momentId, commentId, new IMessageManager.ISimpleCallback() {
|
|
153
|
+
@Override
|
|
154
|
+
public void onSuccess() {
|
|
155
|
+
promise.resolve(null);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@Override
|
|
159
|
+
public void onError(int errorCode) {
|
|
160
|
+
reject(promise, errorCode);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@ReactMethod
|
|
166
|
+
public void getCommentList(ReadableMap optionMap, Promise promise) {
|
|
167
|
+
GetMomentCommentOption option = convertReadableMapToGetMomentCommentOption(optionMap);
|
|
168
|
+
getMomentManager().getCommentList(option, new JIMConst.IResultListCallback<MomentComment>() {
|
|
169
|
+
@Override
|
|
170
|
+
public void onSuccess(List<MomentComment> comments, boolean isFinish) {
|
|
171
|
+
WritableMap result = Arguments.createMap();
|
|
172
|
+
WritableArray array = Arguments.createArray();
|
|
173
|
+
for (MomentComment comment : comments) {
|
|
174
|
+
array.pushMap(convertMomentCommentToWritableMap(comment));
|
|
175
|
+
}
|
|
176
|
+
result.putArray("list", array);
|
|
177
|
+
result.putBoolean("isFinished", isFinish);
|
|
178
|
+
promise.resolve(result);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@Override
|
|
182
|
+
public void onError(int errorCode) {
|
|
183
|
+
reject(promise, errorCode);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@ReactMethod
|
|
189
|
+
public void addReaction(String momentId, String key, Promise promise) {
|
|
190
|
+
getMomentManager().addReaction(momentId, key, new IMessageManager.ISimpleCallback() {
|
|
191
|
+
@Override
|
|
192
|
+
public void onSuccess() {
|
|
193
|
+
promise.resolve(null);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@Override
|
|
197
|
+
public void onError(int errorCode) {
|
|
198
|
+
reject(promise, errorCode);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@ReactMethod
|
|
204
|
+
public void removeReaction(String momentId, String key, Promise promise) {
|
|
205
|
+
getMomentManager().removeReaction(momentId, key, new IMessageManager.ISimpleCallback() {
|
|
206
|
+
@Override
|
|
207
|
+
public void onSuccess() {
|
|
208
|
+
promise.resolve(null);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@Override
|
|
212
|
+
public void onError(int errorCode) {
|
|
213
|
+
reject(promise, errorCode);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@ReactMethod
|
|
219
|
+
public void getReactionList(String momentId, Promise promise) {
|
|
220
|
+
getMomentManager().getReactionList(momentId, new JIMConst.IResultListCallback<MomentReaction>() {
|
|
221
|
+
@Override
|
|
222
|
+
public void onSuccess(List<MomentReaction> reactions, boolean isFinish) {
|
|
223
|
+
WritableArray array = Arguments.createArray();
|
|
224
|
+
for (MomentReaction reaction : reactions) {
|
|
225
|
+
array.pushMap(convertMomentReactionToWritableMap(reaction));
|
|
226
|
+
}
|
|
227
|
+
promise.resolve(array);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@Override
|
|
231
|
+
public void onError(int errorCode) {
|
|
232
|
+
reject(promise, errorCode);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Helper methods
|
|
238
|
+
|
|
239
|
+
private void reject(Promise promise, int errorCode) {
|
|
240
|
+
WritableMap map = Arguments.createMap();
|
|
241
|
+
map.putInt("code", errorCode);
|
|
242
|
+
promise.reject(String.valueOf(errorCode), map);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private MomentMedia convertReadableMapToMomentMedia(ReadableMap map) {
|
|
246
|
+
MomentMedia media = new MomentMedia();
|
|
247
|
+
String typeStr = map.getString("type");
|
|
248
|
+
if ("image".equals(typeStr)) {
|
|
249
|
+
media.setType(MomentMediaType.IMAGE);
|
|
250
|
+
} else if ("video".equals(typeStr)) {
|
|
251
|
+
media.setType(MomentMediaType.VIDEO);
|
|
252
|
+
}
|
|
253
|
+
if (map.hasKey("url"))
|
|
254
|
+
media.setUrl(map.getString("url"));
|
|
255
|
+
if (map.hasKey("snapshotUrl"))
|
|
256
|
+
media.setSnapshotUrl(map.getString("snapshotUrl"));
|
|
257
|
+
if (map.hasKey("width"))
|
|
258
|
+
media.setWidth(map.getInt("width"));
|
|
259
|
+
if (map.hasKey("height"))
|
|
260
|
+
media.setHeight(map.getInt("height"));
|
|
261
|
+
if (map.hasKey("duration"))
|
|
262
|
+
media.setDuration(map.getInt("duration"));
|
|
263
|
+
return media;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private GetMomentOption convertReadableMapToGetMomentOption(ReadableMap map) {
|
|
267
|
+
GetMomentOption option = new GetMomentOption();
|
|
268
|
+
if (map.hasKey("count"))
|
|
269
|
+
option.setCount(map.getInt("count"));
|
|
270
|
+
if (map.hasKey("timestamp"))
|
|
271
|
+
// option.setTimestamp((long) map.getDouble("timestamp"));
|
|
272
|
+
option.setStartTime((long) map.getDouble("timestamp"));
|
|
273
|
+
if (map.hasKey("direction")) {
|
|
274
|
+
int dir = map.getInt("direction");
|
|
275
|
+
option.setDirection(dir == 0 ? JIMConst.PullDirection.NEWER : JIMConst.PullDirection.OLDER);
|
|
276
|
+
}
|
|
277
|
+
return option;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
private GetMomentCommentOption convertReadableMapToGetMomentCommentOption(ReadableMap map) {
|
|
281
|
+
GetMomentCommentOption option = new GetMomentCommentOption();
|
|
282
|
+
if (map.hasKey("momentId"))
|
|
283
|
+
option.setMomentId(map.getString("momentId"));
|
|
284
|
+
if (map.hasKey("count"))
|
|
285
|
+
option.setCount(map.getInt("count"));
|
|
286
|
+
if (map.hasKey("timestamp"))
|
|
287
|
+
// option.setTimestamp((long) map.getDouble("timestamp"));
|
|
288
|
+
option.setStartTime((long) map.getDouble("timestamp"));
|
|
289
|
+
if (map.hasKey("direction")) {
|
|
290
|
+
int dir = map.getInt("direction");
|
|
291
|
+
option.setDirection(dir == 0 ? JIMConst.PullDirection.NEWER : JIMConst.PullDirection.OLDER);
|
|
292
|
+
}
|
|
293
|
+
return option;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
private WritableMap convertMomentToWritableMap(Moment moment) {
|
|
297
|
+
WritableMap map = Arguments.createMap();
|
|
298
|
+
map.putString("momentId", moment.getMomentId());
|
|
299
|
+
map.putString("content", moment.getContent());
|
|
300
|
+
map.putMap("userInfo", convertUserInfoToWritableMap(moment.getUserInfo()));
|
|
301
|
+
map.putDouble("createTime", moment.getCreateTime());
|
|
302
|
+
|
|
303
|
+
WritableArray mediaList = Arguments.createArray();
|
|
304
|
+
if (moment.getMediaList() != null) {
|
|
305
|
+
for (MomentMedia media : moment.getMediaList()) {
|
|
306
|
+
mediaList.pushMap(convertMomentMediaToWritableMap(media));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
map.putArray("mediaList", mediaList);
|
|
310
|
+
|
|
311
|
+
WritableArray commentList = Arguments.createArray();
|
|
312
|
+
if (moment.getCommentList() != null) {
|
|
313
|
+
for (MomentComment comment : moment.getCommentList()) {
|
|
314
|
+
commentList.pushMap(convertMomentCommentToWritableMap(comment));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
map.putArray("commentList", commentList);
|
|
318
|
+
|
|
319
|
+
WritableArray reactionList = Arguments.createArray();
|
|
320
|
+
if (moment.getReactionList() != null) {
|
|
321
|
+
for (MomentReaction reaction : moment.getReactionList()) {
|
|
322
|
+
reactionList.pushMap(convertMomentReactionToWritableMap(reaction));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
map.putArray("reactionList", reactionList);
|
|
326
|
+
|
|
327
|
+
return map;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
private WritableMap convertMomentMediaToWritableMap(MomentMedia media) {
|
|
331
|
+
WritableMap map = Arguments.createMap();
|
|
332
|
+
map.putString("type", media.getType() == MomentMediaType.IMAGE ? "image" : "video");
|
|
333
|
+
map.putString("url", media.getUrl());
|
|
334
|
+
map.putString("snapshotUrl", media.getSnapshotUrl());
|
|
335
|
+
map.putInt("width", media.getWidth());
|
|
336
|
+
map.putInt("height", media.getHeight());
|
|
337
|
+
map.putInt("duration", media.getDuration());
|
|
338
|
+
return map;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
private WritableMap convertMomentCommentToWritableMap(MomentComment comment) {
|
|
342
|
+
WritableMap map = Arguments.createMap();
|
|
343
|
+
map.putString("commentId", comment.getCommentId());
|
|
344
|
+
map.putString("momentId", comment.getMomentId());
|
|
345
|
+
map.putString("parentCommentId", comment.getParentCommentId());
|
|
346
|
+
map.putString("content", comment.getContent());
|
|
347
|
+
map.putMap("userInfo", convertUserInfoToWritableMap(comment.getUserInfo()));
|
|
348
|
+
if (comment.getParentUserInfo() != null) {
|
|
349
|
+
map.putMap("parentUserInfo", convertUserInfoToWritableMap(comment.getParentUserInfo()));
|
|
350
|
+
}
|
|
351
|
+
map.putDouble("createTime", comment.getCreateTime());
|
|
352
|
+
return map;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
private WritableMap convertMomentReactionToWritableMap(MomentReaction reaction) {
|
|
356
|
+
WritableMap map = Arguments.createMap();
|
|
357
|
+
map.putString("key", reaction.getKey());
|
|
358
|
+
WritableArray userList = Arguments.createArray();
|
|
359
|
+
if (reaction.getUserList() != null) {
|
|
360
|
+
for (UserInfo userInfo : reaction.getUserList()) {
|
|
361
|
+
userList.pushMap(convertUserInfoToWritableMap(userInfo));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
map.putArray("userList", userList);
|
|
365
|
+
return map;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
private WritableMap convertUserInfoToWritableMap(UserInfo userInfo) {
|
|
369
|
+
WritableMap map = Arguments.createMap();
|
|
370
|
+
map.putString("userId", userInfo.getUserId());
|
|
371
|
+
map.putString("nickname", userInfo.getUserName());
|
|
372
|
+
map.putString("avatar", userInfo.getPortrait());
|
|
373
|
+
// Add other fields if necessary
|
|
374
|
+
return map;
|
|
375
|
+
}
|
|
376
|
+
}
|
package/ios/JModelFactory.m
CHANGED
|
@@ -391,7 +391,7 @@
|
|
|
391
391
|
return @{
|
|
392
392
|
@"url" : media.url ?: @"",
|
|
393
393
|
@"type" : @(media.type),
|
|
394
|
-
@"
|
|
394
|
+
@"snapshotUrl" : media.snapshotUrl ?: @"",
|
|
395
395
|
@"height" : @(media.height),
|
|
396
396
|
@"width" : @(media.width),
|
|
397
397
|
@"duration" : @(media.duration)
|
|
@@ -412,13 +412,13 @@
|
|
|
412
412
|
if (!comment)
|
|
413
413
|
return @{};
|
|
414
414
|
return @{
|
|
415
|
-
@"
|
|
416
|
-
@"
|
|
417
|
-
@"
|
|
415
|
+
@"commentId" : comment.commentId ?: @"",
|
|
416
|
+
@"momentId" : comment.momentId ?: @"",
|
|
417
|
+
@"parentCommentId" : comment.parentCommentId ?: @"",
|
|
418
418
|
@"content" : comment.content ?: @"",
|
|
419
|
-
@"
|
|
420
|
-
@"
|
|
421
|
-
@"
|
|
419
|
+
@"userInfo" : [self userInfoToDic:comment.userInfo],
|
|
420
|
+
@"parentUserInfo" : [self userInfoToDic:comment.parentUserInfo],
|
|
421
|
+
@"commentTime" : @(comment.createTime)
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
424
|
|
|
@@ -427,12 +427,12 @@
|
|
|
427
427
|
return @{};
|
|
428
428
|
NSMutableDictionary *resultDic = [NSMutableDictionary dictionary];
|
|
429
429
|
NSString *momentId = moment.momentId ?: @"";
|
|
430
|
-
resultDic[@"
|
|
430
|
+
resultDic[@"momentId"] = momentId;
|
|
431
431
|
NSString *contentText = moment.content ?: @"";
|
|
432
|
-
resultDic[@"content"] = @
|
|
433
|
-
resultDic[@"
|
|
432
|
+
resultDic[@"content"] = contentText ?: @"";
|
|
433
|
+
resultDic[@"createTime"] = @(moment.createTime);
|
|
434
434
|
if (moment.userInfo && [moment.userInfo isKindOfClass:[JUserInfo class]]) {
|
|
435
|
-
resultDic[@"
|
|
435
|
+
resultDic[@"userInfo"] = [self userInfoToDic:moment.userInfo];
|
|
436
436
|
}
|
|
437
437
|
NSArray *mediaArray = moment.mediaArray ?: @[];
|
|
438
438
|
NSMutableArray *mediasDicArray =
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
[mediasDicArray addObject:[self momentMediaToDic:media]];
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
resultDic[@"
|
|
445
|
+
resultDic[@"mediaList"] = mediasDicArray;
|
|
446
446
|
|
|
447
447
|
NSArray *reactionArray = moment.reactionArray ?: @[];
|
|
448
448
|
NSMutableArray *reactionsDicArray =
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
[commentsDicArray addObject:[self momentCommentToDic:comment]];
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
resultDic[@"
|
|
465
|
+
resultDic[@"commentList"] = commentsDicArray;
|
|
466
466
|
|
|
467
467
|
return [resultDic copy];
|
|
468
468
|
}
|
|
@@ -543,7 +543,7 @@
|
|
|
543
543
|
JMomentMedia *media = [[JMomentMedia alloc] init];
|
|
544
544
|
|
|
545
545
|
media.url = dictionary[@"url"];
|
|
546
|
-
media.snapshotUrl = dictionary[@"
|
|
546
|
+
media.snapshotUrl = dictionary[@"snapshotUrl"];
|
|
547
547
|
media.type = [dictionary[@"type"] intValue];
|
|
548
548
|
media.height = [dictionary[@"height"] intValue];
|
|
549
549
|
media.width = [dictionary[@"width"] intValue];
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
#import "JuggleIMMomentModule.h"
|
|
2
|
+
#import "../JModelFactory.h"
|
|
3
|
+
#import <JuggleIM/JuggleIM.h>
|
|
4
|
+
|
|
5
|
+
@implementation JuggleIMMomentModule
|
|
6
|
+
|
|
7
|
+
RCT_EXPORT_MODULE()
|
|
8
|
+
|
|
9
|
+
- (id<JMomentProtocol>)getMomentManager {
|
|
10
|
+
return [JIM.shared momentManager];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
RCT_EXPORT_METHOD(addMoment : (NSString *)content mediaList : (NSArray *)
|
|
14
|
+
mediaList resolver : (RCTPromiseResolveBlock)
|
|
15
|
+
resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
16
|
+
NSMutableArray *mediaArray = [NSMutableArray array];
|
|
17
|
+
if (mediaList) {
|
|
18
|
+
for (NSDictionary *dic in mediaList) {
|
|
19
|
+
JMomentMedia *media = [JModelFactory momentMediaFromDic:dic];
|
|
20
|
+
if (media) {
|
|
21
|
+
[mediaArray addObject:media];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[[self getMomentManager]
|
|
27
|
+
addMoment:content
|
|
28
|
+
mediaList:mediaArray
|
|
29
|
+
complete:^(JErrorCode errorCode, JMoment *_Nullable moment) {
|
|
30
|
+
if (errorCode == JErrorCodeNone) {
|
|
31
|
+
resolve([JModelFactory momentToDic:moment]);
|
|
32
|
+
} else {
|
|
33
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
34
|
+
@"addMoment failed", nil);
|
|
35
|
+
}
|
|
36
|
+
}];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
RCT_EXPORT_METHOD(removeMoment : (NSString *)momentId resolver : (
|
|
40
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
41
|
+
[[self getMomentManager]
|
|
42
|
+
removeMoment:momentId
|
|
43
|
+
complete:^(JErrorCode errorCode) {
|
|
44
|
+
if (errorCode == JErrorCodeNone) {
|
|
45
|
+
resolve(nil);
|
|
46
|
+
} else {
|
|
47
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
48
|
+
@"removeMoment failed", nil);
|
|
49
|
+
}
|
|
50
|
+
}];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
RCT_EXPORT_METHOD(getCachedMomentList : (NSDictionary *)optionMap resolver : (
|
|
54
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
55
|
+
JGetMomentOption *option = [JModelFactory getMomentOptionFromDic:optionMap];
|
|
56
|
+
NSArray *list = [[self getMomentManager] getCachedMomentList:option];
|
|
57
|
+
NSMutableArray *array = [NSMutableArray array];
|
|
58
|
+
for (JMoment *moment in list) {
|
|
59
|
+
[array addObject:[JModelFactory momentToDic:moment]];
|
|
60
|
+
}
|
|
61
|
+
resolve(array);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RCT_EXPORT_METHOD(getMomentList : (NSDictionary *)optionMap resolver : (
|
|
65
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
66
|
+
JGetMomentOption *option = [JModelFactory getMomentOptionFromDic:optionMap];
|
|
67
|
+
[[self getMomentManager]
|
|
68
|
+
getMomentList:option
|
|
69
|
+
complete:^(JErrorCode errorCode,
|
|
70
|
+
NSArray<JMoment *> *_Nullable momentList, BOOL isFinish) {
|
|
71
|
+
if (errorCode == JErrorCodeNone) {
|
|
72
|
+
NSMutableArray *array = [NSMutableArray array];
|
|
73
|
+
for (JMoment *moment in momentList) {
|
|
74
|
+
[array addObject:[JModelFactory momentToDic:moment]];
|
|
75
|
+
}
|
|
76
|
+
resolve(@{@"list" : array, @"isFinished" : @(isFinish)});
|
|
77
|
+
} else {
|
|
78
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
79
|
+
@"getMomentList failed", nil);
|
|
80
|
+
}
|
|
81
|
+
}];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
RCT_EXPORT_METHOD(getMoment : (NSString *)momentId resolver : (
|
|
85
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
86
|
+
[[self getMomentManager]
|
|
87
|
+
getMoment:momentId
|
|
88
|
+
complete:^(JErrorCode errorCode, JMoment *_Nullable moment) {
|
|
89
|
+
if (errorCode == JErrorCodeNone) {
|
|
90
|
+
resolve([JModelFactory momentToDic:moment]);
|
|
91
|
+
} else {
|
|
92
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
93
|
+
@"getMoment failed", nil);
|
|
94
|
+
}
|
|
95
|
+
}];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
RCT_EXPORT_METHOD(addComment : (NSString *)momentId parentCommentId : (
|
|
99
|
+
NSString *)parentCommentId content : (NSString *)
|
|
100
|
+
content resolver : (RCTPromiseResolveBlock)
|
|
101
|
+
resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
102
|
+
[[self getMomentManager]
|
|
103
|
+
addComment:momentId
|
|
104
|
+
parentCommentId:parentCommentId
|
|
105
|
+
content:content
|
|
106
|
+
complete:^(JErrorCode errorCode,
|
|
107
|
+
JMomentComment *_Nullable comment) {
|
|
108
|
+
if (errorCode == JErrorCodeNone) {
|
|
109
|
+
resolve([JModelFactory momentCommentToDic:comment]);
|
|
110
|
+
} else {
|
|
111
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
112
|
+
@"addComment failed", nil);
|
|
113
|
+
}
|
|
114
|
+
}];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
RCT_EXPORT_METHOD(removeComment : (NSString *)momentId commentId : (NSString *)
|
|
118
|
+
commentId resolver : (RCTPromiseResolveBlock)
|
|
119
|
+
resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
120
|
+
[[self getMomentManager]
|
|
121
|
+
removeComment:commentId
|
|
122
|
+
momentId:momentId
|
|
123
|
+
complete:^(JErrorCode errorCode) {
|
|
124
|
+
if (errorCode == JErrorCodeNone) {
|
|
125
|
+
resolve(nil);
|
|
126
|
+
} else {
|
|
127
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
128
|
+
@"removeComment failed", nil);
|
|
129
|
+
}
|
|
130
|
+
}];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
RCT_EXPORT_METHOD(getCommentList : (NSDictionary *)optionMap resolver : (
|
|
134
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
135
|
+
JGetMomentCommentOption *option =
|
|
136
|
+
[JModelFactory getMomentCommentOptionFromDic:optionMap];
|
|
137
|
+
[[self getMomentManager]
|
|
138
|
+
getCommentList:option
|
|
139
|
+
complete:^(JErrorCode errorCode,
|
|
140
|
+
NSArray<JMomentComment *> *_Nullable commentList,
|
|
141
|
+
BOOL isFinish) {
|
|
142
|
+
if (errorCode == JErrorCodeNone) {
|
|
143
|
+
NSMutableArray *array = [NSMutableArray array];
|
|
144
|
+
for (JMomentComment *comment in commentList) {
|
|
145
|
+
[array addObject:[JModelFactory momentCommentToDic:comment]];
|
|
146
|
+
}
|
|
147
|
+
resolve(@{@"list" : array, @"isFinished" : @(isFinish)});
|
|
148
|
+
} else {
|
|
149
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
150
|
+
@"getCommentList failed", nil);
|
|
151
|
+
}
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
RCT_EXPORT_METHOD(addReaction : (NSString *)momentId key : (NSString *)
|
|
156
|
+
key resolver : (RCTPromiseResolveBlock)
|
|
157
|
+
resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
158
|
+
[[self getMomentManager]
|
|
159
|
+
addReaction:momentId
|
|
160
|
+
key:key
|
|
161
|
+
complete:^(JErrorCode errorCode) {
|
|
162
|
+
if (errorCode == JErrorCodeNone) {
|
|
163
|
+
resolve(nil);
|
|
164
|
+
} else {
|
|
165
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
166
|
+
@"addReaction failed", nil);
|
|
167
|
+
}
|
|
168
|
+
}];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
RCT_EXPORT_METHOD(removeReaction : (NSString *)momentId key : (NSString *)
|
|
172
|
+
key resolver : (RCTPromiseResolveBlock)
|
|
173
|
+
resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
174
|
+
[[self getMomentManager]
|
|
175
|
+
removeReaction:momentId
|
|
176
|
+
key:key
|
|
177
|
+
complete:^(JErrorCode errorCode) {
|
|
178
|
+
if (errorCode == JErrorCodeNone) {
|
|
179
|
+
resolve(nil);
|
|
180
|
+
} else {
|
|
181
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
182
|
+
@"removeReaction failed", nil);
|
|
183
|
+
}
|
|
184
|
+
}];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
RCT_EXPORT_METHOD(getReactionList : (NSString *)momentId resolver : (
|
|
188
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
189
|
+
[[self getMomentManager]
|
|
190
|
+
getReactionList:momentId
|
|
191
|
+
complete:^(JErrorCode errorCode,
|
|
192
|
+
NSArray<JMomentReaction *> *_Nullable reactionList) {
|
|
193
|
+
if (errorCode == JErrorCodeNone) {
|
|
194
|
+
NSMutableArray *array = [NSMutableArray array];
|
|
195
|
+
for (JMomentReaction *reaction in reactionList) {
|
|
196
|
+
[array
|
|
197
|
+
addObject:[JModelFactory momentReactionToDic:reaction]];
|
|
198
|
+
}
|
|
199
|
+
resolve(array);
|
|
200
|
+
} else {
|
|
201
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode],
|
|
202
|
+
@"getReactionList failed", nil);
|
|
203
|
+
}
|
|
204
|
+
}];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@end
|
package/juggleim-rnsdk.podspec
CHANGED
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -983,4 +983,11 @@ class JuggleIM {
|
|
|
983
983
|
|
|
984
984
|
export * from './types';
|
|
985
985
|
export * from './call';
|
|
986
|
+
export * from './moment/types';
|
|
987
|
+
import { JuggleIMMoment } from './moment/index';
|
|
988
|
+
|
|
989
|
+
export {
|
|
990
|
+
JuggleIMMoment,
|
|
991
|
+
JuggleIM
|
|
992
|
+
};
|
|
986
993
|
export default JuggleIM;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
import { NativeModules, Platform } from 'react-native';
|
|
3
|
+
import { Moment, MomentComment, MomentReaction, GetMomentOption, GetMomentCommentOption } from './types';
|
|
4
|
+
import { SimpleCallback, UserInfo } from '../types';
|
|
5
|
+
|
|
6
|
+
const { JuggleIMMomentModule } = NativeModules;
|
|
7
|
+
|
|
8
|
+
export class JuggleIMMoment {
|
|
9
|
+
/**
|
|
10
|
+
* 发布朋友圈
|
|
11
|
+
*/
|
|
12
|
+
static addMoment(content: string, mediaList: any[]): Promise<Moment> {
|
|
13
|
+
return JuggleIMMomentModule.addMoment(content, mediaList);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 删除朋友圈
|
|
18
|
+
*/
|
|
19
|
+
static removeMoment(momentId: string): Promise<void> {
|
|
20
|
+
return JuggleIMMomentModule.removeMoment(momentId);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 获取缓存的朋友圈列表
|
|
25
|
+
*/
|
|
26
|
+
static getCachedMomentList(option: GetMomentOption): Promise<Moment[]> {
|
|
27
|
+
return JuggleIMMomentModule.getCachedMomentList(option);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 获取朋友圈列表
|
|
32
|
+
*/
|
|
33
|
+
static getMomentList(option: GetMomentOption): Promise<{ list: Moment[], isFinished: boolean }> {
|
|
34
|
+
return JuggleIMMomentModule.getMomentList(option);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 获取朋友圈详情
|
|
39
|
+
*/
|
|
40
|
+
static getMoment(momentId: string): Promise<Moment> {
|
|
41
|
+
return JuggleIMMomentModule.getMoment(momentId);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 发布评论
|
|
46
|
+
*/
|
|
47
|
+
static addComment(momentId: string, parentCommentId: string, content: string): Promise<MomentComment> {
|
|
48
|
+
return JuggleIMMomentModule.addComment(momentId, parentCommentId, content);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 删除评论
|
|
53
|
+
*/
|
|
54
|
+
static removeComment(momentId: string, commentId: string): Promise<void> {
|
|
55
|
+
return JuggleIMMomentModule.removeComment(momentId, commentId);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 获取评论列表
|
|
60
|
+
*/
|
|
61
|
+
static getCommentList(option: GetMomentCommentOption): Promise<{ list: MomentComment[], isFinished: boolean }> {
|
|
62
|
+
return JuggleIMMomentModule.getCommentList(option);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 添加点赞
|
|
67
|
+
*/
|
|
68
|
+
static addReaction(momentId: string, key: string): Promise<void> {
|
|
69
|
+
return JuggleIMMomentModule.addReaction(momentId, key);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 取消点赞
|
|
74
|
+
*/
|
|
75
|
+
static removeReaction(momentId: string, key: string): Promise<void> {
|
|
76
|
+
return JuggleIMMomentModule.removeReaction(momentId, key);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 获取点赞列表
|
|
81
|
+
*/
|
|
82
|
+
static getReactionList(momentId: string): Promise<MomentReaction[]> {
|
|
83
|
+
return JuggleIMMomentModule.getReactionList(momentId);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import { UserInfo, SimpleCallback } from '../types';
|
|
3
|
+
|
|
4
|
+
export type MomentMediaType = 'image' | 'video';
|
|
5
|
+
|
|
6
|
+
export interface MomentMedia {
|
|
7
|
+
type: MomentMediaType;
|
|
8
|
+
url: string;
|
|
9
|
+
snapshotUrl?: string; // For video thumbnail or image thumbnail
|
|
10
|
+
height: number;
|
|
11
|
+
width: number;
|
|
12
|
+
duration?: number; // Only for video
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MomentComment {
|
|
16
|
+
commentId: string;
|
|
17
|
+
momentId: string;
|
|
18
|
+
parentCommentId?: string;
|
|
19
|
+
content: string;
|
|
20
|
+
userInfo: UserInfo;
|
|
21
|
+
parentUserInfo?: UserInfo;
|
|
22
|
+
createTime: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface MomentReaction {
|
|
26
|
+
key: string;
|
|
27
|
+
userList: UserInfo[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Moment {
|
|
31
|
+
momentId: string;
|
|
32
|
+
content: string;
|
|
33
|
+
mediaList: MomentMedia[];
|
|
34
|
+
userInfo: UserInfo;
|
|
35
|
+
commentList: MomentComment[];
|
|
36
|
+
reactionList: MomentReaction[];
|
|
37
|
+
createTime: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface GetMomentOption {
|
|
41
|
+
count: number;
|
|
42
|
+
timestamp: number; // 0 for initial
|
|
43
|
+
direction: number; // 0 for new, 1 for old
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface GetMomentCommentOption {
|
|
47
|
+
momentId: string;
|
|
48
|
+
count: number;
|
|
49
|
+
timestamp: number;
|
|
50
|
+
direction: number;
|
|
51
|
+
}
|
package/ios/call/README.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# iOS Call Module - File Summary
|
|
2
|
-
|
|
3
|
-
## Created Files
|
|
4
|
-
|
|
5
|
-
### Bridge Module
|
|
6
|
-
- `ios/call/JuggleIMCallModule.h` - Main bridge module header
|
|
7
|
-
- `ios/call/JuggleIMCallModule.m` - Main bridge module implementation (450+ lines)
|
|
8
|
-
|
|
9
|
-
### View Components
|
|
10
|
-
- `ios/call/view/ZegoSurfaceView.h` - Video surface view header
|
|
11
|
-
- `ios/call/view/ZegoSurfaceView.m` - Video surface view implementation
|
|
12
|
-
- `ios/call/view/ZegoSurfaceViewManager.h` - View manager header
|
|
13
|
-
- `ios/call/view/ZegoSurfaceViewManager.m` - View manager implementation
|
|
14
|
-
|
|
15
|
-
## Modified Files
|
|
16
|
-
|
|
17
|
-
### Field Mapping Fixes
|
|
18
|
-
- `ios/JModelFactory.m`
|
|
19
|
-
- Line 330: `inviterId` → `inviter`
|
|
20
|
-
- Line 343: Added `currentMember` field
|
|
21
|
-
- Line 163: `userName` → `nickname`
|
|
22
|
-
- Line 167: `portrait` → `avatar`
|
|
23
|
-
|
|
24
|
-
## Directory Structure
|
|
25
|
-
```
|
|
26
|
-
ios/
|
|
27
|
-
├── call/
|
|
28
|
-
│ ├── JuggleIMCallModule.h
|
|
29
|
-
│ ├── JuggleIMCallModule.m
|
|
30
|
-
│ └── view/
|
|
31
|
-
│ ├── ZegoSurfaceView.h
|
|
32
|
-
│ ├── ZegoSurfaceView.m
|
|
33
|
-
│ ├── ZegoSurfaceViewManager.h
|
|
34
|
-
│ └── ZegoSurfaceViewManager.m
|
|
35
|
-
├── JModelFactory.h (existing, no changes)
|
|
36
|
-
└── JModelFactory.m (modified)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## TODO Items
|
|
40
|
-
|
|
41
|
-
See `walkthrough.md` for detailed TODO items that need verification:
|
|
42
|
-
1. Zego engine initialization appSign parameter
|
|
43
|
-
2. Remove delegate methods availability
|
|
44
|
-
3. Video denoise parameters conversion
|
|
45
|
-
|
|
46
|
-
## Next Steps
|
|
47
|
-
|
|
48
|
-
1. Verify TODO items against iOS SDK
|
|
49
|
-
2. Register modules in Xcode project/podspec
|
|
50
|
-
3. Test compilation
|
|
51
|
-
4. Test runtime functionality
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|