实现思路:
========
分别在加载数据源和接收消息时候进行过滤。
实现代码:
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;
}