Fix messageList visibility

This commit is contained in:
Moez Bhatti
2020-02-29 15:33:44 -05:00
parent 0ff582ddd0
commit 853acaa42c
2 changed files with 5 additions and 4 deletions
@@ -216,7 +216,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
sendAsGroup.setVisible(state.editingMode && state.selectedChips.size >= 2) sendAsGroup.setVisible(state.editingMode && state.selectedChips.size >= 2)
sendAsGroupSwitch.isChecked = state.sendAsGroup sendAsGroupSwitch.isChecked = state.sendAsGroup
messageList.setVisible(state.sendAsGroup) messageList.setVisible(!state.editingMode || state.sendAsGroup)
messageAdapter.data = state.messages messageAdapter.data = state.messages
messageAdapter.highlight = state.searchSelectionId messageAdapter.highlight = state.searchSelectionId
@@ -640,6 +640,7 @@ class ComposeViewModel @Inject constructor(
Preferences.SEND_DELAY_LONG -> 10000 Preferences.SEND_DELAY_LONG -> 10000
else -> 0 else -> 0
} }
val sendAsGroup = !state.editingMode || state.sendAsGroup
when { when {
// Scheduling a message // Scheduling a message
@@ -650,13 +651,13 @@ class ComposeViewModel @Inject constructor(
.map { it.getUri() } .map { it.getUri() }
.map { it.toString() } .map { it.toString() }
val params = AddScheduledMessage val params = AddScheduledMessage
.Params(state.scheduled, subId, addresses, state.sendAsGroup, body, uris) .Params(state.scheduled, subId, addresses, sendAsGroup, body, uris)
addScheduledMessage.execute(params) addScheduledMessage.execute(params)
context.makeToast(R.string.compose_scheduled_toast) context.makeToast(R.string.compose_scheduled_toast)
} }
// Sending a group message // Sending a group message
state.sendAsGroup -> { sendAsGroup -> {
sendMessage.execute(SendMessage sendMessage.execute(SendMessage
.Params(subId, conversation.id, addresses, body, attachments, delay)) .Params(subId, conversation.id, addresses, body, attachments, delay))
} }
@@ -691,7 +692,7 @@ class ComposeViewModel @Inject constructor(
this.attachments.onNext(ArrayList()) this.attachments.onNext(ArrayList())
if (state.editingMode) { if (state.editingMode) {
newState { copy(editingMode = false, sendAsGroup = true, hasError = !state.sendAsGroup) } newState { copy(editingMode = false, hasError = !sendAsGroup) }
} }
} }
.autoDisposable(view.scope()) .autoDisposable(view.scope())