juggleim-rnsdk 0.1.8 → 0.1.9
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/JuggleIMManager$1.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$10.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$11.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$12.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$13.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$14.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$15.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$16.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$17.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$18.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$19.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$2.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$20.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$21.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$22.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$23.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$24.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$3.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$4.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$5.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$6.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$7.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$8.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$9.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager.dex +0 -0
- package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$10.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$11.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$12.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$13.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$14.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$15.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$16.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$17.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$18.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$19.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$20.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$21.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$22.class +0 -0
- package/android/build/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$3.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$4.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$5.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$6.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$7.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$8.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$9.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$10.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$11.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$12.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$13.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$14.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$15.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$16.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$17.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$18.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$19.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$20.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$21.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$22.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$23.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$24.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$3.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$4.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$5.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$6.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$7.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$8.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$9.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$1.class.uniqueId24 → JuggleIMManager$1.class.uniqueId25} +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 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$12.class.uniqueId23 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$13.class.uniqueId7 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$14.class.uniqueId16 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$15.class.uniqueId6 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$16.class.uniqueId11 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$17.class.uniqueId24 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$18.class.uniqueId8 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$19.class.uniqueId21 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$2.class.uniqueId3 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$20.class.uniqueId5 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$21.class.uniqueId13 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$22.class.uniqueId19 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$23.class.uniqueId10 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$24.class.uniqueId15 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$3.class.uniqueId17 → JuggleIMManager$3.class.uniqueId18} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$4.class.uniqueId21 → JuggleIMManager$4.class.uniqueId22} +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.uniqueId12 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$7.class.uniqueId4 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$9.class.uniqueId19 → JuggleIMManager$8.class.uniqueId17} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{JuggleIMManager$8.class.uniqueId16 → JuggleIMManager$9.class.uniqueId20} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/src/main/java/com/juggleim/JuggleIMManager.java +31 -1
- package/ios/JuggleIMManager.m +27 -1
- package/package.json +1 -1
- package/src/call/JuggleIMCall.ts +57 -0
- package/src/index.d.ts +7 -0
- package/src/index.js +9 -0
- package/README.md +0 -552
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$12.class.uniqueId22 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$14.class.uniqueId15 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$17.class.uniqueId23 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$19.class.uniqueId20 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$22.class.uniqueId18 +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
|
|
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
|
|
@@ -45,6 +45,8 @@ import java.nio.charset.StandardCharsets;
|
|
|
45
45
|
import org.json.JSONObject;
|
|
46
46
|
import org.json.JSONArray;
|
|
47
47
|
import org.json.JSONException;
|
|
48
|
+
import android.graphics.Bitmap;
|
|
49
|
+
import android.graphics.BitmapFactory;
|
|
48
50
|
|
|
49
51
|
import javax.annotation.Nonnull;
|
|
50
52
|
|
|
@@ -795,6 +797,33 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
795
797
|
promise.resolve(convertConversationInfoToMap(conversationInfo));
|
|
796
798
|
}
|
|
797
799
|
|
|
800
|
+
/**
|
|
801
|
+
* 上传图片
|
|
802
|
+
*/
|
|
803
|
+
@ReactMethod
|
|
804
|
+
public void uploadImage(String localPath, Promise promise) {
|
|
805
|
+
try {
|
|
806
|
+
String path = localPath;
|
|
807
|
+
if (path.startsWith("file://")) {
|
|
808
|
+
path = path.substring(7);
|
|
809
|
+
}
|
|
810
|
+
JIM.getInstance().getMessageManager().uploadImage(localPath, new JIMConst.IResultCallback<String>() {
|
|
811
|
+
@Override
|
|
812
|
+
public void onSuccess(String s) {
|
|
813
|
+
promise.resolve(s);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
@Override
|
|
817
|
+
public void onError(int i) {
|
|
818
|
+
promise.reject(String.valueOf(i), "Upload failed with code: " + i);
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
} catch (Exception e) {
|
|
822
|
+
e.printStackTrace();
|
|
823
|
+
promise.reject("-1", e.getMessage());
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
798
827
|
/**
|
|
799
828
|
* 创建会话信息
|
|
800
829
|
*/
|
|
@@ -1066,7 +1095,8 @@ public class JuggleIMManager extends ReactContextBaseJavaModule {
|
|
|
1066
1095
|
getOptions.setStartTime((long) options.getDouble("startTime"));
|
|
1067
1096
|
}
|
|
1068
1097
|
|
|
1069
|
-
JIMConst.PullDirection pullDirection = direction == 0 ? JIMConst.PullDirection.NEWER
|
|
1098
|
+
JIMConst.PullDirection pullDirection = direction == 0 ? JIMConst.PullDirection.NEWER
|
|
1099
|
+
: JIMConst.PullDirection.OLDER;
|
|
1070
1100
|
JIM.getInstance().getMessageManager().getMessages(
|
|
1071
1101
|
conversation,
|
|
1072
1102
|
pullDirection,
|
package/ios/JuggleIMManager.m
CHANGED
|
@@ -652,6 +652,32 @@ RCT_EXPORT_METHOD(getConversationInfo : (NSDictionary *)
|
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
654
|
|
|
655
|
+
/**
|
|
656
|
+
* 上传图片
|
|
657
|
+
*/
|
|
658
|
+
RCT_EXPORT_METHOD(uploadImage : (NSString *)localPath resolver : (
|
|
659
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
660
|
+
NSString *path = localPath;
|
|
661
|
+
if ([path hasPrefix:@"file://"]) {
|
|
662
|
+
path = [path substringFromIndex:7];
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
UIImage *image = [UIImage imageWithContentsOfFile:path];
|
|
666
|
+
if (!image) {
|
|
667
|
+
reject(@"-1", @"Image decode failed", nil);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
[JIM.shared.messageManager uploadImage:image
|
|
672
|
+
success:^(NSString *url) {
|
|
673
|
+
resolve(url);
|
|
674
|
+
}
|
|
675
|
+
error:^(JErrorCode code) {
|
|
676
|
+
reject([NSString stringWithFormat:@"%ld", (long)code], @"Upload failed",
|
|
677
|
+
nil);
|
|
678
|
+
}];
|
|
679
|
+
}
|
|
680
|
+
|
|
655
681
|
/**
|
|
656
682
|
* 创建会话信息
|
|
657
683
|
*/
|
|
@@ -1167,7 +1193,7 @@ RCT_EXPORT_METHOD(getMessages : (NSDictionary *)conversationDict direction : (
|
|
|
1167
1193
|
|
|
1168
1194
|
JPullDirection pullDirection =
|
|
1169
1195
|
direction == 0 ? JPullDirectionNewer : JPullDirectionOlder;
|
|
1170
|
-
|
|
1196
|
+
NSLog(@"getMessages start");
|
|
1171
1197
|
[JIM.shared.messageManager
|
|
1172
1198
|
getMessages:conversation
|
|
1173
1199
|
direction:pullDirection
|
package/package.json
CHANGED
package/src/call/JuggleIMCall.ts
CHANGED
|
@@ -9,46 +9,98 @@ const { JuggleIMCallModule } = NativeModules;
|
|
|
9
9
|
const eventEmitter = new NativeEventEmitter(JuggleIMCallModule);
|
|
10
10
|
|
|
11
11
|
export interface CallReceiveListener {
|
|
12
|
+
/**
|
|
13
|
+
* 收到通话请求的回调
|
|
14
|
+
* @param callSession 通话会话对象
|
|
15
|
+
*/
|
|
12
16
|
onCallReceive(callSession: CallSession): void;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export interface ConversationCallListener {
|
|
20
|
+
/**
|
|
21
|
+
* 会话中通话信息更新的回调
|
|
22
|
+
* @param callInfo 通话信息
|
|
23
|
+
* @param conversation 所属会话
|
|
24
|
+
* @param isFinished 通话是否已结束
|
|
25
|
+
*/
|
|
16
26
|
onCallInfoUpdate(callInfo: CallInfo, conversation: Conversation, isFinished: boolean): void;
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
export default class JuggleIMCall {
|
|
30
|
+
/**
|
|
31
|
+
* 初始化 Zego 引擎
|
|
32
|
+
* @param appId Zego App ID
|
|
33
|
+
*/
|
|
20
34
|
static initZegoEngine(appId: number): void {
|
|
21
35
|
JuggleIMCallModule.initZegoEngine(appId);
|
|
22
36
|
}
|
|
23
37
|
|
|
38
|
+
/**
|
|
39
|
+
* 初始化 LiveKit 引擎
|
|
40
|
+
*/
|
|
24
41
|
static initLiveKitEngine(): void {
|
|
25
42
|
JuggleIMCallModule.initLiveKitEngine();
|
|
26
43
|
}
|
|
27
44
|
|
|
45
|
+
/**
|
|
46
|
+
* 初始化 Agora 引擎
|
|
47
|
+
* @param appId Agora App ID
|
|
48
|
+
*/
|
|
28
49
|
static initAgoraEngine(appId: string): void {
|
|
29
50
|
JuggleIMCallModule.initAgoraEngine(appId);
|
|
30
51
|
}
|
|
31
52
|
|
|
53
|
+
/**
|
|
54
|
+
* 发起单人通话
|
|
55
|
+
* @param userId 对方用户 ID
|
|
56
|
+
* @param mediaType 通话媒体类型 (音频/视频)
|
|
57
|
+
* @param extra 扩展信息
|
|
58
|
+
* @returns Promise<CallSession> 通话会话对象
|
|
59
|
+
*/
|
|
32
60
|
static startSingleCall(userId: string, mediaType: CallMediaType, extra?: string): Promise<CallSession> {
|
|
33
61
|
return JuggleIMCallModule.startSingleCall(userId, mediaType, extra || "")
|
|
34
62
|
.then((session: any) => new CallSession(session));
|
|
35
63
|
}
|
|
36
64
|
|
|
65
|
+
/**
|
|
66
|
+
* 发起群组/多人通话
|
|
67
|
+
* @param userIdList 参与者用户 ID 列表
|
|
68
|
+
* @param mediaType 通话媒体类型 (音频/视频)
|
|
69
|
+
* @param extra 扩展信息
|
|
70
|
+
* @param conversation 关联的会话信息 (可选)
|
|
71
|
+
* @returns Promise<CallSession> 通话会话对象
|
|
72
|
+
*/
|
|
37
73
|
static startMultiCall(userIdList: string[], mediaType: CallMediaType, extra?: string, conversation?: Conversation): Promise<CallSession> {
|
|
38
74
|
return JuggleIMCallModule.startMultiCall(userIdList, mediaType, extra || "", conversation)
|
|
39
75
|
.then((session: any) => new CallSession(session));
|
|
40
76
|
}
|
|
41
77
|
|
|
78
|
+
/**
|
|
79
|
+
* 加入通话
|
|
80
|
+
* @param callId 通话 ID
|
|
81
|
+
* @returns Promise<CallSession> 通话会话对象
|
|
82
|
+
*/
|
|
42
83
|
static joinCall(callId: string): Promise<CallSession> {
|
|
43
84
|
return JuggleIMCallModule.joinCall(callId)
|
|
44
85
|
.then((session: any) => new CallSession(session));
|
|
45
86
|
}
|
|
46
87
|
|
|
88
|
+
/**
|
|
89
|
+
* 获取通话会话实例
|
|
90
|
+
* @param callId 通话 ID
|
|
91
|
+
* @returns Promise<CallSession | null> 通话会话对象,如果不存在则返回 null
|
|
92
|
+
*/
|
|
47
93
|
static getCallSession(callId: string): Promise<CallSession | null> {
|
|
48
94
|
return JuggleIMCallModule.getCallSession(callId)
|
|
49
95
|
.then((session: any) => session ? new CallSession(session) : null);
|
|
50
96
|
}
|
|
51
97
|
|
|
98
|
+
/**
|
|
99
|
+
* 添加收到通话请求的监听器
|
|
100
|
+
* 在全局或者应用首页添加,用于处理收到的通话请求
|
|
101
|
+
* @param listener 监听器回调
|
|
102
|
+
* @returns 取消监听的函数
|
|
103
|
+
*/
|
|
52
104
|
static addReceiveListener(listener: CallReceiveListener): () => void {
|
|
53
105
|
const key = `CallManager_Receive_${Date.now()}`;
|
|
54
106
|
JuggleIMCallModule.addReceiveListener(key);
|
|
@@ -63,6 +115,11 @@ export default class JuggleIMCall {
|
|
|
63
115
|
};
|
|
64
116
|
}
|
|
65
117
|
|
|
118
|
+
/**
|
|
119
|
+
* 添加会话通话信息监听器
|
|
120
|
+
* @param listener 监听器回调
|
|
121
|
+
* @returns 取消监听的函数
|
|
122
|
+
*/
|
|
66
123
|
static addConversationCallListener(listener: ConversationCallListener): () => void {
|
|
67
124
|
const key = `CallManager_Conversation_${Date.now()}`;
|
|
68
125
|
JuggleIMCallModule.addConversationCallListener(key);
|
package/src/index.d.ts
CHANGED
|
@@ -270,6 +270,13 @@ export default class JuggleIM {
|
|
|
270
270
|
options: ConversationTagOptions
|
|
271
271
|
): Promise<Boolean>;
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* 上传图片
|
|
275
|
+
* @param localPath 图片本地路径
|
|
276
|
+
* @returns {Promise<string>} 图片URL
|
|
277
|
+
*/
|
|
278
|
+
static uploadImage(localPath: string): Promise<string>;
|
|
279
|
+
|
|
273
280
|
/**
|
|
274
281
|
* 发送消息
|
|
275
282
|
* @param {SendMessageObject} message 发送消息对象
|
package/src/index.js
CHANGED
|
@@ -583,6 +583,15 @@ class JuggleIM {
|
|
|
583
583
|
return JMI.removeConversationsFromTag(conversations, tagId);
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
+
/**
|
|
587
|
+
* 上传图片
|
|
588
|
+
* @param {string} localPath - 图片本地路径
|
|
589
|
+
* @returns {Promise<string>} 图片URL
|
|
590
|
+
*/
|
|
591
|
+
static uploadImage(localPath) {
|
|
592
|
+
return JMI.uploadImage(localPath);
|
|
593
|
+
}
|
|
594
|
+
|
|
586
595
|
//message
|
|
587
596
|
|
|
588
597
|
/**
|
package/README.md
DELETED
|
@@ -1,552 +0,0 @@
|
|
|
1
|
-
,
|
|
2
|
-
# Juggle IM React Native SDK
|
|
3
|
-
|
|
4
|
-
React Native wrapper for Juggle IM SDK,提供即时通讯功能的React Native封装。
|
|
5
|
-
|
|
6
|
-
## 安装
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install juggleim-rnsdk --legacy-peer-deps
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## 初始化
|
|
13
|
-
|
|
14
|
-
在使用Juggle IM SDK之前,需要先进行初始化设置:
|
|
15
|
-
|
|
16
|
-
```javascript
|
|
17
|
-
import JuggleIM from 'juggleim-rnsdk';
|
|
18
|
-
|
|
19
|
-
// 设置服务器地址
|
|
20
|
-
JuggleIM.setServerUrls(['your_server_url']);
|
|
21
|
-
|
|
22
|
-
// 初始化SDK
|
|
23
|
-
JuggleIM.init('your_app_key');
|
|
24
|
-
|
|
25
|
-
// 连接服务器
|
|
26
|
-
JuggleIM.connect('your_token');
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## 监听器
|
|
30
|
-
|
|
31
|
-
### 连接状态监听
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
const unsubscribe = JuggleIM.addConnectionStatusListener('listener_key', (status, code, extra) => {
|
|
35
|
-
console.log('Connection status:', status);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// 取消监听
|
|
39
|
-
// unsubscribe();
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 消息监听
|
|
43
|
-
|
|
44
|
-
```javascript
|
|
45
|
-
const unsubscribe = JuggleIM.addMessageListener('listener_key', {
|
|
46
|
-
onMessageReceive: (message) => {
|
|
47
|
-
console.log('Received message:', message);
|
|
48
|
-
},
|
|
49
|
-
onMessageRecall: (message) => {
|
|
50
|
-
console.log('Message recalled:', message);
|
|
51
|
-
},
|
|
52
|
-
onMessageUpdate: (message) => {
|
|
53
|
-
console.log('Message updated:', message);
|
|
54
|
-
},
|
|
55
|
-
onMessageDelete: (conversation, clientMsgNos) => {
|
|
56
|
-
console.log('Messages deleted:', conversation, clientMsgNos);
|
|
57
|
-
},
|
|
58
|
-
onMessageClear: (conversation, timestamp, senderId) => {
|
|
59
|
-
console.log('Messages cleared:', conversation, timestamp, senderId);
|
|
60
|
-
},
|
|
61
|
-
onMessageReactionAdd: (conversation, reaction) => {
|
|
62
|
-
console.log('Message reaction added:', conversation, reaction);
|
|
63
|
-
},
|
|
64
|
-
onMessageReactionRemove: (conversation, reaction) => {
|
|
65
|
-
console.log('Message reaction removed:', conversation, reaction);
|
|
66
|
-
},
|
|
67
|
-
onMessageSetTop: (message, operator, isTop) => {
|
|
68
|
-
console.log('Message set top:', message, operator, isTop);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// 取消监听
|
|
73
|
-
// unsubscribe();
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### 消息阅读状态监听
|
|
77
|
-
|
|
78
|
-
```javascript
|
|
79
|
-
const unsubscribe = JuggleIM.addMessageReadReceiptListener('read_listener_key', {
|
|
80
|
-
onMessagesRead: (conversation, messageIds) => {
|
|
81
|
-
console.log('Messages read:', conversation, messageIds);
|
|
82
|
-
},
|
|
83
|
-
onGroupMessagesRead: (conversation, messages) => {
|
|
84
|
-
console.log('Group messages read info updated:', conversation, messages);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// 取消监听
|
|
89
|
-
// unsubscribe();
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 消息销毁监听
|
|
93
|
-
|
|
94
|
-
```javascript
|
|
95
|
-
const unsubscribe = JuggleIM.addMessageDestroyListener('destroy_listener_key', {
|
|
96
|
-
onMessageDestroyTimeUpdate: (messageId, conversation, destroyTime) => {
|
|
97
|
-
console.log('Message destroy time updated:', messageId, conversation, destroyTime);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// 取消监听
|
|
102
|
-
// unsubscribe();
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### 会话监听
|
|
106
|
-
|
|
107
|
-
```javascript
|
|
108
|
-
const unsubscribe = JuggleIM.addConversationListener('listener_key', {
|
|
109
|
-
onConversationInfoAdd: (conversations) => {
|
|
110
|
-
console.log('New conversations:', conversations);
|
|
111
|
-
},
|
|
112
|
-
onConversationInfoUpdate: (conversations) => {
|
|
113
|
-
console.log('Updated conversations:', conversations);
|
|
114
|
-
},
|
|
115
|
-
onConversationInfoDelete: (conversations) => {
|
|
116
|
-
console.log('Deleted conversations:', conversations);
|
|
117
|
-
},
|
|
118
|
-
onTotalUnreadMessageCountUpdate: (count) => {
|
|
119
|
-
console.log('Total unread count updated:', count);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// 取消监听
|
|
124
|
-
// unsubscribe();
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## 会话操作
|
|
128
|
-
|
|
129
|
-
### 获取会话列表
|
|
130
|
-
|
|
131
|
-
```javascript
|
|
132
|
-
// 获取会话信息列表
|
|
133
|
-
const conversations = await JuggleIM.getConversationInfoList({
|
|
134
|
-
count: 20,
|
|
135
|
-
timestamp: Date.now(),
|
|
136
|
-
direction: 1 // 0-更新的消息, 1-更早的消息
|
|
137
|
-
});
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### 获取单个会话
|
|
141
|
-
|
|
142
|
-
```javascript
|
|
143
|
-
const conversationInfo = await JuggleIM.getConversationInfo({
|
|
144
|
-
conversationType: 1, // ConversationType.PRIVATE
|
|
145
|
-
conversationId: 'user123'
|
|
146
|
-
});
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### 创建会话
|
|
150
|
-
|
|
151
|
-
```javascript
|
|
152
|
-
const conversationInfo = await JuggleIM.createConversationInfo({
|
|
153
|
-
conversationType: 1,
|
|
154
|
-
conversationId: 'user123'
|
|
155
|
-
});
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### 删除会话
|
|
159
|
-
|
|
160
|
-
```javascript
|
|
161
|
-
const result = await JuggleIM.deleteConversationInfo({
|
|
162
|
-
conversationType: 1,
|
|
163
|
-
conversationId: 'user123'
|
|
164
|
-
}, {
|
|
165
|
-
onSuccess: () => {
|
|
166
|
-
console.log('Conversation deleted successfully');
|
|
167
|
-
},
|
|
168
|
-
onError: (errorCode) => {
|
|
169
|
-
console.log('Failed to delete conversation, error code:', errorCode);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### 会话免打扰设置
|
|
175
|
-
|
|
176
|
-
```javascript
|
|
177
|
-
const result = await JuggleIM.setMute({
|
|
178
|
-
conversationType: 1,
|
|
179
|
-
conversationId: 'user123'
|
|
180
|
-
}, true); // true为开启免打扰
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### 会话置顶设置
|
|
184
|
-
|
|
185
|
-
```javascript
|
|
186
|
-
const result = await JuggleIM.setTop({
|
|
187
|
-
conversationType: 1,
|
|
188
|
-
conversationId: 'user123'
|
|
189
|
-
}, true); // true为置顶会话
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### 设置会话未读状态
|
|
193
|
-
|
|
194
|
-
```javascript
|
|
195
|
-
const result = await JuggleIM.setUnread({
|
|
196
|
-
conversationType: 1,
|
|
197
|
-
conversationId: 'user123'
|
|
198
|
-
}, true); // true为标记为未读
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### 未读数操作
|
|
202
|
-
|
|
203
|
-
```javascript
|
|
204
|
-
// 清除会话未读数
|
|
205
|
-
const result = await JuggleIM.clearUnreadCount({
|
|
206
|
-
conversationType: 1,
|
|
207
|
-
conversationId: 'user123'
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// 清除总未读数
|
|
211
|
-
const totalResult = await JuggleIM.clearTotalUnreadCount();
|
|
212
|
-
|
|
213
|
-
// 获取总未读数
|
|
214
|
-
const totalCount = await JuggleIM.getTotalUnreadCount();
|
|
215
|
-
|
|
216
|
-
// 获取指定类型的未读数
|
|
217
|
-
const typeUnreadCount = await JuggleIM.getUnreadCountWithTypes([1, 2]); // PRIVATE 和 GROUP 会话的未读数
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### 草稿操作
|
|
221
|
-
|
|
222
|
-
```javascript
|
|
223
|
-
// 设置会话草稿
|
|
224
|
-
const setResult = await JuggleIM.setDraft({
|
|
225
|
-
conversationType: 1,
|
|
226
|
-
conversationId: 'user123'
|
|
227
|
-
}, 'Hello, this is a draft');
|
|
228
|
-
|
|
229
|
-
// 清除会话草稿
|
|
230
|
-
const clearResult = await JuggleIM.clearDraft({
|
|
231
|
-
conversationType: 1,
|
|
232
|
-
conversationId: 'user123'
|
|
233
|
-
});
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### 会话标签操作
|
|
237
|
-
|
|
238
|
-
```javascript
|
|
239
|
-
// 将会话添加到标签
|
|
240
|
-
const addResult = await JuggleIM.addConversationsToTag({
|
|
241
|
-
tagId: 'tag123',
|
|
242
|
-
conversations: [
|
|
243
|
-
{
|
|
244
|
-
conversationType: 1,
|
|
245
|
-
conversationId: 'user123'
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
conversationType: 2,
|
|
249
|
-
conversationId: 'group456'
|
|
250
|
-
}
|
|
251
|
-
]
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
// 从标签中移除会话
|
|
255
|
-
const removeResult = await JuggleIM.removeConversationsFromTag({
|
|
256
|
-
tagId: 'tag123',
|
|
257
|
-
conversations: [
|
|
258
|
-
{
|
|
259
|
-
conversationType: 1,
|
|
260
|
-
conversationId: 'user123'
|
|
261
|
-
}
|
|
262
|
-
]
|
|
263
|
-
});
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
### 获取置顶会话列表
|
|
267
|
-
|
|
268
|
-
```javascript
|
|
269
|
-
const topConversations = await JuggleIM.getTopConversationInfoList(
|
|
270
|
-
20, // 获取数量
|
|
271
|
-
Date.now(), // 时间戳
|
|
272
|
-
1 // 拉取方向: 0-更新的消息, 1-更早的消息
|
|
273
|
-
);
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
## 消息操作
|
|
277
|
-
|
|
278
|
-
### 发送消息
|
|
279
|
-
|
|
280
|
-
```javascript
|
|
281
|
-
const message = await JuggleIM.sendMessage({
|
|
282
|
-
conversationType: 1,
|
|
283
|
-
conversationId: 'user123',
|
|
284
|
-
content: {
|
|
285
|
-
contentType: 'text',
|
|
286
|
-
content: 'Hello World!'
|
|
287
|
-
} as TextMessageContent
|
|
288
|
-
}, {
|
|
289
|
-
onSuccess: (message) => {
|
|
290
|
-
console.log('Message sent successfully:', message);
|
|
291
|
-
},
|
|
292
|
-
onError: (message, errorCode) => {
|
|
293
|
-
console.log('Send failed with error:', errorCode);
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### 发送图片消息
|
|
299
|
-
|
|
300
|
-
```javascript
|
|
301
|
-
const imageMessage = await JuggleIM.sendImageMessage({
|
|
302
|
-
conversationType: 1,
|
|
303
|
-
conversationId: 'user123',
|
|
304
|
-
content: {
|
|
305
|
-
contentType: 'jg:img',
|
|
306
|
-
localPath: '/path/to/image.jpg',
|
|
307
|
-
width: 800,
|
|
308
|
-
height: 600
|
|
309
|
-
} as ImageMessageContent
|
|
310
|
-
}, {
|
|
311
|
-
onProgress: (progress, message) => {
|
|
312
|
-
console.log('Upload progress:', progress);
|
|
313
|
-
},
|
|
314
|
-
onSuccess: (message) => {
|
|
315
|
-
console.log('Image sent successfully:', message);
|
|
316
|
-
},
|
|
317
|
-
onError: (message, errorCode) => {
|
|
318
|
-
console.log('Send image failed with error:', errorCode);
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### 发送文件消息
|
|
324
|
-
|
|
325
|
-
```javascript
|
|
326
|
-
const fileMessage = await JuggleIM.sendFileMessage({
|
|
327
|
-
conversationType: 1,
|
|
328
|
-
conversationId: 'user123',
|
|
329
|
-
content: {
|
|
330
|
-
contentType: 'jg:file',
|
|
331
|
-
localPath: '/path/to/document.pdf',
|
|
332
|
-
name: 'document.pdf',
|
|
333
|
-
size: 102400
|
|
334
|
-
} as FileMessageContent
|
|
335
|
-
}, {
|
|
336
|
-
onProgress: (progress, message) => {
|
|
337
|
-
console.log('Upload progress:', progress);
|
|
338
|
-
},
|
|
339
|
-
onSuccess: (message) => {
|
|
340
|
-
console.log('File sent successfully:', message);
|
|
341
|
-
},
|
|
342
|
-
onError: (message, errorCode) => {
|
|
343
|
-
console.log('Send file failed with error:', errorCode);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### 发送语音消息
|
|
349
|
-
|
|
350
|
-
```javascript
|
|
351
|
-
const voiceMessage = await JuggleIM.sendVoiceMessage(1, 'user123', {
|
|
352
|
-
contentType: 'jg:voice',
|
|
353
|
-
localPath: '/path/to/audio.mp3',
|
|
354
|
-
duration: 10
|
|
355
|
-
} as VoiceMessageContent, {
|
|
356
|
-
onProgress: (progress, message) => {
|
|
357
|
-
console.log('Upload progress:', progress);
|
|
358
|
-
},
|
|
359
|
-
onSuccess: (message) => {
|
|
360
|
-
console.log('Voice sent successfully:', message);
|
|
361
|
-
},
|
|
362
|
-
onError: (message, errorCode) => {
|
|
363
|
-
console.log('Send voice failed with error:', errorCode);
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### 获取历史消息
|
|
369
|
-
|
|
370
|
-
```javascript
|
|
371
|
-
const messageResponse = await JuggleIM.getMessageList({
|
|
372
|
-
conversationType: 1,
|
|
373
|
-
conversationId: 'user123'
|
|
374
|
-
}, 1, { // 方向: 1表示获取更早的消息(向前翻页), 0表示获取更新的消息(向后翻页)
|
|
375
|
-
count: 20,
|
|
376
|
-
startTime: Date.now()
|
|
377
|
-
});
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
### 撤回消息
|
|
381
|
-
|
|
382
|
-
```javascript
|
|
383
|
-
const result = await JuggleIM.recallMessage(['message_id_1', 'message_id_2'], {
|
|
384
|
-
reason: 'sent by mistake'
|
|
385
|
-
});
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### 消息反应
|
|
389
|
-
|
|
390
|
-
```javascript
|
|
391
|
-
// 添加消息反应
|
|
392
|
-
const addResult = await JuggleIM.addMessageReaction('message_id', 'thumbs_up');
|
|
393
|
-
|
|
394
|
-
// 移除消息反应
|
|
395
|
-
const removeResult = await JuggleIM.removeMessageReaction('message_id', 'thumbs_up');
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### 发送消息已读回执
|
|
399
|
-
|
|
400
|
-
发送消息已读回执,通知对方消息已被阅读。
|
|
401
|
-
|
|
402
|
-
```javascript
|
|
403
|
-
const conversation = {
|
|
404
|
-
conversationType: 1, // ConversationType.PRIVATE
|
|
405
|
-
conversationId: 'user123'
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
const messageIds = ['messageId1', 'messageId2'];
|
|
409
|
-
|
|
410
|
-
JuggleIM.sendReadReceipt(conversation, messageIds);
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
### 设置消息置顶
|
|
414
|
-
|
|
415
|
-
设置或取消消息置顶状态。
|
|
416
|
-
|
|
417
|
-
```javascript
|
|
418
|
-
const conversation = {
|
|
419
|
-
conversationType: 2, // ConversationType.GROUP
|
|
420
|
-
conversationId: 'group123'
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
const messageId = 'messageId1';
|
|
424
|
-
const isTop = true; // true 表示置顶,false 表示取消置顶
|
|
425
|
-
|
|
426
|
-
JuggleIM.setMessageTop(messageId, conversation, isTop);
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
## 类型定义
|
|
430
|
-
|
|
431
|
-
### 会话类型
|
|
432
|
-
|
|
433
|
-
```typescript
|
|
434
|
-
export enum ConversationType {
|
|
435
|
-
PRIVATE = 1,
|
|
436
|
-
GROUP = 2,
|
|
437
|
-
CHATROOM = 3,
|
|
438
|
-
SYSTEM = 4,
|
|
439
|
-
}
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
### 连接状态
|
|
443
|
-
|
|
444
|
-
```typescript
|
|
445
|
-
export type ConnectionStatus =
|
|
446
|
-
| "connected"
|
|
447
|
-
| "connecting"
|
|
448
|
-
| "disconnected"
|
|
449
|
-
| "failure"
|
|
450
|
-
| "dbOpen"
|
|
451
|
-
| "dbClose";
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### 消息内容类型
|
|
455
|
-
|
|
456
|
-
支持多种消息内容类型:
|
|
457
|
-
|
|
458
|
-
#### 文本消息 (TextMessageContent)
|
|
459
|
-
``typescript
|
|
460
|
-
export interface TextMessageContent extends MessageContent {
|
|
461
|
-
content: string;
|
|
462
|
-
}
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
#### 图片消息 (ImageMessageContent)
|
|
466
|
-
``typescript
|
|
467
|
-
export interface ImageMessageContent extends MessageContent {
|
|
468
|
-
localPath: string;
|
|
469
|
-
thumbnailLocalPath?: string;
|
|
470
|
-
url?: string;
|
|
471
|
-
thumbnailUrl?: string;
|
|
472
|
-
width: number;
|
|
473
|
-
height: number;
|
|
474
|
-
}
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
#### 文件消息 (FileMessageContent)
|
|
478
|
-
``typescript
|
|
479
|
-
export interface FileMessageContent extends MessageContent {
|
|
480
|
-
localPath: string;
|
|
481
|
-
url?: string;
|
|
482
|
-
name: string;
|
|
483
|
-
size: number;
|
|
484
|
-
type?: string;
|
|
485
|
-
}
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
#### 语音消息 (VoiceMessageContent)
|
|
489
|
-
``typescript
|
|
490
|
-
export interface VoiceMessageContent extends MessageContent {
|
|
491
|
-
localPath: string;
|
|
492
|
-
url?: string;
|
|
493
|
-
duration: number;
|
|
494
|
-
}
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
#### 消息对象 (Message)
|
|
498
|
-
```typescript
|
|
499
|
-
export interface Message {
|
|
500
|
-
clientMsgNo: number;
|
|
501
|
-
localAttribute: string;
|
|
502
|
-
messageState: number;
|
|
503
|
-
isEdite: boolean;
|
|
504
|
-
direction: number;
|
|
505
|
-
isDelete: boolean;
|
|
506
|
-
senderUserId: string;
|
|
507
|
-
messageId: string;
|
|
508
|
-
hasRead: boolean;
|
|
509
|
-
timestamp: number;
|
|
510
|
-
conversation: Conversation;
|
|
511
|
-
content: MessageContent;
|
|
512
|
-
groupMessageReadInfo?: GroupMessageReadInfo;
|
|
513
|
-
mentionInfo: MessageMentionInfo;
|
|
514
|
-
}
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
#### 会话对象 (Conversation)
|
|
518
|
-
```typescript
|
|
519
|
-
export interface Conversation {
|
|
520
|
-
conversationType: number;
|
|
521
|
-
conversationId: string;
|
|
522
|
-
}
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
#### 用户信息 (UserInfo)
|
|
526
|
-
```typescript
|
|
527
|
-
export interface UserInfo {
|
|
528
|
-
userId: string;
|
|
529
|
-
nickname: string;
|
|
530
|
-
avatar: string;
|
|
531
|
-
}
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
#### 消息内容 (MessageContent)
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
#### 提及信息 (MessageMentionInfo)
|
|
540
|
-
```typescript
|
|
541
|
-
export interface MessageMentionInfo {
|
|
542
|
-
/**
|
|
543
|
-
* DEFAULT(0),
|
|
544
|
-
* ALL(1),
|
|
545
|
-
* SOMEONE(2),
|
|
546
|
-
* ALL_AND_SOMEONE(3);
|
|
547
|
-
*/
|
|
548
|
-
type: number;
|
|
549
|
-
targetUsers: UserInfo[];
|
|
550
|
-
}
|
|
551
|
-
```
|
|
552
|
-
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|