/// <summary> /// Initializes a new instance of the <see cref="ChatConversation"/> class. /// </summary> /// <param name="contact">The conversation contact.</param> internal ChatConversation(Contact contact) { var transport = XmppTransportManager.GetTransport(); this.remoteParticipantComposingChangedStream = new Subject <RemoteParticipantComposingChangedEventData>(); this.incomingChatMessageStream = new Subject <ChatMessage>(); this.ThreadingInfo = new ChatConversationThreadingInfo { Id = IdentifierGenerator.Generate() , ContactId = contact.Address , ConversationId = this.Id , Custom = null , Kind = ChatConversationThreadingKind.ContactId }; this.ThreadingInfo.Participants.Add(transport.UserAddress); this.ThreadingInfo.Participants.Add(contact.Address); this.store = XmppTransportManager.RequestStore(contact.Address.BareAddress); this.store.ChangeTracker.Enable(); transport.MessageStream .Where(message => message.IsChat && message.FromAddress.BareAddress == contact.Address) .Subscribe(async message => await OnMessageReceived(message).ConfigureAwait(false)); }
/// <summary> /// Asynchronously gets a conversation based on a threading info object. /// </summary> /// <param name="threadingInfo">The threading info that identifies the conversation.</param> /// <returns>The conversation identified by the threadingInfo parameter.</returns> public async Task <ChatConversation> GetConversationFromThreadingInfoAsync(ChatConversationThreadingInfo threadingInfo) { return(await DataSource.GetConversationFromThreadingInfoAsync(threadingInfo).ConfigureAwait(false)); }