mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-11 01:03:58 +02:00
Breaks notification cards in chunks of 50 notifications each.
This commit is contained in:
@@ -100,14 +100,21 @@ open class CardFeedViewModel(val dataSource: FeedFilter<Note>) : ViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val allBaseNotes = zapsPerEvent.keys + boostsPerEvent.keys + reactionsPerEvent.keys
|
val allBaseNotes = zapsPerEvent.keys + boostsPerEvent.keys + reactionsPerEvent.keys
|
||||||
val multiCards = allBaseNotes.map {
|
val multiCards = allBaseNotes.map { baseNote ->
|
||||||
|
val boostsInCard = boostsPerEvent[baseNote] ?: emptyList()
|
||||||
|
val reactionsInCard = reactionsPerEvent[baseNote] ?: emptyList()
|
||||||
|
val zapsInCard = zapsPerEvent[baseNote] ?: emptyMap()
|
||||||
|
|
||||||
|
val singleList = (boostsInCard + zapsInCard.values + reactionsInCard).sortedBy { it.createdAt() }
|
||||||
|
singleList.chunked(50).map { chunk ->
|
||||||
MultiSetCard(
|
MultiSetCard(
|
||||||
it,
|
baseNote,
|
||||||
boostsPerEvent.get(it) ?: emptyList(),
|
boostsInCard.filter { it in chunk },
|
||||||
reactionsPerEvent.get(it) ?: emptyList(),
|
reactionsInCard.filter { it in chunk },
|
||||||
zapsPerEvent.get(it) ?: emptyMap()
|
zapsInCard.filter { it.value in chunk }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}.flatten()
|
||||||
|
|
||||||
val textNoteCards = notes.filter { it.event !is ReactionEvent && it.event !is RepostEvent && it.event !is LnZapEvent }.map {
|
val textNoteCards = notes.filter { it.event !is ReactionEvent && it.event !is RepostEvent && it.event !is LnZapEvent }.map {
|
||||||
if (it.event is PrivateDmEvent) {
|
if (it.event is PrivateDmEvent) {
|
||||||
|
Reference in New Issue
Block a user