Exemplo n.º 1
0
 public async Task DeleteAllMessages(ChadderConversation conversation)
 {
     while (conversation.Messages.Count > 0)
     {
         await DeleteMessage(conversation.Messages.Last(), conversation);
     }
 }
Exemplo n.º 2
0
        public async Task AddMessage(ChadderMessage msg, ChadderConversation conversation)
        {
            conversation.Messages.Add(msg);
            await sqlDB.InsertAsync(msg);

            conversation.Hidden = false;
            await sqlDB.UpdateAsync(conversation);
        }
Exemplo n.º 3
0
        public async Task DeleteMessage(ChadderMessage msg, ChadderConversation conversation)
        {
            if (msg.Type == ChadderMessage.MESSAGE_TYPE.PICTURE)
            {
                await DeletePicture(msg.Picture);
            }
            await sqlDB.DeleteAsync(msg);

            conversation.Messages.Remove(msg);
        }
Exemplo n.º 4
0
        public async Task AddContact(ChadderContact contact, bool Hidden)
        {
            Contacts.Add(contact);
            await sqlDB.InsertAsync(contact);

            var conversation = new ChadderConversation()
            {
                ContactUserId = contact.UserId,
                Contact       = contact,
                Hidden        = Hidden,
            };
            await sqlDB.InsertAsync(conversation);

            Conversations.Add(conversation);
        }
 public static ChadderMessage Create(ChadderConversation conversation, IChadderUserProfile Sender, MESSAGE_TYPE type)
 {
     return(new ChadderMessage()
     {
         MessageId = Guid.NewGuid().ToString(),
         Type = type,
         Status = ChadderMessage.MESSAGE_STATUS.SENDING,
         MyMessage = true,
         ConversationId = conversation.recordId,
         UserId = Sender.UserId,
         Sender = Sender,
         Expiration = DateTime.UtcNow.AddDays(7),
         TimeSent = DateTime.UtcNow,
     });
 }