diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadBodyUtil.java b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadBodyUtil.java index 6b437210b4..acc00bf81e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadBodyUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadBodyUtil.java @@ -112,6 +112,10 @@ public final class ThreadBodyUtil { return format(EmojiStrings.POLL, context.getString(R.string.Poll__poll_end, record.getFromRecipient().getDisplayName(context), record.getMessageExtras().pollTerminate.question), null).body; } + public static CharSequence getFormattedBodyForReply(@NonNull Context context, @NonNull CharSequence body) { + return context.getString(R.string.MessageNotifier_replied_to_you, body); + } + private static @NonNull String getGiftSummary(@NonNull Context context, @NonNull MessageRecord messageRecord) { if (messageRecord.isOutgoing()) { return context.getString(R.string.ThreadRecord__you_donated_for_s, messageRecord.getToRecipient().getShortDisplayName(context)); diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationFactory.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationFactory.kt index 80e449f11e..0b7a27c35c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationFactory.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationFactory.kt @@ -210,7 +210,7 @@ object NotificationFactory { private fun shouldAlert(conversation: NotificationConversation, lastNotificationTimestamp: Long, alertOverride: Boolean): Boolean { val throttle: Duration = when { !AppDependencies.incomingMessageObserver.decryptionDrained -> STILL_DECRYPTING_THROTTLE - conversation.recipient.isGroup && (conversation.mostRecentNotification as? MessageNotification)?.hasSelfMention == false -> GROUP_THROTTLE + conversation.recipient.isGroup && (conversation.mostRecentNotification as? MessageNotification)?.hasSelfMention != true && (conversation.mostRecentNotification as? MessageNotification)?.isReplyToSelf != true -> GROUP_THROTTLE else -> INDIVIDUAL_THROTTLE } val canAlertBasedOnTime: Boolean = lastNotificationTimestamp < System.currentTimeMillis() - throttle.inWholeMilliseconds || lastNotificationTimestamp > System.currentTimeMillis() diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationItem.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationItem.kt index 1cb9c901bf..6be896e99b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationItem.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/v2/NotificationItem.kt @@ -236,7 +236,8 @@ class MessageNotification(threadRecipient: Recipient, record: MessageRecord, val override val timestamp: Long = record.timestamp override val authorRecipient: Recipient = record.fromRecipient.resolve() override val isNewNotification: Boolean = notifiedTimestamp == 0L && !record.isEditMessage - val hasSelfMention = record.hasSelfMention() || (record is MmsMessageRecord && record.quote?.author == Recipient.self().id) + val isReplyToSelf = record is MmsMessageRecord && threadRecipient.isGroup && record.quote?.author == Recipient.self().id + val hasSelfMention = record.hasSelfMention() private var thumbnailInfo: ThumbnailInfo = NotificationThumbnails.getWithoutModifying(this) @@ -264,6 +265,8 @@ class MessageNotification(threadRecipient: Recipient, record: MessageRecord, val ThreadBodyUtil.getFormattedBodyForPollNotification(context, record as MmsMessageRecord) } else if (record.hasPollTerminate()) { ThreadBodyUtil.getFormattedBodyForPollEndNotification(context, record as MmsMessageRecord) + } else if (isReplyToSelf) { + ThreadBodyUtil.getFormattedBodyForReply(context, getBodyWithMentionsAndStyles(context, record)) } else { getBodyWithMentionsAndStyles(context, record) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d3121aaeea..466e4042a1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3307,6 +3307,8 @@ %1$s in %2$s + + Replied to you: %1$s %1$d message