Adds support for displaying video events.

This commit is contained in:
Vitor Pamplona
2023-12-29 17:24:50 -05:00
parent 57430c4366
commit 2de3d19a34
7 changed files with 176 additions and 5 deletions
@@ -23,6 +23,13 @@ open class BaseTextNoteEvent(
fun mentions() = taggedUsers()
open fun replyTos() = taggedEvents()
fun replyingTo(): HexKey? {
val oldStylePositional = tags.lastOrNull() { it.size > 1 && it[0] == "e" }?.get(1)
val newStyle = tags.lastOrNull { it.size > 3 && it[0] == "e" && it[3] == "reply" }?.get(1)
return newStyle ?: oldStylePositional
}
@Transient
private var citedUsersCache: Set<HexKey>? = null
@@ -39,7 +39,7 @@ class GoalEvent(
createdAt: Long = TimeUtils.now(),
onReady: (GoalEvent) -> Unit
) {
var tags = mutableListOf(
val tags = mutableListOf(
arrayOf(AMOUNT, amount.toString()),
arrayOf("relays") + relays,
arrayOf("alt", alt)
@@ -28,6 +28,11 @@ abstract class VideoEvent(
fun torrentInfoHash() = tags.firstOrNull { it.size > 1 && it[0] == TORRENT_INFOHASH }?.get(1)
fun blurhash() = tags.firstOrNull { it.size > 1 && it[0] == BLUR_HASH }?.get(1)
fun title() = tags.firstOrNull { it.size > 1 && it[0] == TITLE }?.get(1)
fun summary() = tags.firstOrNull { it.size > 1 && it[0] == SUMMARY }?.get(1)
fun image() = tags.firstOrNull { it.size > 1 && it[0] == IMAGE }?.get(1)
fun thumb() = tags.firstOrNull { it.size > 1 && it[0] == THUMB }?.get(1)
fun hasUrl() = tags.any { it.size > 1 && it[0] == URL }
companion object {