Use vertical bar '|' as the address separator

Sometimes, an address might contain a space character and that conflicts when space is also used as address separator
This commit is contained in:
Naveen
2022-06-12 02:11:14 +05:30
parent 95c02be871
commit d595ac8135

View File

@@ -26,6 +26,7 @@ import android.text.TextUtils
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.app.RemoteInput import androidx.core.app.RemoteInput
import com.klinker.android.send_message.Settings import com.klinker.android.send_message.Settings
import com.klinker.android.send_message.Transaction
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.PhoneNumber import com.simplemobiletools.commons.models.PhoneNumber
@@ -104,7 +105,7 @@ fun Context.getMessages(threadId: Long, getImageResolutions: Boolean, dateFrom:
val thread = cursor.getLongValue(Sms.THREAD_ID) val thread = cursor.getLongValue(Sms.THREAD_ID)
val subscriptionId = cursor.getIntValue(Sms.SUBSCRIPTION_ID) val subscriptionId = cursor.getIntValue(Sms.SUBSCRIPTION_ID)
val status = cursor.getIntValue(Sms.STATUS) val status = cursor.getIntValue(Sms.STATUS)
val participants = senderNumber.split(" ").map { number -> val participants = senderNumber.split(Transaction.ADDRESS_SEPARATOR).map { number ->
val phoneNumber = PhoneNumber(number, 0, "", number) val phoneNumber = PhoneNumber(number, 0, "", number)
val participantPhoto = getNameAndPhotoFromPhoneNumber(number) val participantPhoto = getNameAndPhotoFromPhoneNumber(number)
SimpleContact(0, 0, participantPhoto.name, photoUri, arrayListOf(phoneNumber), ArrayList(), ArrayList()) SimpleContact(0, 0, participantPhoto.name, photoUri, arrayListOf(phoneNumber), ArrayList(), ArrayList())
@@ -813,7 +814,12 @@ fun Context.showMessageNotification(address: String, body: String, threadId: Lon
notificationManager.notify(threadId.hashCode(), builder.build()) notificationManager.notify(threadId.hashCode(), builder.build())
} }
private fun Context.getMessagesStyle(notificationManager: NotificationManager, threadId: Long, sender: String, body: String): NotificationCompat.MessagingStyle { private fun Context.getMessagesStyle(
notificationManager: NotificationManager,
threadId: Long,
sender: String,
body: String
): NotificationCompat.MessagingStyle {
val oldMessages = getOldMessages(notificationManager, threadId) val oldMessages = getOldMessages(notificationManager, threadId)
val messages = NotificationCompat.MessagingStyle(getString(R.string.me)) val messages = NotificationCompat.MessagingStyle(getString(R.string.me))
oldMessages.forEach { oldMessages.forEach {