mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-23 06:08:52 +01:00
fix no creation of a new conversation when no existing conversation to member of a multi-recipient sms not sent as group
This commit is contained in:
@@ -999,6 +999,7 @@ class ComposeViewModel @Inject constructor(
|
|||||||
|
|
||||||
// Send a message when the send button is clicked, and disable editing mode if it's enabled
|
// Send a message when the send button is clicked, and disable editing mode if it's enabled
|
||||||
view.sendIntent
|
view.sendIntent
|
||||||
|
.observeOn(Schedulers.io())
|
||||||
.withLatestFrom(view.textChangedIntent) { _, body -> body.toString() }
|
.withLatestFrom(view.textChangedIntent) { _, body -> body.toString() }
|
||||||
.withLatestFrom(state, conversation, selectedChips) { body, state, conversation, chips ->
|
.withLatestFrom(state, conversation, selectedChips) { body, state, conversation, chips ->
|
||||||
if (!permissionManager.isDefaultSms()) {
|
if (!permissionManager.isDefaultSms()) {
|
||||||
@@ -1063,14 +1064,25 @@ class ComposeViewModel @Inject constructor(
|
|||||||
|
|
||||||
// Send a message to multiple addresses
|
// Send a message to multiple addresses
|
||||||
else -> {
|
else -> {
|
||||||
addresses.forEach { addr ->
|
addresses.forEach {
|
||||||
val threadId = tryOrNull(false) {
|
val threadId = tryOrNull(false) {
|
||||||
TelephonyCompat.getOrCreateThreadId(context, addr)
|
TelephonyCompat.getOrCreateThreadId(context, it)
|
||||||
} ?: 0
|
} ?: 0
|
||||||
val address = listOf(conversationRepo
|
val address = conversationRepo.getOrCreateConversation(it)
|
||||||
.getConversation(threadId)?.recipients?.firstOrNull()?.address ?: addr)
|
?.recipients
|
||||||
sendMessage.execute(SendMessage
|
?.firstOrNull()
|
||||||
.Params(subId, threadId, address, body, state.attachments, delay))
|
?.address
|
||||||
|
?: it
|
||||||
|
sendMessage.execute(
|
||||||
|
SendMessage.Params(
|
||||||
|
subId,
|
||||||
|
threadId,
|
||||||
|
listOf(address),
|
||||||
|
body,
|
||||||
|
state.attachments,
|
||||||
|
delay
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1115,6 +1127,7 @@ class ComposeViewModel @Inject constructor(
|
|||||||
|
|
||||||
// clear the current message schedule, text and attachments
|
// clear the current message schedule, text and attachments
|
||||||
view.clearCurrentMessageIntent
|
view.clearCurrentMessageIntent
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe {
|
.subscribe {
|
||||||
view.setDraft("")
|
view.setDraft("")
|
||||||
|
|||||||
Reference in New Issue
Block a user