forked from upstream-mirrors/quik
Merge pull request #344 from gavine99/kicked-to-inbox-on-send-320-haserror-sendasgroup-fix
fix bug causing compose activity to finish() when it wasn't supposed to
This commit is contained in:
@@ -187,8 +187,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
override val viewQksmsPlusIntent: Subject<Unit> = PublishSubject.create()
|
||||
override val backPressedIntent: Subject<Unit> = PublishSubject.create()
|
||||
override val confirmDeleteIntent: Subject<List<Long>> = PublishSubject.create()
|
||||
override val confirmClearCurrentMessageIntent: Subject<Unit> = PublishSubject.create()
|
||||
override val clearCurrentMessageIntent: Subject<Unit> = PublishSubject.create()
|
||||
override val clearCurrentMessageIntent: Subject<Boolean> = PublishSubject.create()
|
||||
override val messageLinkAskIntent: Subject<Uri> by lazy { messageAdapter.messageLinkClicks }
|
||||
override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() }
|
||||
override val shadeIntent by lazy { shadeBackground.clicks() }
|
||||
@@ -729,7 +728,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
.setTitle(R.string.dialog_clear_compose_title)
|
||||
.setMessage(R.string.dialog_clear_compose)
|
||||
.setPositiveButton(R.string.button_clear) { _, _ ->
|
||||
clearCurrentMessageIntent.onNext(Unit)
|
||||
clearCurrentMessageIntent.onNext(false)
|
||||
}
|
||||
.setNegativeButton(R.string.button_cancel, null)
|
||||
.show()
|
||||
|
||||
@@ -75,8 +75,7 @@ interface ComposeView : QkView<ComposeState> {
|
||||
val viewQksmsPlusIntent: Subject<Unit>
|
||||
val backPressedIntent: Observable<Unit>
|
||||
val confirmDeleteIntent: Observable<List<Long>>
|
||||
val confirmClearCurrentMessageIntent: Observable<Unit>
|
||||
val clearCurrentMessageIntent: Subject<Unit>
|
||||
val clearCurrentMessageIntent: Subject<Boolean>
|
||||
val messageLinkAskIntent: Observable<Uri>
|
||||
val speechRecogniserIntent: Observable<*>
|
||||
val shadeIntent: Observable<Unit>
|
||||
|
||||
@@ -1028,7 +1028,9 @@ class ComposeViewModel @Inject constructor(
|
||||
true -> conversation.recipients.map { it.address }
|
||||
false -> chips.map { chip -> chip.address }
|
||||
}
|
||||
val sendAsGroup = !state.editingMode || state.sendAsGroup
|
||||
val sendAsGroup = ((addresses.size > 1) && // if more than one address to send to
|
||||
(!state.editingMode || // and is not a new convo
|
||||
state.sendAsGroup)) // or (is a new convo and) send as group is selected
|
||||
|
||||
when {
|
||||
// Scheduling a message
|
||||
@@ -1073,8 +1075,13 @@ class ComposeViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
// clear the current message ready for new message composition
|
||||
view.clearCurrentMessageIntent.onNext(Unit)
|
||||
// clear the current message ready for new message composition (or finish()
|
||||
// compose activity)
|
||||
view.clearCurrentMessageIntent.onNext(
|
||||
((addresses.size > 1) && // if more than one address to send to
|
||||
state.editingMode && // and is a new convo
|
||||
!state.sendAsGroup) // and is *not* sent as a group
|
||||
)
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
@@ -1106,22 +1113,15 @@ class ComposeViewModel @Inject constructor(
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.clearSelection() }
|
||||
|
||||
view.confirmClearCurrentMessageIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { view.clearCurrentMessageIntent.onNext(Unit) }
|
||||
|
||||
// clear the current message schedule, text and attachments
|
||||
view.clearCurrentMessageIntent
|
||||
.withLatestFrom(state) { _, state -> state }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
view.setDraft("")
|
||||
// if choosing contacts, don't remove attachments. they may have come from an
|
||||
// external share
|
||||
newState {
|
||||
copy(
|
||||
editingMode = false,
|
||||
hasError = !sendAsGroup,
|
||||
hasError = it, // hasError being kinda misused to finish() compose activity
|
||||
attachments = listOf(),
|
||||
scheduled = 0,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user