public void updateNormalChannelLite(NormalChannelLite channel) { if (!this.channelDict.TryGetValue(key: channel.id, out var channelView)) { this.channelDict[key : channel.id] = ChannelView.fromNormalChannelLite(channel : channel); return; } channelView.updateFromNormalChannelLite(channel: channel); }
public void updateFromNormalChannelLite(NormalChannelLite channel) { this.id = channel?.id ?? this.id; this.groupId = channel?.groupId ?? this.groupId; this.thumbnail = channel?.thumbnail ?? this.thumbnail; this.name = channel?.name ?? this.name; this.topic = channel?.topic ?? this.topic; this.memberCount = channel?.memberCount ?? this.memberCount; this.isMute = channel?.isMute ?? this.isMute; this.live = channel?.live ?? this.live; this.lastMessageId = channel?.lastMessageId ?? this.lastMessageId; }
public static ChannelView fromNormalChannelLite(NormalChannelLite channel) { return(new ChannelView { id = channel?.id, groupId = channel?.groupId, thumbnail = channel?.thumbnail, name = channel?.name, topic = channel?.topic, memberCount = channel?.memberCount ?? 0, isMute = channel?.isMute ?? false, live = channel?.live ?? false, lastMessageId = channel?.lastMessageId, atAll = false, memberIds = new List <string>(), membersDict = new Dictionary <string, ChannelMember>(), messageIds = new List <string>(), localMessageIds = new List <string>(), oldMessageIds = new List <string>(), newMessageIds = new List <string>(), currentMember = new ChannelMember() }); }