Commit 4a709b3a authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

fix: present contact request conversation

This patch checks if the conversation exists when presenting
conversation screen for receiving contact request.

Change-Id: Ic9d2b0c1ef5a00f5ce4443914877af8bde852d21
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent ec094c0f
...@@ -160,9 +160,14 @@ class ContactRequestsViewModel: Stateable, ViewModel { ...@@ -160,9 +160,14 @@ class ContactRequestsViewModel: Stateable, ViewModel {
func showConversation (forRingId ringId: String) { func showConversation (forRingId ringId: String) {
let conversationViewModel = ConversationViewModel(with: self.injectionBag) let conversationViewModel = ConversationViewModel(with: self.injectionBag)
let conversation = self.conversationService.findConversation(withRingId: ringId, guard let account = accountsService.currentAccount else {
withAccountId: (accountsService.currentAccount?.id)!) return
conversationViewModel.conversation = Variable<ConversationModel>(conversation!) }
guard let conversation = self.conversationService.findConversation(withRingId: ringId, withAccountId: account.id) else {
return
}
conversationViewModel.conversation = Variable<ConversationModel>(conversation)
self.stateSubject.onNext(ConversationsState.conversationDetail(conversationViewModel: conversationViewModel)) self.stateSubject.onNext(ConversationsState.conversationDetail(conversationViewModel: conversationViewModel))
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment