Prefer incoming address over user preference

This is what google messages does.
This commit is contained in:
Naveen 2022-09-18 21:26:09 +05:30
parent 6842e1c5b6
commit b85dbf3b4b
1 changed files with 6 additions and 2 deletions

View File

@ -573,7 +573,11 @@ class ThreadActivity : SimpleActivity() {
val userPreferredSimIdx = availableSIMs.indexOfFirstOrNull { it.subscriptionId == userPreferredSimId } val userPreferredSimIdx = availableSIMs.indexOfFirstOrNull { it.subscriptionId == userPreferredSimId }
val lastMessage = messages.lastOrNull() val lastMessage = messages.lastOrNull()
val senderPreferredSimIdx = availableSIMs.indexOfFirstOrNull { it.subscriptionId == lastMessage?.subscriptionId } val senderPreferredSimIdx = if (lastMessage?.isReceivedMessage() == true) {
availableSIMs.indexOfFirstOrNull { it.subscriptionId == lastMessage.subscriptionId }
} else {
null
}
val defaultSmsSubscriptionId = SmsManager.getDefaultSmsSubscriptionId() val defaultSmsSubscriptionId = SmsManager.getDefaultSmsSubscriptionId()
val systemPreferredSimIdx = if (defaultSmsSubscriptionId >= 0) { val systemPreferredSimIdx = if (defaultSmsSubscriptionId >= 0) {
@ -583,7 +587,7 @@ class ThreadActivity : SimpleActivity() {
null null
} }
return userPreferredSimIdx ?: senderPreferredSimIdx ?: systemPreferredSimIdx ?: 0 return senderPreferredSimIdx ?: userPreferredSimIdx ?: systemPreferredSimIdx ?: 0
} }
private fun blockNumber() { private fun blockNumber() {