Example #1
0
 public void updateFromChannel(Channel channel)
 {
     this.atAll       = this.atAll || (channel?.lastMessage?.mentionEveryone ?? false);
     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.lastMessage = channel?.lastMessage == null
         ? this.lastMessage
         : ChannelMessageView.fromChannelMessage(channel.lastMessage);
     this.lastMessageId = channel?.lastMessage?.id ?? this.lastMessageId;
 }
Example #2
0
 public static ChannelView fromChannel(Channel channel)
 {
     return(new ChannelView {
         atAll = channel?.lastMessage?.mentionEveryone ?? false,
         memberIds = new List <string>(),
         membersDict = new Dictionary <string, ChannelMember>(),
         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?.lastMessage?.id,
         lastMessage = ChannelMessageView.fromChannelMessage(channel?.lastMessage),
         messageIds = new List <string>(),
         localMessageIds = new List <string>(),
         oldMessageIds = new List <string>(),
         newMessageIds = new List <string>(),
         currentMember = new ChannelMember()
     });
 }