Commit 8258a3bf by zhangchengbo

fix:解决通讯录回复发送失败问题

parent 57a78b72
......@@ -14,6 +14,7 @@ import android.media.RingtoneManager
import androidx.core.app.NotificationCompat
import androidx.core.app.Person
import androidx.core.app.RemoteInput
import com.secspace.log.Log
import com.secspace.sms.R
import com.secspace.sms.activities.ThreadActivity
import com.secspace.sms.extensions.config
......@@ -48,7 +49,7 @@ class NotificationHelper(private val context: Context) {
) {
maybeCreateChannel(name = context.getString(R.string.channel_received_sms))
// Log.d("TAG", "showReceivedMessageNotification: messageId = $messageId address = $address body = $body threadId = $threadId sender = $sender normalNumber = $normalNumber")
Log.d("TAG", "showReceivedMessageNotification: messageId = $messageId address = $address body = $body threadId = $threadId sender = $sender normalNumber = $normalNumber")
val notificationId = threadId.hashCode()
val contentIntent = Intent(context, ThreadActivity::class.java).apply {
putExtra(THREAD_ID, threadId)
......@@ -71,7 +72,7 @@ class NotificationHelper(private val context: Context) {
PendingIntent.getBroadcast(context, notificationId, deleteSmsIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE)
var replyAction: NotificationCompat.Action? = null
// val isNoReplySms = isShortCodeWithLetters(address)
val isNoReplySms = isShortCodeWithLetters(address)
if (isNougatPlus() /*&& !isNoReplySms*/) {
val replyLabel = context.getString(R.string.reply)
val remoteInput = RemoteInput.Builder(REPLY)
......@@ -81,7 +82,7 @@ class NotificationHelper(private val context: Context) {
val replyIntent = Intent(context, DirectReplyReceiver::class.java).apply {
putExtra(THREAD_ID, threadId)
putExtra(THREAD_TITLE, address)
if (address.contains("*")) {
if (address.contains("*") || normalNumber.isNotEmpty()) {
putExtra(THREAD_NUMBER, normalNumber)
}else{
putExtra(THREAD_NUMBER, address)
......@@ -137,13 +138,14 @@ class NotificationHelper(private val context: Context) {
builder.addAction(com.simplemobiletools.commons.R.drawable.ic_check_vector, context.getString(R.string.mark_as_read), markAsReadPendingIntent)
.setChannelId(NOTIFICATION_CHANNEL)
// if (isNoReplySms) {
/*Log.d("TAG", "showMessageNotification: isNoReplySms = $isNoReplySms")
if (isNoReplySms) {
builder.addAction(
com.simplemobiletools.commons.R.drawable.ic_delete_vector,
context.getString(com.simplemobiletools.commons.R.string.delete),
deleteSmsPendingIntent
).setChannelId(NOTIFICATION_CHANNEL)
// }
}*/
notificationManager.notify(notificationId, builder.build())
}
......
......@@ -249,7 +249,7 @@ class SmsReceiver : BroadcastReceiver() {
"handleMessage: notificationUserName = $notificationUserName 掩码号码 aesPhoneNumber = $aesPhoneNumber 正常号码 address = $address threadId = $threadId"
)
if (notificationUserName.isNotEmpty()) {
context.showReceivedMessageNotification(newMessageId, notificationUserName, body, threadId, bitmap)
context.showReceivedMessageNotification(newMessageId, notificationUserName, body, threadId, bitmap, normalNumber = address)
} else if (aesPhoneNumber.contains("*")) {
Log.d(TAG, "handleMessage: 掩码号码")
context.showReceivedMessageNotification(newMessageId, aesPhoneNumber, body, threadId, bitmap, normalNumber = address)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment