diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt index 274bb5c87..2a273d1c7 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt @@ -108,7 +108,7 @@ class EventNotificationConsumer(private val applicationContext: Context) { acc: Account, ) { if ( - event.createdAt > TimeUtils.fiveMinutesAgo() && // old event being re-broadcasted + event.createdAt > TimeUtils.fifteenMinutesAgo() && // old event being re-broadcasted event.pubKey != acc.userProfile().pubkeyHex ) { // from the user @@ -148,7 +148,7 @@ class EventNotificationConsumer(private val applicationContext: Context) { val note = LocalCache.getNoteIfExists(event.id) ?: return // old event being re-broadcast - if (event.createdAt < TimeUtils.fiveMinutesAgo()) return + if (event.createdAt < TimeUtils.fifteenMinutesAgo()) return if (acc.userProfile().pubkeyHex == event.verifiedRecipientPubKey()) { val followingKeySet = acc.followingKeySet() @@ -187,7 +187,7 @@ class EventNotificationConsumer(private val applicationContext: Context) { val noteZapEvent = LocalCache.getNoteIfExists(event.id) ?: return // old event being re-broadcast - if (event.createdAt < TimeUtils.fiveMinutesAgo()) return + if (event.createdAt < TimeUtils.fifteenMinutesAgo()) return val noteZapRequest = event.zapRequest?.id?.let { LocalCache.checkGetOrCreateNote(it) } ?: return val noteZapped = @@ -195,7 +195,7 @@ class EventNotificationConsumer(private val applicationContext: Context) { if ((event.amount ?: BigDecimal.ZERO) < BigDecimal.TEN) return - if (acc.userProfile().pubkeyHex == event.zappedAuthor().firstOrNull()) { + if (event.isTaggedUser(acc.userProfile().pubkeyHex)) { val amount = showAmount(event.amount) (noteZapRequest.event as? LnZapRequestEvent)?.let { event -> acc.decryptZapContentAuthor(noteZapRequest) { diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/utils/TimeUtils.kt b/quartz/src/main/java/com/vitorpamplona/quartz/utils/TimeUtils.kt index ae403463e..31bf69730 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/utils/TimeUtils.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/utils/TimeUtils.kt @@ -25,6 +25,7 @@ import com.vitorpamplona.quartz.crypto.CryptoUtils object TimeUtils { const val ONE_MINUTE = 60 const val FIVE_MINUTES = 5 * ONE_MINUTE + const val FIFTEEN_MINUTES = 15 * ONE_MINUTE const val ONE_HOUR = 60 * ONE_MINUTE const val EIGHT_HOURS = 8 * ONE_HOUR const val ONE_DAY = 24 * ONE_HOUR @@ -40,6 +41,8 @@ object TimeUtils { fun fiveMinutesAgo() = now() - FIVE_MINUTES + fun fifteenMinutesAgo() = now() - FIFTEEN_MINUTES + fun oneHourAgo() = now() - ONE_HOUR fun oneHourAhead() = now() + ONE_HOUR