mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Show toast to internal users for invalid messages.
This commit is contained in:
committed by
Alex Hart
parent
ace47c61b1
commit
78b530f8b8
@@ -133,6 +133,11 @@ object MessageDecryptor {
|
||||
|
||||
if (validationResult is EnvelopeContentValidator.Result.Invalid) {
|
||||
Log.w(TAG, "${logPrefix(envelope, cipherResult)} Invalid content! ${validationResult.reason}", validationResult.throwable)
|
||||
|
||||
if (FeatureFlags.internalUser()) {
|
||||
postInvalidMessageNotification(context, validationResult.reason)
|
||||
}
|
||||
|
||||
return Result.Ignore(envelope, serverDeliveredTimestamp, followUpOperations.toUnmodifiableList())
|
||||
}
|
||||
|
||||
@@ -182,7 +187,7 @@ object MessageDecryptor {
|
||||
Log.w(TAG, "${logPrefix(envelope, e)} Decryption error!", e, true)
|
||||
|
||||
if (FeatureFlags.internalUser()) {
|
||||
postErrorNotification(context)
|
||||
postDecryptionErrorNotification(context)
|
||||
}
|
||||
|
||||
if (FeatureFlags.retryReceipts()) {
|
||||
@@ -324,11 +329,22 @@ object MessageDecryptor {
|
||||
}
|
||||
}
|
||||
|
||||
private fun postErrorNotification(context: Context) {
|
||||
private fun postDecryptionErrorNotification(context: Context) {
|
||||
val notification: Notification = NotificationCompat.Builder(context, NotificationChannels.getInstance().FAILURES)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentTitle(context.getString(R.string.MessageDecryptionUtil_failed_to_decrypt_message))
|
||||
.setContentText(context.getString(R.string.MessageDecryptionUtil_tap_to_send_a_debug_log))
|
||||
.setContentTitle("[Internal-only] Failed to decrypt a message!")
|
||||
.setContentText("Tap to send a debug log")
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, Intent(context, SubmitDebugLogActivity::class.java), PendingIntentFlags.mutable()))
|
||||
.build()
|
||||
|
||||
NotificationManagerCompat.from(context).notify(NotificationIds.INTERNAL_ERROR, notification)
|
||||
}
|
||||
|
||||
private fun postInvalidMessageNotification(context: Context, message: String) {
|
||||
val notification: Notification = NotificationCompat.Builder(context, NotificationChannels.getInstance().FAILURES)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentTitle("[Internal-only] Received an invalid message!")
|
||||
.setContentText("$message Tap to send a debug log.")
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, Intent(context, SubmitDebugLogActivity::class.java), PendingIntentFlags.mutable()))
|
||||
.build()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user