@ 功能
提示
从 2.6.8
版本开始,群组中支持 @ 消息功能,满足您 @ 指定用户或 @ 所有人的需求,在 RCMessageContent
类中新增 @ 属性
参数 | 类型 | 说明 |
---|---|---|
RCMentionedInfo | RCMentionedInfo | 消息中的@提醒信息 |
@property(nonatomic, strong) RCMentionedInfo *mentionedInfo;
RCMentionedInfo 介绍¶
参数 | 类型 | 说明 |
---|---|---|
type | RCMentionedType | @ 提醒的类型,设置 @ 指定用户,还是 @ 所有人。 |
userIdList | NSArray | @的用户ID列表。 |
mentionedContent | NSString | 包含 @ 提醒的消息,本地通知和远程推送显示的内容。 |
- (instancetype)initWithMentionedType:(RCMentionedType)type
userIdList:(NSArray *)userIdList
mentionedContent:(NSString *)mentionedContent;
发送方¶
提示
在发送消息的时候如果需要 @ 提示,可以给消息的 mentionedInfo
赋值。
RCTextMessage *rcTextMessage = [RCTextMessage messageWithContent:@“Test”];
rcTextMessage.mentionedInfo = [[RCMentionedInfo alloc] initWithMentionedType:RC_Mentioned_Users userIdList:mentionedUserIdList mentionedContent:nil];
[self sendMessage:rcTextMessage pushContent:nil];
接收方¶
提示
- 收到 @ 消息时,在
RCConversation
里新增标示hasUnreadMentioned
。 - 在清除会话未读数(
clearMessagesUnreadStatus:targetId:
)的时候,会将此状态置成 NO。
参数 | 类型 | 说明 |
---|---|---|
hasUnreadMentioned | BOOL | 会话中是否存在被 @ 的消息 |
@property(nonatomic, assign) BOOL hasUnreadMentioned;
其他相关方法¶
获取会话中所有未读的 @ 提醒自己的消息
提示
- 此方法从本地获取被@提醒的消息(最多返回 10 条信息)
- 使用 IMKit 注意在进入会话页面前调用,否则在进入会话清除未读数的接口 clearMessagesUnreadStatus: targetId: 以及 设置消息接收状态接口 setMessageReceivedStatus:receivedStatus: 会同步清除被提示信息状态。
参数 | 类型 | 说明 |
---|---|---|
conversationType | RCConversationType | 会话类型 |
targetId | NSString | 目标会话 Id |
返回值 | NSArray | 该会话中所有未读的 @ 提醒自己的消息 |
- (NSArray *)getUnreadMentionedMessages:(RCConversationType)conversationType
targetId:(NSString *)targetId;
获取某类型会话中所有未读的被 @ 提醒自己消息数
提示
- 此方法从本地获取被@提醒的消息(最多返回 10 条信息)
参数 | 类型 | 说明 |
---|---|---|
conversationTypes | NSArray | 会话类型的数组 |
返回值 | int | 该类型会话中所有未读的 @ 提醒自己的消息数 |
- (int)getUnreadMentionedCount:(NSArray *)conversationTypes;