/// <summary> /// 更新会话记录 /// </summary> /// <param name="info">会话信息</param> private void updateSession(SessionInfo info) { var session = sessions.Find(i => i.id == info.Id); if (session == null) { addSession(info); return; } session.message = NimUtil.readMsg(info); session.time = info.Timetag / 1000; session.unRead = info.Id == info.Sender; }
/// <summary> /// 新增会话记录 /// </summary> /// <param name="info">会话信息</param> private void addSession(SessionInfo info) { var user = NimUtil.getUser(info.Id); var session = new NimSessionInfo { id = info.Id, name = user.name, head = Util.getImageFromUrl(user.icon), message = NimUtil.readMsg(info), time = info.Timetag / 1000, unRead = info.UnreadCount > 0 }; sessions.Add(session); }