public static IConversation GetChatConversation(DummyChatRoomId chatRoomId) { List <IContact> contacts = new List <IContact>(); List <TextMessage> messages = DummyConversationDataGenerator.GetMessageSet(chatRoomId); List <ChatRoomInformation> chatInfoItems = new List <ChatRoomInformation>(); ChatRoomInformation chatRoomInfo = GetChatRoomInfo(chatRoomId); chatInfoItems.Add(chatRoomInfo); List <MessageAttachment> attachments = new List <MessageAttachment>(); foreach (string phoneNumberValue in chatRoomInfo.Participants) { IContact associatedContact = GetContactByPhoneNumber(phoneNumberValue); if (associatedContact != null) { contacts.Add(associatedContact); } } ConversationManager conversationManager = new ConversationManager(contacts, messages, chatInfoItems, attachments, null); foreach (IConversation conversation in conversationManager) { if (conversation.MessageCount > 0) { return(conversation); } } throw new ArgumentException("Shouldn't reach here!"); }
public static IConversation GetSingleConversation(DummyPhoneNumberId messageSetId) { Contact contact = GetAssociatedContact(messageSetId); List <Contact> contacts = new List <Contact>(1); if (contact != null) { contacts.Add(contact); } List <TextMessage> messages = DummyConversationDataGenerator.GetMessageSet(messageSetId); List <ChatRoomInformation> chatInfoItems = new List <ChatRoomInformation>(); List <MessageAttachment> attachments = new List <MessageAttachment>(); ConversationManager conversationManager = new ConversationManager(contacts, messages, chatInfoItems, attachments, null); return(conversationManager.GetConversation(0)); }