move GalleryUrl to GalleryListEvent, merge recent changes
This commit is contained in:
@@ -73,21 +73,3 @@ data class EmojiUrl(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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,7 +119,7 @@ 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] == GalleryListEvent.GALLERYTAGNAME }.map { GalleryUrl(it[1], it[2]) }
|
||||
override fun taggedGalleryEntries() = tags.filter { it.size > 2 && it[0] == GalleryListEvent.GALLERYTAGNAME }.map { GalleryListEvent.GalleryUrl(it[1], it[2]) }
|
||||
|
||||
override fun taggedUrls() = tags.filter { it.size > 1 && it[0] == "r" }.map { it[1] }
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ interface EventInterface {
|
||||
|
||||
fun firstTaggedK(): Int?
|
||||
|
||||
fun taggedGalleryEntries(): List<GalleryUrl>
|
||||
fun taggedGalleryEntries(): List<GalleryListEvent.GalleryUrl>
|
||||
|
||||
fun taggedEmojis(): List<EmojiUrl>
|
||||
|
||||
|
||||
@@ -139,4 +139,23 @@ class GalleryListEvent(
|
||||
signer.sign(createdAt, KIND, newTags, content, onReady)
|
||||
}
|
||||
}
|
||||
|
||||
@Immutable
|
||||
data class GalleryUrl(
|
||||
val id: String,
|
||||
val url: String,
|
||||
) {
|
||||
fun encode(): String = ":$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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user