juggleim-rnsdk 0.1.9 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juggleim-rnsdk",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "React Native wrapper for Juggle IM SDK",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/index.js CHANGED
@@ -981,18 +981,6 @@ class JuggleIM {
981
981
  }
982
982
  }
983
983
 
984
- /**
985
- * 自定义消息内容基类
986
- * 用于创建自定义消息类型
987
- */
988
- export class CustomMessageContent {
989
- /**
990
- * @param {string} contentType - 消息内容类型
991
- */
992
- constructor(contentType) {
993
- this.contentType = contentType;
994
- }
995
- }
996
-
984
+ export * from './types';
997
985
  export * from './call';
998
986
  export default JuggleIM;
package/src/types.js ADDED
@@ -0,0 +1,117 @@
1
+
2
+ /**
3
+ * 会话类型
4
+ */
5
+ export const ConversationType = {
6
+ PRIVATE: 1,
7
+ GROUP: 2,
8
+ CHATROOM: 3,
9
+ SYSTEM: 4,
10
+ };
11
+
12
+ /**
13
+ * 消息内容基类
14
+ */
15
+ export class MessageContent {
16
+ constructor() {
17
+ this.contentType = "";
18
+ }
19
+ }
20
+
21
+ /**
22
+ * 自定义消息内容
23
+ */
24
+ export class CustomMessageContent extends MessageContent {
25
+ constructor(contentType) {
26
+ super();
27
+ this.contentType = contentType;
28
+ }
29
+ }
30
+
31
+ /**
32
+ * 文本消息内容
33
+ */
34
+ export class TextMessageContent extends MessageContent {
35
+ constructor(content) {
36
+ super();
37
+ this.contentType = "jg:text";
38
+ this.content = content;
39
+ }
40
+ }
41
+
42
+ /**
43
+ * 撤回消息内容
44
+ */
45
+ export class RecallInfoMessageContent extends MessageContent {
46
+ constructor() {
47
+ super();
48
+ this.contentType = "jg:recallinfo";
49
+ }
50
+ }
51
+
52
+ /**
53
+ * 合并消息内容
54
+ */
55
+ export class MergeMessageContent extends MessageContent {
56
+ constructor(
57
+ title,
58
+ conversation,
59
+ messageIdList,
60
+ previewList
61
+ ) {
62
+ super();
63
+ this.contentType = "jg:merge";
64
+ this.title = title;
65
+ this.conversation = conversation;
66
+ this.messageIdList = messageIdList;
67
+ this.previewList = previewList;
68
+ }
69
+ }
70
+
71
+ /**
72
+ * 合并消息预览单元
73
+ */
74
+ export class MergeMessagePreviewUnit {
75
+ constructor(previewContent, sender) {
76
+ this.previewContent = previewContent;
77
+ this.sender = sender;
78
+ }
79
+ }
80
+
81
+ /**
82
+ * 图片消息内容
83
+ */
84
+ export class ImageMessageContent extends MessageContent {
85
+ constructor(localPath, width, height) {
86
+ super();
87
+ this.contentType = "jg:img";
88
+ this.localPath = localPath;
89
+ this.width = width;
90
+ this.height = height;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * 文件消息内容
96
+ */
97
+ export class FileMessageContent extends MessageContent {
98
+ constructor(localPath, name, size) {
99
+ super();
100
+ this.contentType = "jg:file";
101
+ this.localPath = localPath;
102
+ this.name = name;
103
+ this.size = size;
104
+ }
105
+ }
106
+
107
+ /**
108
+ * 语音消息内容
109
+ */
110
+ export class VoiceMessageContent extends MessageContent {
111
+ constructor(localPath, duration) {
112
+ super();
113
+ this.contentType = "jg:voice";
114
+ this.localPath = localPath;
115
+ this.duration = duration;
116
+ }
117
+ }