Skip to content

Commit 0173f98

Browse files
KenChoiKenChoi
authored andcommitted
Merge branch 'dev' of github.com:jpush/jmessage-react-plugin into dev
2 parents 233425a + 4855263 commit 0173f98

File tree

5 files changed

+61
-24
lines changed

5 files changed

+61
-24
lines changed

document/API.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,11 @@ JMessage.createSendMessage({type: 'group', groupId: 'group id', appKey: 'appkey'
306306

307307
#### 参数说明
308308

309-
- type: 会话类型。可以为 'single' 或 'group'。
309+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
310310
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
311311
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
312312
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
313+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
313314
- messageType: 不同的消息类型需要不同的字段。
314315
- messageType = text 时 `text` 为必填。
315316
- messageType = image 时 `path` 为必填。
@@ -345,10 +346,11 @@ JMessage.createSendMessage({type: 'single', username: 'username', appKey: 'appke
345346
#### 参数
346347

347348
- id: 创建好的 message id。
348-
- type: 会话类型。可以为 'single' 或 'group'。
349+
- type: 会话类型。可以为 'single' 或 'group'或 'chatRoom'
349350
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
350351
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
351352
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
353+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
352354

353355

354356
- messageSendingOptions: 消息发送配置参数。支持的属性:
@@ -390,10 +392,11 @@ JMessage.sendTextMessage({ type: 'group', groupId: 'target_group_id', text: 'hel
390392

391393
#### 参数说明
392394

393-
- type: 会话类型。可以为 'single' 或 'group'。
395+
- type: 会话类型。可以为 'single' 或 'group'或 'chatRoom'
394396
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
395397
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
396398
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
399+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
397400
- text: 消息内容。
398401
- extras: 自定义键值对,value 必须为字符串类型。
399402
- messageSendingOptions: 消息发送配置参数(只对 Android 生效)。支持的属性:
@@ -435,10 +438,11 @@ JMessage.sendImageMessage({ type: 'group', groupId: 'target_group_id', path: 'im
435438

436439
#### 参数说明
437440

438-
- type: 会话类型。可以为 'single' 或 'group'。
441+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
439442
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
440443
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
441444
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
445+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
442446
- path: 本地图片的绝对路径。格式分别类似为:
443447
- Android:`/storage/emulated/0/DCIM/Camera/IMG_20160526_130223.jpg`
444448
- iOS:`/var/mobile/Containers/Data/Application/7DC5CDFF-6581-4AD3-B165-B604EBAB1250/tmp/photo.jpg`
@@ -482,10 +486,11 @@ JMessage.sendVoiceMessage({ type: 'group', groupId: 'target_group_id', path: 'vo
482486

483487
#### 参数说明
484488

485-
- type: 会话类型。可以为 'single' 或 'group'。
489+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
486490
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
487491
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
488492
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
493+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
489494
- path: 本地音频文件的绝对路径。
490495
- extras: 自定义键值对,value 必须为字符串类型。
491496
- messageSendingOptions: 消息发送配置参数(只对 Android 生效)。支持的属性:
@@ -527,10 +532,11 @@ JMessage.sendCustomMessage({ type: 'group', groupId: 'target_group_id', path: 'v
527532

528533
#### 参数说明
529534

530-
- type: 会话类型。可以为 'single' 或 'group'。
535+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
531536
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
532537
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
533538
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
539+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
534540
- customObject: 自定义键值对,`value` 必须为字符串类型。
535541
- messageSendingOptions: 消息发送配置参数(只对 Android 生效)。支持的属性:
536542
- isShowNotification: 接收方是否针对此次消息发送展示通知栏通知。默认为 `true`
@@ -573,10 +579,11 @@ JMessage.sendLocationMessage({ type: 'group', groupId: 'target_group_id',
573579

574580
#### 参数说明
575581

576-
- type: 会话类型。可以为 'single' 或 'group'。
582+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
577583
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
578584
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
579585
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
586+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
580587
- latitude: 纬度。
581588
- longitude: 经度。
582589
- scale: 地图缩放比例。
@@ -621,10 +628,11 @@ JMessage.sendFileMessage({ type: 'group', groupId: 'target_group_id', path: 'fil
621628

622629
#### 参数说明
623630

624-
- type: 会话类型。可以为 'single' 或 'group'。
631+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
625632
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
626633
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
627634
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
635+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
628636
- path: 本地文件的绝对路径。
629637
- extras: 自定义键值对,value 必须为字符串类型。
630638
- messageSendingOptions: 消息发送配置参数(只对 Android 生效)。支持的属性:
@@ -654,10 +662,11 @@ JMessage.retractMessage({type: 'single', username: 'username', appKey: 'appKey',
654662

655663
#### 参数说明
656664

657-
- type: 会话类型。可以为 'single' 或 'group'。
665+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
658666
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
659667
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
660668
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
669+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
661670
- messageId: 要撤回的消息 id。
662671

663672
### getHistoryMessages
@@ -680,10 +689,11 @@ JMessage.getHistoryMessages({ type: 'single', username: 'username',
680689

681690
#### 参数说明
682691

683-
- type: 会话类型。可以为 'single' 或 'group'。
692+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
684693
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
685694
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
686695
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
696+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
687697
- from: 第一条消息对应的下标,起始为 0。
688698
- limit: 消息数。当 from = 0 并且 limit = -1 时,返回所有的历史消息。
689699

@@ -708,10 +718,11 @@ JMessage.downloadOriginalImage({ type: 'single', username: 'username',
708718

709719
#### 参数说明
710720

711-
- type: 会话类型。可以为 'single' 或 'group'。
721+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
712722
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
713723
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
714724
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
725+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
715726
- messageId: 图片消息 id。
716727

717728
### downloadVoiceFile
@@ -735,10 +746,11 @@ JMessage.downloadVoiceFile({ type: 'single', username: 'username',
735746

736747
#### 参数说明
737748

738-
- type: 会话类型。可以为 'single' 或 'group'。
749+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
739750
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
740751
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
741752
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
753+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
742754
- messageId: 语音消息 id。
743755

744756
### downloadFile
@@ -762,10 +774,11 @@ JMessage.downloadFile({ type: 'single', username: 'username',
762774

763775
#### 参数说明
764776

765-
- type: 会话类型。可以为 'single' 或 'group'。
777+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
766778
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
767779
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
768780
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
781+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
769782
- messageId: 文件消息 id。
770783

771784
## 会话
@@ -789,10 +802,11 @@ JMessage.createConversation({ type: 'single', username: 'username', appKey: 'app
789802

790803
#### 参数说明
791804

792-
- type: 会话类型。可以为 'single' 或 'group'。
805+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
793806
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
794807
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
795808
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
809+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
796810

797811
### deleteConversation
798812

@@ -813,10 +827,11 @@ JMessage.deleteConversation({ type: 'single', username: 'username', appKey: 'app
813827
814828
#### 参数说明
815829
816-
- type: 会话类型。可以为 'single' 或 'group'。
830+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
817831
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
818832
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
819833
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
834+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
820835
821836
### enterConversation
822837
@@ -873,10 +888,11 @@ JMessage.getConversation({ type: 'single', username: 'username', appKey: 'appKey
873888
874889
#### 参数说明
875890
876-
- type: 会话类型。可以为 'single' 或 'group'。
891+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
877892
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
878893
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
879894
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
895+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
880896
881897
### getConversations
882898
@@ -913,10 +929,11 @@ JMessage.resetUnreadMessageCount({ type: 'single', username: 'username', appKey:
913929
914930
#### 参数说明
915931
916-
- type: 会话类型。可以为 'single' 或 'group'。
932+
- type: 会话类型。可以为 'single' 或 'group' 或 'chatRoom'
917933
- username: 对方用户的用户名。当 `type` 为 'single' 时,`username` 为必填。
918934
- appKey: 对方用户所属应用的 AppKey。如果不填,默认为当前应用。
919935
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
936+
- roomId: 对象聊天室 id。当 `type` 为 'chatRoom' 时,`roomId` 为必填。
920937
921938
922939
## 聊天室

document/Models.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ id: string, // 消息 id
8686
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
8787
type: 'text', // 消息类型
8888
from: UserInfo, // 消息发送者对象
89-
target: UserInfo / GroupInfo, // 消息接收者对象
89+
target: UserInfo / GroupInfo / ChatRoomInfo, // 消息接收者对象
9090
createTime: number, // 发送消息时间
9191
text: string, // 消息内容
9292
extras: object // 附带的键值对
@@ -101,7 +101,7 @@ id: string, // 消息 id
101101
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
102102
type: 'image', // 消息类型
103103
from: UserInfo, // 消息发送者对象
104-
target: UserInfo / GroupInfo, // 消息接收者对象
104+
target: UserInfo / GroupInfo / ChatRoomInfo, // 消息接收者对象
105105
extras: object, // 附带的键值对
106106
thumbPath: string // 图片的缩略图路径
107107
localPath: string // 图片本地路径
@@ -114,7 +114,7 @@ id: string, // 消息 id
114114
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
115115
type: 'voice', // 消息类型
116116
from: UserInfo, // 消息发送者对象
117-
target: UserInfo / GroupInfo, // 消息接收者对象
117+
target: UserInfo / GroupInfo / ChatRoomInfo, // 消息接收者对象
118118
extras: object, // 附带的键值对
119119
path: string, // 语音文件路径
120120
duration: number // 语音时长,单位秒
@@ -127,7 +127,7 @@ id: string, // 消息 id
127127
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
128128
type: 'location', // 消息类型
129129
from: UserInfo, // 消息发送者对象
130-
target: UserInfo / GroupInfo, // 消息接收者对象
130+
target: UserInfo / GroupInfo / ChatRoomInfo, // 消息接收者对象
131131
extras: object, // 附带的键值对
132132
address: string, // 详细地址
133133
longitude: number, // 经度
@@ -144,7 +144,7 @@ id: string, // 消息 id
144144
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
145145
type: 'file', // 消息类型
146146
from: UserInfo, // 消息发送者对象
147-
target: UserInfo / GroupInfo, // 消息接收者对象
147+
target: UserInfo / GroupInfo / ChatRoomInfo, // 消息接收者对象
148148
extras: object, // 附带的键值对
149149
fileName: string // 文件名
150150
```
@@ -167,4 +167,4 @@ customObject: object // 自定义键值对
167167
type: 'event', // 消息类型
168168
eventType: string, // 'group_member_added' / 'group_member_removed' / 'group_member_exit'
169169
usernames: Array // 该事件涉及到的用户 username 数组
170-
```
170+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
8+
</plist>

ios/RCTJMessageModule/RCTJMessageModule.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,11 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
830830
return [message messageToDictionary];
831831
}];
832832

833+
if (!messageArr) {
834+
successCallback(@[@[]]);
835+
return;
836+
}
837+
833838
successCallback(@[messageDicArr]);
834839
}];
835840
}
@@ -1972,6 +1977,13 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
19721977

19731978
self.SendMsgCallbackDic[message.msgId] = @[successCallback,failCallback];
19741979

1980+
if (param[@"extras"] && [param[@"extras"] isKindOfClass: [NSDictionary class]]) {
1981+
NSDictionary *extras = param[@"extras"];
1982+
for (NSString *key in extras.allKeys) {
1983+
[message.content addStringExtra:extras[key] forKey:key];
1984+
}
1985+
}
1986+
19751987
if (messageSendingOptions) {
19761988
[conversation sendMessage:message optionalContent:messageSendingOptions];
19771989
} else {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jmessage-react-plugin",
3-
"version": "2.1.7",
3+
"version": "2.1.8",
44
"description": "a jmessage plugin for react native application",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)