fillSessionInfo static method
补充会话信息,会话列表中的个人信息和群组信息都在这里填充
Implementation
static Future<List<ConversationInfo>?> fillSessionInfo(
List<NIMSession>? infoList) async {
if (infoList == null) {
return null;
}
List<ConversationInfo> conversationList = [];
List<String>? muteList =
(await NimCore.instance.userService.getMuteList()).data;
for (int i = 0; i < infoList.length; ++i) {
var e = infoList[i];
var conversationInfo = ConversationInfo(e);
conversationInfo.isStickTop = await getIt<MessageProvider>()
.isStickSession(e.sessionId, e.sessionType);
Alog.d(
tag: 'ConversationKit',
moduleName: 'ConversationRepo',
content: '${e.sessionId} isStickTop:${conversationInfo.isStickTop}');
if (e.sessionType == NIMSessionType.p2p) {
ConversationInfo res = await _fillUserInfo(conversationInfo);
if (muteList?.contains(res.session.sessionId) == true) {
res.mute = true;
}
conversationList.add(res);
} else if (e.sessionType == NIMSessionType.team) {
ConversationInfo res = await _fillTeamInfo(conversationInfo);
conversationList.add(res);
}
}
return conversationList;
}