Пример #1
0
        private static ConversationListViewModel GetConversation(ApiCentralPrivateChatMessageModel chatMessageModel, ApiWhitelabelPublicUserModel userModel)
        {
            if (chatMessageModel == null)
            {
                return(null);
            }

            // Conversation id is always the other user's id
            var conversation = new ConversationListViewModel
            {
                Id                  = userModel.Id,
                DisplayName         = userModel.DisplayName,
                UserId              = userModel.Id,
                AvatarUrl           = userModel.Avatar?.Small,
                FromMe              = userModel.Id == Settings.UserId,
                IsRead              = chatMessageModel.IsRead,
                LastMessage         = chatMessageModel.Text,
                LastMessageDateTime = chatMessageModel.DateTime,
            };

            return(conversation);
        }
Пример #2
0
 private void OnNewPrivateMessage(ApiCentralPrivateChatMessageModel privateMessage)
 {
     Execute(NewPrivateMessage, action => action(privateMessage));
 }