forked from upstream-mirrors/quik
Show progress when conversation is loading
Potentially related to #1079
This commit is contained in:
@@ -126,6 +126,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
message.supportsInputContent = true
|
||||
|
||||
theme
|
||||
.doOnNext { loading.setTint(it.theme) }
|
||||
.doOnNext { send.setBackgroundTint(it.theme) }
|
||||
.doOnNext { send.setTint(it.textPrimary) }
|
||||
.doOnNext { messageAdapter.theme = it }
|
||||
@@ -165,7 +166,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
toolbarTitle.setVisible(!state.editingMode)
|
||||
chips.setVisible(state.editingMode)
|
||||
contacts.setVisible(state.contactsVisible)
|
||||
composeBar.setVisible(!state.contactsVisible)
|
||||
composeBar.setVisible(!state.contactsVisible && !state.loading)
|
||||
|
||||
// Don't set the adapters unless needed
|
||||
if (state.editingMode && chips.adapter == null) chips.adapter = chipsAdapter
|
||||
@@ -187,6 +188,8 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
chipsAdapter.data = state.selectedContacts
|
||||
contactsAdapter.data = state.contacts
|
||||
|
||||
loading.setVisible(state.loading)
|
||||
|
||||
sendAsGroup.setVisible(state.editingMode && state.selectedContacts.size >= 2)
|
||||
sendAsGroupSwitch.isChecked = state.sendAsGroup
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ data class ComposeState(
|
||||
val selectedContacts: List<Contact> = ArrayList(),
|
||||
val sendAsGroup: Boolean = true,
|
||||
val conversationtitle: String = "",
|
||||
val loading: Boolean = false,
|
||||
val query: String = "",
|
||||
val searchSelectionId: Long = -1,
|
||||
val searchSelectionPosition: Int = 0,
|
||||
|
||||
@@ -149,7 +149,14 @@ class ComposeViewModel @Inject constructor(
|
||||
.skipUntil(state.filter { state -> state.editingMode })
|
||||
.takeUntil(state.filter { state -> !state.editingMode })
|
||||
.map { contacts -> contacts.map { it.numbers.firstOrNull()?.address ?: "" } }
|
||||
.mapNotNull { addresses -> messageRepo.getOrCreateConversation(addresses) }
|
||||
.observeOn(Schedulers.computation())
|
||||
.doOnNext { newState { copy(loading = true) } }
|
||||
.mapNotNull { addresses ->
|
||||
val conversation = messageRepo.getOrCreateConversation(addresses)
|
||||
newState { copy(loading = false) }
|
||||
conversation
|
||||
}
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.mergeWith(initialConversation)
|
||||
.filter { conversation -> conversation.isLoaded }
|
||||
.doOnNext { conversation ->
|
||||
|
||||
Reference in New Issue
Block a user