mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 23:04:30 +02:00
add nip90 content discovery request
This commit is contained in:
@@ -72,17 +72,22 @@ private fun RenderNostrNIP90ContentDiscoveryScreen(
|
|||||||
if (DVMID != null) {
|
if (DVMID != null) {
|
||||||
Text(text = "Debug: DVM KEY:\n " + DVMID)
|
Text(text = "Debug: DVM KEY:\n " + DVMID)
|
||||||
}
|
}
|
||||||
// TODO Send KIND 5300 Event with p tag = DVMID
|
|
||||||
|
|
||||||
/*note.event?.let {
|
if (DVMID != null) {
|
||||||
ReactionEvent.create(emojiUrl, it, signer) {
|
// TODO 1 Send KIND 5300 Event with p tag = DVMID (crashes)
|
||||||
Client.send(it)
|
|
||||||
LocalCache.consume(it)
|
/*
|
||||||
|
var signer = accountViewModel.account.signer
|
||||||
|
NIP90ContentDiscoveryRequestEvent.create(DVMID, signer) {
|
||||||
|
// Client.send(it)
|
||||||
|
// LocalCache.justConsume(it, null)
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
// TODO PARSE AND LOAD RESULTS FROM KIND 6300 REPLY to resultfeedmodel (RN this still is the bookmark list)
|
*/
|
||||||
// TODO Render Results
|
|
||||||
|
// TODO 2 PARSE AND LOAD RESULTS FROM KIND 6300 REPLY to resultfeedmodel (RN this still is the bookmark list)
|
||||||
|
|
||||||
|
// TODO 3 Render Results (hopefully works when 2 is working)
|
||||||
|
|
||||||
HorizontalPager(state = pagerState) {
|
HorizontalPager(state = pagerState) {
|
||||||
RefresheableFeedView(
|
RefresheableFeedView(
|
||||||
@@ -94,3 +99,4 @@ private fun RenderNostrNIP90ContentDiscoveryScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2024 Vitor Pamplona
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||||
|
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||||
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
package com.vitorpamplona.quartz.events
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
|
import androidx.compose.runtime.Stable
|
||||||
|
import com.vitorpamplona.quartz.encoders.HexKey
|
||||||
|
import com.vitorpamplona.quartz.signers.NostrSigner
|
||||||
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
|
|
||||||
|
@Stable
|
||||||
|
@Immutable
|
||||||
|
class NIP90ContentDiscoveryRequestEvent(
|
||||||
|
id: HexKey,
|
||||||
|
pubKey: HexKey,
|
||||||
|
createdAt: Long,
|
||||||
|
tags: Array<Array<String>>,
|
||||||
|
content: String,
|
||||||
|
sig: HexKey,
|
||||||
|
) : BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||||
|
@Transient private var cachedMetadata: AppMetadata? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KIND = 5300
|
||||||
|
|
||||||
|
fun create(
|
||||||
|
addressedDVM: String,
|
||||||
|
signer: NostrSigner,
|
||||||
|
createdAt: Long = TimeUtils.now(),
|
||||||
|
onReady: (NIP90ContentDiscoveryRequestEvent) -> Unit,
|
||||||
|
) {
|
||||||
|
val content = ""
|
||||||
|
|
||||||
|
// val clientTag = arrayOf("client", "Amethyst")
|
||||||
|
|
||||||
|
val tags = mutableListOf<Array<String>>()
|
||||||
|
tags.add(arrayOf("p", addressedDVM))
|
||||||
|
tags.add(arrayOf("alt", "NIP90 Content Discovery request"))
|
||||||
|
signer.sign(createdAt, KIND, tags.toTypedArray(), content, onReady)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user