add the PendingIntent.FLAG_IMMUTABLE flag to PendingIntents
This commit is contained in:
parent
15d6b7f17a
commit
bf2f4887ca
|
@ -5,7 +5,10 @@ import android.app.Notification
|
||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.*
|
import android.content.ContentResolver
|
||||||
|
import android.content.ContentValues
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
|
@ -40,8 +43,6 @@ import com.simplemobiletools.smsmessenger.receivers.DirectReplyReceiver
|
||||||
import com.simplemobiletools.smsmessenger.receivers.MarkAsReadReceiver
|
import com.simplemobiletools.smsmessenger.receivers.MarkAsReadReceiver
|
||||||
import me.leolin.shortcutbadger.ShortcutBadger
|
import me.leolin.shortcutbadger.ShortcutBadger
|
||||||
import java.io.FileNotFoundException
|
import java.io.FileNotFoundException
|
||||||
import java.util.*
|
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
val Context.config: Config get() = Config.newInstance(applicationContext)
|
val Context.config: Config get() = Config.newInstance(applicationContext)
|
||||||
|
|
||||||
|
@ -745,14 +746,15 @@ fun Context.showMessageNotification(address: String, body: String, threadId: Lon
|
||||||
putExtra(THREAD_ID, threadId)
|
putExtra(THREAD_ID, threadId)
|
||||||
}
|
}
|
||||||
|
|
||||||
val pendingIntent = PendingIntent.getActivity(this, threadId.hashCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
val pendingIntent = PendingIntent.getActivity(this, threadId.hashCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
val summaryText = getString(R.string.new_message)
|
val summaryText = getString(R.string.new_message)
|
||||||
val markAsReadIntent = Intent(this, MarkAsReadReceiver::class.java).apply {
|
val markAsReadIntent = Intent(this, MarkAsReadReceiver::class.java).apply {
|
||||||
action = MARK_AS_READ
|
action = MARK_AS_READ
|
||||||
putExtra(THREAD_ID, threadId)
|
putExtra(THREAD_ID, threadId)
|
||||||
}
|
}
|
||||||
|
|
||||||
val markAsReadPendingIntent = PendingIntent.getBroadcast(this, threadId.hashCode(), markAsReadIntent, PendingIntent.FLAG_UPDATE_CURRENT)
|
val markAsReadPendingIntent =
|
||||||
|
PendingIntent.getBroadcast(this, threadId.hashCode(), markAsReadIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
var replyAction: NotificationCompat.Action? = null
|
var replyAction: NotificationCompat.Action? = null
|
||||||
|
|
||||||
if (isNougatPlus()) {
|
if (isNougatPlus()) {
|
||||||
|
@ -766,7 +768,8 @@ fun Context.showMessageNotification(address: String, body: String, threadId: Lon
|
||||||
putExtra(THREAD_NUMBER, address)
|
putExtra(THREAD_NUMBER, address)
|
||||||
}
|
}
|
||||||
|
|
||||||
val replyPendingIntent = PendingIntent.getBroadcast(applicationContext, threadId.hashCode(), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT)
|
val replyPendingIntent =
|
||||||
|
PendingIntent.getBroadcast(applicationContext, threadId.hashCode(), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
replyAction = NotificationCompat.Action.Builder(R.drawable.ic_send_vector, replyLabel, replyPendingIntent)
|
replyAction = NotificationCompat.Action.Builder(R.drawable.ic_send_vector, replyLabel, replyPendingIntent)
|
||||||
.addRemoteInput(remoteInput)
|
.addRemoteInput(remoteInput)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -87,7 +87,7 @@ class SmsStatusSentReceiver : SentReceiver() {
|
||||||
putExtra(THREAD_ID, threadId)
|
putExtra(THREAD_ID, threadId)
|
||||||
}
|
}
|
||||||
|
|
||||||
val pendingIntent = PendingIntent.getActivity(context, threadId.hashCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
val pendingIntent = PendingIntent.getActivity(context, threadId.hashCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
val summaryText = String.format(context.getString(R.string.message_sending_error), recipientName)
|
val summaryText = String.format(context.getString(R.string.message_sending_error), recipientName)
|
||||||
|
|
||||||
val largeIcon = SimpleContactsHelper(context).getContactLetterIcon(recipientName)
|
val largeIcon = SimpleContactsHelper(context).getContactLetterIcon(recipientName)
|
||||||
|
|
Loading…
Reference in New Issue