juggleim-rnsdk 0.1.9 → 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.
Files changed (85) hide show
  1. package/android/build/.transforms/42b8ab7e96b9440b0e91d2ecba5f579c/transformed/classes/classes_dex/classes.dex +0 -0
  2. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMPackage.dex +0 -0
  3. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$1.dex +0 -0
  4. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$10.dex +0 -0
  5. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$2.dex +0 -0
  6. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$3.dex +0 -0
  7. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$4.dex +0 -0
  8. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$5.dex +0 -0
  9. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$6.dex +0 -0
  10. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$7.dex +0 -0
  11. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$8.dex +0 -0
  12. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule$9.dex +0 -0
  13. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/moment/JuggleIMMomentModule.dex +0 -0
  14. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  15. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  16. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMPackage.class +0 -0
  17. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$1.class +0 -0
  18. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$10.class +0 -0
  19. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$2.class +0 -0
  20. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$3.class +0 -0
  21. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$4.class +0 -0
  22. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$5.class +0 -0
  23. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$6.class +0 -0
  24. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$7.class +0 -0
  25. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$8.class +0 -0
  26. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule$9.class +0 -0
  27. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/moment/JuggleIMMomentModule.class +0 -0
  28. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMPackage.class +0 -0
  29. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$1.class +0 -0
  30. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$10.class +0 -0
  31. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$2.class +0 -0
  32. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$3.class +0 -0
  33. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$4.class +0 -0
  34. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$5.class +0 -0
  35. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$6.class +0 -0
  36. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$7.class +0 -0
  37. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$8.class +0 -0
  38. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule$9.class +0 -0
  39. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/moment/JuggleIMMomentModule.class +0 -0
  40. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  41. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMCallModule$1.class.uniqueId2 +0 -0
  42. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMCallModule$2.class.uniqueId14 +0 -0
  43. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMCallModule$3.class.uniqueId11 +0 -0
  44. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMCallModule.class.uniqueId1 +0 -0
  45. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$10.class.uniqueId0 +0 -0
  46. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$11.class.uniqueId14 → JuggleIMManager$11.class.uniqueId18} +0 -0
  47. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$12.class.uniqueId23 → JuggleIMManager$12.class.uniqueId27} +0 -0
  48. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$13.class.uniqueId7 → JuggleIMManager$13.class.uniqueId9} +0 -0
  49. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$14.class.uniqueId16 → JuggleIMManager$14.class.uniqueId20} +0 -0
  50. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$15.class.uniqueId6 → JuggleIMManager$15.class.uniqueId8} +0 -0
  51. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$16.class.uniqueId11 → JuggleIMManager$16.class.uniqueId15} +0 -0
  52. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$17.class.uniqueId24 → JuggleIMManager$17.class.uniqueId28} +0 -0
  53. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$18.class.uniqueId8 → JuggleIMManager$18.class.uniqueId10} +0 -0
  54. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$19.class.uniqueId21 → JuggleIMManager$19.class.uniqueId25} +0 -0
  55. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$20.class.uniqueId5 → JuggleIMManager$20.class.uniqueId7} +0 -0
  56. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$21.class.uniqueId13 → JuggleIMManager$21.class.uniqueId17} +0 -0
  57. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$22.class.uniqueId19 → JuggleIMManager$22.class.uniqueId23} +0 -0
  58. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$23.class.uniqueId10 → JuggleIMManager$23.class.uniqueId13} +0 -0
  59. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$6.class.uniqueId12 → JuggleIMManager$6.class.uniqueId16} +0 -0
  60. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$7.class.uniqueId4 → JuggleIMManager$7.class.uniqueId6} +0 -0
  61. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$8.class.uniqueId17 → JuggleIMManager$8.class.uniqueId21} +0 -0
  62. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$9.class.uniqueId20 → JuggleIMManager$9.class.uniqueId24} +0 -0
  63. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager.class.uniqueId1 → JuggleIMManager.class.uniqueId3} +0 -0
  64. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  65. package/android/build.gradle +1 -1
  66. package/android/src/main/java/com/juggleim/JuggleIMPackage.java +2 -0
  67. package/android/src/main/java/com/juggleim/moment/JuggleIMMomentModule.java +376 -0
  68. package/ios/JModelFactory.m +14 -14
  69. package/ios/moment/JuggleIMMomentModule.h +5 -0
  70. package/ios/moment/JuggleIMMomentModule.m +207 -0
  71. package/juggleim-rnsdk.podspec +1 -1
  72. package/package.json +1 -1
  73. package/src/index.d.ts +3 -0
  74. package/src/index.js +8 -13
  75. package/src/moment/index.ts +85 -0
  76. package/src/moment/types.ts +51 -0
  77. package/src/types.js +117 -0
  78. package/ios/call/README.md +0 -51
  79. /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$1.class.uniqueId25 → JuggleIMManager$1.class.uniqueId29} +0 -0
  80. /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$2.class.uniqueId3 → JuggleIMManager$2.class.uniqueId5} +0 -0
  81. /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$24.class.uniqueId15 → JuggleIMManager$24.class.uniqueId19} +0 -0
  82. /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$3.class.uniqueId18 → JuggleIMManager$3.class.uniqueId22} +0 -0
  83. /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$4.class.uniqueId22 → JuggleIMManager$4.class.uniqueId26} +0 -0
  84. /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$5.class.uniqueId9 → JuggleIMManager$5.class.uniqueId12} +0 -0
  85. /package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMPackage.class.uniqueId2 → JuggleIMPackage.class.uniqueId4} +0 -0
@@ -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.27.1'
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
+ }
@@ -391,7 +391,7 @@
391
391
  return @{
392
392
  @"url" : media.url ?: @"",
393
393
  @"type" : @(media.type),
394
- @"snapshot_url" : media.snapshotUrl ?: @"",
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
- @"comment_id" : comment.commentId ?: @"",
416
- @"moment_id" : comment.momentId ?: @"",
417
- @"parent_comment_id" : comment.parentCommentId ?: @"",
415
+ @"commentId" : comment.commentId ?: @"",
416
+ @"momentId" : comment.momentId ?: @"",
417
+ @"parentCommentId" : comment.parentCommentId ?: @"",
418
418
  @"content" : comment.content ?: @"",
419
- @"user_info" : [self userInfoToDic:comment.userInfo],
420
- @"parent_user_info" : [self userInfoToDic:comment.parentUserInfo],
421
- @"comment_time" : @(comment.createTime)
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[@"moment_id"] = momentId;
430
+ resultDic[@"momentId"] = momentId;
431
431
  NSString *contentText = moment.content ?: @"";
432
- resultDic[@"content"] = @{@"text" : contentText};
433
- resultDic[@"moment_time"] = @(moment.createTime);
432
+ resultDic[@"content"] = contentText ?: @"";
433
+ resultDic[@"createTime"] = @(moment.createTime);
434
434
  if (moment.userInfo && [moment.userInfo isKindOfClass:[JUserInfo class]]) {
435
- resultDic[@"user_info"] = [self userInfoToDic:moment.userInfo];
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[@"medias"] = mediasDicArray;
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[@"top_comments"] = commentsDicArray;
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[@"snapshot_url"];
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,5 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface JuggleIMMomentModule : NSObject <RCTBridgeModule>
4
+
5
+ @end