예제 #1
0
        public async Task GetUserConversations()
        {
            var conversations = await _conversationService.GetConversationsForUserAsync(DataContainer.GetUserId());

            UserConversations.Clear();
            foreach (var conversation in conversations)
            {
                UserConversations.Add(conversation);
            }

            foreach (var conversation in conversations)
            {
                await _messageService.JoinChat(conversation);
            }
        }
예제 #2
0
        public async Task <ConversationDTO> GetConversationWithUser(string username)
        {
            var userPair = new UserPairIdUsernameDTO()
            {
                UserId   = DataContainer.GetUserId(),
                Username = username
            };
            var conversation = await _conversationService.GetConversationWithUser(userPair);

            if (conversation == null)
            {
                return(conversation);
            }

            DataContainer.ConversationDTO = conversation;
            if (conversation.ConversationLastMessage is null)
            {
                UserConversations.Add(conversation);
                await _messageService.JoinChat(conversation);
            }

            return(conversation);
        }
예제 #3
0
 public async Task RegisterNewGroupConversation()
 {
     UserConversations.Add(DataContainer.ConversationDTO);
     await _messageService.JoinChat(DataContainer.ConversationDTO);
 }