Reduces the amount of wasted memory by using Array<Array<List>> as opposed to List<List<String>> for tags.

This commit is contained in:
Vitor Pamplona
2023-11-28 15:00:41 -05:00
parent d87542a949
commit 5356d869fd
68 changed files with 388 additions and 390 deletions
@@ -284,7 +284,7 @@ open class Note(val idHex: String) {
}
fun removeReaction(note: Note) {
val tags = note.event?.tags() ?: emptyList()
val tags = note.event?.tags() ?: emptyArray()
val reaction = note.event?.content()?.firstFullCharOrEmoji(ImmutableListOfLists(tags)) ?: "+"
if (reaction in reactions.keys && reactions[reaction]?.contains(note) == true) {
@@ -403,7 +403,7 @@ open class Note(val idHex: String) {
}
fun addReaction(note: Note) {
val tags = note.event?.tags() ?: emptyList()
val tags = note.event?.tags() ?: emptyArray()
val reaction = note.event?.content()?.firstFullCharOrEmoji(ImmutableListOfLists(tags)) ?: "+"
if (reaction !in reactions.keys) {
@@ -1586,7 +1586,7 @@ fun RenderAppDefinition(
Row(verticalAlignment = Alignment.Bottom, modifier = Modifier.padding(top = 7.dp)) {
CreateTextWithEmoji(
text = it,
tags = remember { (note.event?.tags() ?: emptyList()).toImmutableListOfLists() },
tags = remember { (note.event?.tags() ?: emptyArray()).toImmutableListOfLists() },
fontWeight = FontWeight.Bold,
fontSize = 25.sp
)
@@ -64,7 +64,7 @@ class MultiSetCard(
)
val likeEventsByType = likeEvents.groupBy {
it.event?.content()?.firstFullCharOrEmoji(ImmutableListOfLists(it.event?.tags() ?: emptyList())) ?: "+"
it.event?.content()?.firstFullCharOrEmoji(ImmutableListOfLists(it.event?.tags() ?: emptyArray())) ?: "+"
}.mapValues {
it.value.toImmutableList()
}.toImmutableMap()