mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-19 12:28:53 +01:00
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 viewQksmsPlusIntent: Subject<Unit> = PublishSubject.create()
|
||||||
override val backPressedIntent: Subject<Unit> = PublishSubject.create()
|
override val backPressedIntent: Subject<Unit> = PublishSubject.create()
|
||||||
override val confirmDeleteIntent: Subject<List<Long>> = PublishSubject.create()
|
override val confirmDeleteIntent: Subject<List<Long>> = PublishSubject.create()
|
||||||
override val confirmClearCurrentMessageIntent: Subject<Unit> = PublishSubject.create()
|
override val clearCurrentMessageIntent: Subject<Boolean> = PublishSubject.create()
|
||||||
override val clearCurrentMessageIntent: Subject<Unit> = PublishSubject.create()
|
|
||||||
override val messageLinkAskIntent: Subject<Uri> by lazy { messageAdapter.messageLinkClicks }
|
override val messageLinkAskIntent: Subject<Uri> by lazy { messageAdapter.messageLinkClicks }
|
||||||
override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() }
|
override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() }
|
||||||
override val shadeIntent by lazy { shadeBackground.clicks() }
|
override val shadeIntent by lazy { shadeBackground.clicks() }
|
||||||
@@ -729,7 +728,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
|||||||
.setTitle(R.string.dialog_clear_compose_title)
|
.setTitle(R.string.dialog_clear_compose_title)
|
||||||
.setMessage(R.string.dialog_clear_compose)
|
.setMessage(R.string.dialog_clear_compose)
|
||||||
.setPositiveButton(R.string.button_clear) { _, _ ->
|
.setPositiveButton(R.string.button_clear) { _, _ ->
|
||||||
clearCurrentMessageIntent.onNext(Unit)
|
clearCurrentMessageIntent.onNext(false)
|
||||||
}
|
}
|
||||||
.setNegativeButton(R.string.button_cancel, null)
|
.setNegativeButton(R.string.button_cancel, null)
|
||||||
.show()
|
.show()
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ interface ComposeView : QkView<ComposeState> {
|
|||||||
val viewQksmsPlusIntent: Subject<Unit>
|
val viewQksmsPlusIntent: Subject<Unit>
|
||||||
val backPressedIntent: Observable<Unit>
|
val backPressedIntent: Observable<Unit>
|
||||||
val confirmDeleteIntent: Observable<List<Long>>
|
val confirmDeleteIntent: Observable<List<Long>>
|
||||||
val confirmClearCurrentMessageIntent: Observable<Unit>
|
val clearCurrentMessageIntent: Subject<Boolean>
|
||||||
val clearCurrentMessageIntent: Subject<Unit>
|
|
||||||
val messageLinkAskIntent: Observable<Uri>
|
val messageLinkAskIntent: Observable<Uri>
|
||||||
val speechRecogniserIntent: Observable<*>
|
val speechRecogniserIntent: Observable<*>
|
||||||
val shadeIntent: Observable<Unit>
|
val shadeIntent: Observable<Unit>
|
||||||
|
|||||||
@@ -1028,7 +1028,9 @@ class ComposeViewModel @Inject constructor(
|
|||||||
true -> conversation.recipients.map { it.address }
|
true -> conversation.recipients.map { it.address }
|
||||||
false -> chips.map { chip -> chip.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 {
|
when {
|
||||||
// Scheduling a message
|
// Scheduling a message
|
||||||
@@ -1073,8 +1075,13 @@ class ComposeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the current message ready for new message composition
|
// clear the current message ready for new message composition (or finish()
|
||||||
view.clearCurrentMessageIntent.onNext(Unit)
|
// 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())
|
.autoDisposable(view.scope())
|
||||||
.subscribe()
|
.subscribe()
|
||||||
@@ -1106,22 +1113,15 @@ class ComposeViewModel @Inject constructor(
|
|||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { view.clearSelection() }
|
.subscribe { view.clearSelection() }
|
||||||
|
|
||||||
view.confirmClearCurrentMessageIntent
|
|
||||||
.autoDisposable(view.scope())
|
|
||||||
.subscribe { view.clearCurrentMessageIntent.onNext(Unit) }
|
|
||||||
|
|
||||||
// clear the current message schedule, text and attachments
|
// clear the current message schedule, text and attachments
|
||||||
view.clearCurrentMessageIntent
|
view.clearCurrentMessageIntent
|
||||||
.withLatestFrom(state) { _, state -> state }
|
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe {
|
.subscribe {
|
||||||
view.setDraft("")
|
view.setDraft("")
|
||||||
// if choosing contacts, don't remove attachments. they may have come from an
|
|
||||||
// external share
|
|
||||||
newState {
|
newState {
|
||||||
copy(
|
copy(
|
||||||
editingMode = false,
|
editingMode = false,
|
||||||
hasError = !sendAsGroup,
|
hasError = it, // hasError being kinda misused to finish() compose activity
|
||||||
attachments = listOf(),
|
attachments = listOf(),
|
||||||
scheduled = 0,
|
scheduled = 0,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user