increases the time to notify to 15 minutes

pull/819/head
Vitor Pamplona 2024-03-26 08:35:15 -04:00
rodzic fa4745038f
commit 75ac17b57d
2 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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