#1211 - Sharing to new conversation doesn't show name/number

This commit is contained in:
Moez Bhatti
2018-09-01 19:01:32 -04:00
parent ebaa48456f
commit 36d8039e73
@@ -131,9 +131,15 @@ class ComposeViewModel @Inject constructor(
.doOnNext { newState { copy(loading = false) } }
.mergeWith(threadIdSubject)
.switchMap { threadId ->
// Query the entire list of conversations and map from there, rather than
// directly querying the conversation from realm. If querying a single
// conversation and it doesn't exist yet, the realm query will never update
conversationRepo.getConversations().asObservable()
.map { conversations -> conversations.filter { it.id == threadId } }
.map { conversations -> conversations.firstOrNull() ?: Conversation(id = threadId) }
.map { conversations ->
conversations.firstOrNull { it.id == threadId }
?: conversationRepo.getOrCreateConversation(threadId)
?: Conversation(id = threadId)
}
}
.mergeWith(initialConversation)
.filter { conversation -> conversation.isLoaded }