mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 16:33:27 +00:00
Merge pull request #2949 from vitorpamplona/claude/add-zaps-to-stats-Z2qHO
feat(notifications): include onchain zaps in summary stats
This commit is contained in:
+24
@@ -40,6 +40,7 @@ import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent
|
||||
import com.vitorpamplona.quartz.nip18Reposts.RepostEvent
|
||||
import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent
|
||||
import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent
|
||||
import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
@@ -124,6 +125,17 @@ class NotificationSummaryState(
|
||||
}
|
||||
}
|
||||
|
||||
noteEvent is OnchainZapEvent -> {
|
||||
if (noteEvent.isTaggedUser(currentUser)) {
|
||||
val amount = noteEvent.claimedAmountInSats()
|
||||
if (amount != null) {
|
||||
val netDate = formatDate(noteEvent.createdAt)
|
||||
zaps[netDate] = (zaps[netDate] ?: BigDecimal.ZERO) + BigDecimal.valueOf(amount)
|
||||
takenIntoAccount.add(noteEvent.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
noteEvent is BaseThreadedEvent &&
|
||||
noteEvent.isTaggedUser(currentUser) &&
|
||||
noteEvent.pubKey != currentUser -> {
|
||||
@@ -198,6 +210,18 @@ class NotificationSummaryState(
|
||||
}
|
||||
}
|
||||
|
||||
noteEvent is OnchainZapEvent -> {
|
||||
if (noteEvent.isTaggedUser(currentUser)) {
|
||||
val amount = noteEvent.claimedAmountInSats()
|
||||
if (amount != null) {
|
||||
val netDate = formatDate(noteEvent.createdAt)
|
||||
zaps[netDate] = (zaps[netDate] ?: BigDecimal.ZERO) + BigDecimal.valueOf(amount)
|
||||
takenIntoAccount.add(noteEvent.id)
|
||||
hasNewElements = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
noteEvent is BaseThreadedEvent &&
|
||||
noteEvent.isTaggedUser(currentUser) &&
|
||||
noteEvent.pubKey != currentUser -> {
|
||||
|
||||
Reference in New Issue
Block a user