mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 11:57:29 +01:00
gallery is visualised
This commit is contained in:
@@ -72,3 +72,21 @@ data class EmojiUrl(val code: String, val url: String) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Immutable
|
||||
data class GalleryUrl(val id: String, val url: String) {
|
||||
fun encode(): String {
|
||||
return ":$id:$url"
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun decode(encodedGallerySetup: String): EmojiUrl? {
|
||||
val emojiParts = encodedGallerySetup.split(":", limit = 3)
|
||||
return if (emojiParts.size > 2) {
|
||||
EmojiUrl(emojiParts[1], emojiParts[2])
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,8 @@ open class Event(
|
||||
|
||||
override fun taggedEvents() = tags.filter { it.size > 1 && it[0] == "e" }.map { it[1] }
|
||||
|
||||
override fun taggedGalleryEntries() = tags.filter { it.size > 2 && it[0] == "g" }.map { GalleryUrl(it[1], it[2]) }
|
||||
|
||||
override fun taggedUrls() = tags.filter { it.size > 1 && it[0] == "r" }.map { it[1] }
|
||||
|
||||
override fun firstTagFor(vararg key: String) = tags.firstOrNull { it.size > 1 && it[0] in key }?.let { it[1] }
|
||||
|
||||
@@ -145,6 +145,8 @@ interface EventInterface {
|
||||
|
||||
fun firstTaggedK(): Int?
|
||||
|
||||
fun taggedGalleryEntries(): List<GalleryUrl>
|
||||
|
||||
fun taggedEmojis(): List<EmojiUrl>
|
||||
|
||||
fun matchTag1With(text: String): Boolean
|
||||
|
||||
Reference in New Issue
Block a user