forked from upstream-mirrors/quik
#1211 - Sharing to new conversation doesn't show name/number
This commit is contained in:
@@ -131,9 +131,15 @@ class ComposeViewModel @Inject constructor(
|
|||||||
.doOnNext { newState { copy(loading = false) } }
|
.doOnNext { newState { copy(loading = false) } }
|
||||||
.mergeWith(threadIdSubject)
|
.mergeWith(threadIdSubject)
|
||||||
.switchMap { threadId ->
|
.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()
|
conversationRepo.getConversations().asObservable()
|
||||||
.map { conversations -> conversations.filter { it.id == threadId } }
|
.map { conversations ->
|
||||||
.map { conversations -> conversations.firstOrNull() ?: Conversation(id = threadId) }
|
conversations.firstOrNull { it.id == threadId }
|
||||||
|
?: conversationRepo.getOrCreateConversation(threadId)
|
||||||
|
?: Conversation(id = threadId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.mergeWith(initialConversation)
|
.mergeWith(initialConversation)
|
||||||
.filter { conversation -> conversation.isLoaded }
|
.filter { conversation -> conversation.isLoaded }
|
||||||
|
|||||||
Reference in New Issue
Block a user