Example #1
0
        private void UpdateChatEntryModel(ChatEntryModel entry, Chat chat, Avatar avatar = null)
        {
            var chatData = chat.ChatData;

            entry.Chat        = chat;
            entry.Id          = chatData.Id;
            entry.Title       = chatData.Title;
            entry.Avatar      = avatar;
            entry.HasUnread   = chatData.UnreadCount > 0;
            entry.UnreadCount = chatData.UnreadCount.ToString();
        }
Example #2
0
        private ChatEntryModel GetChatEntryModel(Chat chat)
        {
            var chatData = chat.ChatData;

            if (!_entryStore.TryGetValue(chatData.Id, out var entry))
            {
                entry = new ChatEntryModel();
                UpdateChatEntryModel(entry, chat);

                _entryStore.Add(chatData.Id, entry);
            }

            return(entry);
        }