IM 即时通讯 (442)
Android (209)
- 初始化&链接 (8)
- 事件&监听处理 (7)
- 用户信息 (13)
- 会话列表 (16)
- 聊天会话 (26)
- 消息处理 (35)
- 自定义消息 (6)
- 音视频 (2)
- 推送&通知 (34)
- 扩展功能 (4)
- 第三方地图 (3)
- 依赖&配置 (9)
- 升级说明 (3)
- 其他 (43)
iOS (168)
- SDK 导入 (10)
- 连接 (8)
- 事件处理 (2)
- 用户信息 (3)
- 会话列表 (14)
- 聊天会话 (44)
- 消息处理 (26)
- 自定义消息 (8)
- 推送&通知 (19)
- 扩展功能 (5)
- 国际化 (4)
- 音视频 (3)
- 其他 (22)
Web (36)
Server (29)
会话列表过滤某个特定会话
会话列本可以按类型来显示会话,但是如果想要过滤某个类型中某个特定的会话,可以参考本知识库实现。
发布时间: 2019-08-06 15:23
回答:
实现思路:
分别在加载数据源和接收消息时候进行过滤。
实现代码:
1. 在加载数据源时候过滤
- (NSMutableArray *)willReloadTableData:(NSMutableArray *)dataSource { NSArray *temp = [dataSource copy]; for (int i = 0;i< temp.count;i++) { RCConversationModel *model = temp[i]; if ([model.senderUserId isEqualToString:@"需要过滤的发送消息者的 userId"]) { [dataSource removeObjectAtIndex:i]; } } return dataSource; }
2. 在接收消息时候过滤:
- (void)didReceiveMessageNotification:(NSNotification *)notification { RCMessage *message = notification.object; if (![message.senderUserId isEqualToString:@"需要过滤的发送消息者的 userId"]) { [super didReceiveMessageNotification:notification]; } }
3. 如果需要屏蔽对应的提示音:
- (BOOL)onRCIMCustomAlertSound:(RCMessage *)message { if ([message.senderUserId isEqualToString:@"需要过滤的发送消息者的 userId"]) { return YES; } return NO; }