Allows users to pick relays on the request to vanish screen
This commit is contained in:
+3
-2
@@ -23,6 +23,7 @@ package com.vitorpamplona.quartz.nip62RequestToVanish
|
||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip62RequestToVanish.tags.shouldVanishFrom
|
||||
@@ -48,7 +49,7 @@ class RequestToVanishEvent(
|
||||
const val ALT = "Request to vanish"
|
||||
|
||||
fun build(
|
||||
relay: String,
|
||||
relay: NormalizedRelayUrl,
|
||||
reason: String = "",
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<RequestToVanishEvent>.() -> Unit = {},
|
||||
@@ -59,7 +60,7 @@ class RequestToVanishEvent(
|
||||
}
|
||||
|
||||
fun build(
|
||||
relays: List<String>,
|
||||
relays: List<NormalizedRelayUrl>,
|
||||
reason: String = "",
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<RequestToVanishEvent>.() -> Unit = {},
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@
|
||||
package com.vitorpamplona.quartz.nip62RequestToVanish.tags
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.has
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.utils.ensure
|
||||
|
||||
class RelayTag {
|
||||
@@ -44,7 +45,7 @@ class RelayTag {
|
||||
return tag[1]
|
||||
}
|
||||
|
||||
fun assemble(relay: String) = arrayOf(TAG_NAME, relay)
|
||||
fun assemble(relay: NormalizedRelayUrl) = arrayOf(TAG_NAME, relay.url)
|
||||
|
||||
fun assembleEverywhere() = arrayOf(TAG_NAME, EVERYWHERE)
|
||||
}
|
||||
|
||||
+3
-2
@@ -21,10 +21,11 @@
|
||||
package com.vitorpamplona.quartz.nip62RequestToVanish.tags
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent
|
||||
|
||||
fun TagArrayBuilder<RequestToVanishEvent>.vanishFromEverywhere() = add(RelayTag.assembleEverywhere())
|
||||
|
||||
fun TagArrayBuilder<RequestToVanishEvent>.vanishFrom(relay: String) = add(RelayTag.assemble(relay))
|
||||
fun TagArrayBuilder<RequestToVanishEvent>.vanishFrom(relay: NormalizedRelayUrl) = add(RelayTag.assemble(relay))
|
||||
|
||||
fun TagArrayBuilder<RequestToVanishEvent>.vanishFrom(relays: List<String>) = addAll(relays.map { RelayTag.assemble(it) })
|
||||
fun TagArrayBuilder<RequestToVanishEvent>.vanishFrom(relays: List<NormalizedRelayUrl>) = addAll(relays.map { RelayTag.assemble(it) })
|
||||
|
||||
Reference in New Issue
Block a user