Fixes refactoring issues by Claude.
This commit is contained in:
+1
@@ -33,6 +33,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
|||||||
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
||||||
import com.vitorpamplona.quartz.nip01Core.crypto.verify
|
import com.vitorpamplona.quartz.nip01Core.crypto.verify
|
||||||
import com.vitorpamplona.quartz.nip01Core.jackson.JacksonMapper
|
import com.vitorpamplona.quartz.nip01Core.jackson.JacksonMapper
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal
|
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||||
import com.vitorpamplona.quartz.nip03Timestamp.EmptyOtsResolverBuilder
|
import com.vitorpamplona.quartz.nip03Timestamp.EmptyOtsResolverBuilder
|
||||||
|
|||||||
+1
@@ -24,6 +24,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
|||||||
import com.vitorpamplona.amethyst.model.Constants
|
import com.vitorpamplona.amethyst.model.Constants
|
||||||
import com.vitorpamplona.amethyst.service.okhttp.DefaultContentTypeInterceptor
|
import com.vitorpamplona.amethyst.service.okhttp.DefaultContentTypeInterceptor
|
||||||
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayLogger
|
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayLogger
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.auth.RelayAuthenticator
|
import com.vitorpamplona.quartz.nip01Core.relay.client.auth.RelayAuthenticator
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrl
|
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrl
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ import com.vitorpamplona.amethyst.ui.screen.UiSettingsState
|
|||||||
import com.vitorpamplona.amethyst.ui.tor.TorManager
|
import com.vitorpamplona.amethyst.ui.tor.TorManager
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Address
|
import com.vitorpamplona.quartz.nip01Core.core.Address
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient
|
import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayLogger
|
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayLogger
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayOfflineTracker
|
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayOfflineTracker
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.stats.RelayReqStats
|
import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.stats.RelayReqStats
|
||||||
|
|||||||
@@ -664,7 +664,7 @@ class Account(
|
|||||||
myRelayList.addAll(it.relays)
|
myRelayList.addAll(it.relays)
|
||||||
}
|
}
|
||||||
|
|
||||||
client.send(deletionEvent, myRelayList)
|
client.publish(deletionEvent, myRelayList)
|
||||||
cache.justConsumeMyOwnEvent(deletionEvent)
|
cache.justConsumeMyOwnEvent(deletionEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -678,7 +678,7 @@ class Account(
|
|||||||
if (event.pubKey != signer.pubKey) return
|
if (event.pubKey != signer.pubKey) return
|
||||||
|
|
||||||
val deletionEvent = signer.sign(DeletionEvent.build(listOf(event)))
|
val deletionEvent = signer.sign(DeletionEvent.build(listOf(event)))
|
||||||
client.send(deletionEvent, outboxRelays.flow.value + additionalRelays)
|
client.publish(deletionEvent, outboxRelays.flow.value + additionalRelays)
|
||||||
cache.justConsumeMyOwnEvent(deletionEvent)
|
cache.justConsumeMyOwnEvent(deletionEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -952,11 +952,11 @@ class Account(
|
|||||||
},
|
},
|
||||||
)?.let { downloadedEvent ->
|
)?.let { downloadedEvent ->
|
||||||
val toRelays = computeRelayListToBroadcast(downloadedEvent)
|
val toRelays = computeRelayListToBroadcast(downloadedEvent)
|
||||||
client.send(downloadedEvent, toRelays)
|
client.publish(downloadedEvent, toRelays)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
client.send(noteEvent, computeRelayListToBroadcast(note))
|
client.publish(noteEvent, computeRelayListToBroadcast(note))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1004,7 +1004,7 @@ class Account(
|
|||||||
val relays = outboxRelays.flow.value + commEvent.relayUrls() + community.relays + (post.author?.inboxRelays() ?: emptyList())
|
val relays = outboxRelays.flow.value + commEvent.relayUrls() + community.relays + (post.author?.inboxRelays() ?: emptyList())
|
||||||
|
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
client.send(signedEvent, relays)
|
client.publish(signedEvent, relays)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendAutomatic(events: List<Event>) = events.forEach { sendAutomatic(it) }
|
fun sendAutomatic(events: List<Event>) = events.forEach { sendAutomatic(it) }
|
||||||
@@ -1027,7 +1027,7 @@ class Account(
|
|||||||
val signedEvent = signer.sign(template)
|
val signedEvent = signer.sign(template)
|
||||||
|
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
client.send(signedEvent, computeRelayListToBroadcast(signedEvent))
|
client.publish(signedEvent, computeRelayListToBroadcast(signedEvent))
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun deleteWebBookmark(event: WebBookmarkEvent) {
|
suspend fun deleteWebBookmark(event: WebBookmarkEvent) {
|
||||||
@@ -1037,7 +1037,7 @@ class Account(
|
|||||||
val signedEvent = signer.sign(template)
|
val signedEvent = signer.sign(template)
|
||||||
|
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
client.send(signedEvent, computeRelayListToBroadcast(signedEvent))
|
client.publish(signedEvent, computeRelayListToBroadcast(signedEvent))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendMyPublicAndPrivateOutbox(event: Event?) {
|
fun sendMyPublicAndPrivateOutbox(event: Event?) {
|
||||||
@@ -1048,7 +1048,7 @@ class Account(
|
|||||||
|
|
||||||
fun sendMyPublicAndPrivateOutbox(events: List<Event>) {
|
fun sendMyPublicAndPrivateOutbox(events: List<Event>) {
|
||||||
events.forEach {
|
events.forEach {
|
||||||
client.send(it, outboxRelays.flow.value)
|
client.publish(it, outboxRelays.flow.value)
|
||||||
cache.justConsumeMyOwnEvent(it)
|
cache.justConsumeMyOwnEvent(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1071,7 +1071,7 @@ class Account(
|
|||||||
|
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
|
|
||||||
client.send(signedEvent, computeRelayListToBroadcast(signedEvent))
|
client.publish(signedEvent, computeRelayListToBroadcast(signedEvent))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1107,10 +1107,10 @@ class Account(
|
|||||||
|
|
||||||
val relayList = computeRelayListToBroadcast(signedEvent)
|
val relayList = computeRelayListToBroadcast(signedEvent)
|
||||||
|
|
||||||
client.send(data, relayList = relayList)
|
client.publish(data, relayList = relayList)
|
||||||
cache.justConsumeMyOwnEvent(data)
|
cache.justConsumeMyOwnEvent(data)
|
||||||
|
|
||||||
client.send(signedEvent, relayList = relayList)
|
client.publish(signedEvent, relayList = relayList)
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
|
|
||||||
return cache.getNoteIfExists(signedEvent.id)
|
return cache.getNoteIfExists(signedEvent.id)
|
||||||
@@ -1131,8 +1131,8 @@ class Account(
|
|||||||
signedEvent: FileStorageHeaderEvent,
|
signedEvent: FileStorageHeaderEvent,
|
||||||
relayList: Set<NormalizedRelayUrl>,
|
relayList: Set<NormalizedRelayUrl>,
|
||||||
) {
|
) {
|
||||||
client.send(data, relayList = relayList)
|
client.publish(data, relayList = relayList)
|
||||||
client.send(signedEvent, relayList = relayList)
|
client.publish(signedEvent, relayList = relayList)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendHeader(
|
fun sendHeader(
|
||||||
@@ -1140,7 +1140,7 @@ class Account(
|
|||||||
relayList: Set<NormalizedRelayUrl>,
|
relayList: Set<NormalizedRelayUrl>,
|
||||||
onReady: (Note) -> Unit,
|
onReady: (Note) -> Unit,
|
||||||
) {
|
) {
|
||||||
client.send(signedEvent, relayList = relayList)
|
client.publish(signedEvent, relayList = relayList)
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
|
|
||||||
cache.getNoteIfExists(signedEvent.id)?.let { onReady(it) }
|
cache.getNoteIfExists(signedEvent.id)?.let { onReady(it) }
|
||||||
@@ -1322,7 +1322,7 @@ class Account(
|
|||||||
|
|
||||||
client.publish(event, relayList)
|
client.publish(event, relayList)
|
||||||
|
|
||||||
broadcast.forEach { client.send(it, relayList) }
|
broadcast.forEach { client.publish(it, relayList) }
|
||||||
|
|
||||||
return event
|
return event
|
||||||
}
|
}
|
||||||
@@ -1346,7 +1346,7 @@ class Account(
|
|||||||
|
|
||||||
client.publish(event, relayList)
|
client.publish(event, relayList)
|
||||||
|
|
||||||
broadcast.forEach { client.send(it, relayList) }
|
broadcast.forEach { client.publish(it, relayList) }
|
||||||
|
|
||||||
return event
|
return event
|
||||||
}
|
}
|
||||||
@@ -1378,7 +1378,7 @@ class Account(
|
|||||||
extraNotesToBroadcast: List<Event>,
|
extraNotesToBroadcast: List<Event>,
|
||||||
) {
|
) {
|
||||||
cache.justConsumeMyOwnEvent(event)
|
cache.justConsumeMyOwnEvent(event)
|
||||||
extraNotesToBroadcast.forEach { client.send(it, relays) }
|
extraNotesToBroadcast.forEach { client.publish(it, relays) }
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun createAndSendDraftIgnoreErrors(
|
suspend fun createAndSendDraftIgnoreErrors(
|
||||||
@@ -1410,9 +1410,9 @@ class Account(
|
|||||||
|
|
||||||
val relayList = (privateStorageRelayList.flow.value + localRelayList.flow.value + extraRelays).toSet()
|
val relayList = (privateStorageRelayList.flow.value + localRelayList.flow.value + extraRelays).toSet()
|
||||||
if (relayList.isNotEmpty()) {
|
if (relayList.isNotEmpty()) {
|
||||||
client.send(draftEvent, relayList)
|
client.publish(draftEvent, relayList)
|
||||||
broadcast.forEach {
|
broadcast.forEach {
|
||||||
client.send(it, relayList.toSet())
|
client.publish(it, relayList.toSet())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1439,8 +1439,8 @@ class Account(
|
|||||||
cache.justConsumeMyOwnEvent(deletionEvent)
|
cache.justConsumeMyOwnEvent(deletionEvent)
|
||||||
|
|
||||||
if (relayList.isNotEmpty()) {
|
if (relayList.isNotEmpty()) {
|
||||||
client.send(deletedDraft, relayList)
|
client.publish(deletedDraft, relayList)
|
||||||
client.send(deletionEvent, relayList)
|
client.publish(deletionEvent, relayList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1552,9 +1552,9 @@ class Account(
|
|||||||
} else {
|
} else {
|
||||||
val it = signer.sign(template)
|
val it = signer.sign(template)
|
||||||
cache.justConsumeMyOwnEvent(it)
|
cache.justConsumeMyOwnEvent(it)
|
||||||
client.send(it, relayList = relayList)
|
client.publish(it, relayList = relayList)
|
||||||
|
|
||||||
mapEntitiesToNotes(quotes).forEach { it.event?.let { client.send(it, relayList = relayList) } }
|
mapEntitiesToNotes(quotes).forEach { it.event?.let { client.publish(it, relayList = relayList) } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1597,9 +1597,9 @@ class Account(
|
|||||||
} else {
|
} else {
|
||||||
val it = signer.sign(template)
|
val it = signer.sign(template)
|
||||||
cache.justConsumeMyOwnEvent(it)
|
cache.justConsumeMyOwnEvent(it)
|
||||||
client.send(it, relayList = relayList)
|
client.publish(it, relayList = relayList)
|
||||||
|
|
||||||
broadcastNotes.forEach { it.event?.let { client.send(it, relayList = relayList) } }
|
broadcastNotes.forEach { it.event?.let { client.publish(it, relayList = relayList) } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1624,8 +1624,8 @@ class Account(
|
|||||||
val newEvent = signer.sign(template)
|
val newEvent = signer.sign(template)
|
||||||
cache.justConsumeMyOwnEvent(newEvent)
|
cache.justConsumeMyOwnEvent(newEvent)
|
||||||
|
|
||||||
client.send(newEvent, relayList = relays)
|
client.publish(newEvent, relayList = relays)
|
||||||
client.send(bountyEvent, relayList = relays)
|
client.publish(bountyEvent, relayList = relays)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun sendEdit(
|
suspend fun sendEdit(
|
||||||
@@ -1654,7 +1654,7 @@ class Account(
|
|||||||
|
|
||||||
client.publish(event, relayList = relayList)
|
client.publish(event, relayList = relayList)
|
||||||
|
|
||||||
broadcast.forEach { client.send(it, relayList) }
|
broadcast.forEach { client.publish(it, relayList) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate<PrivateDmEvent>) {
|
override suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate<PrivateDmEvent>) {
|
||||||
@@ -1665,7 +1665,7 @@ class Account(
|
|||||||
val destinationRelays = recipient?.let { cache.getOrCreateUser(it).dmInboxRelays() } ?: emptyList()
|
val destinationRelays = recipient?.let { cache.getOrCreateUser(it).dmInboxRelays() } ?: emptyList()
|
||||||
|
|
||||||
cache.justConsumeMyOwnEvent(newEvent)
|
cache.justConsumeMyOwnEvent(newEvent)
|
||||||
client.send(newEvent, outboxRelays.flow.value + destinationRelays)
|
client.publish(newEvent, outboxRelays.flow.value + destinationRelays)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun sendNip17EncryptedFile(template: EventTemplate<ChatMessageEncryptedFileHeaderEvent>) {
|
override suspend fun sendNip17EncryptedFile(template: EventTemplate<ChatMessageEncryptedFileHeaderEvent>) {
|
||||||
@@ -1683,7 +1683,7 @@ class Account(
|
|||||||
override suspend fun sendGiftWraps(wraps: List<GiftWrapEvent>) {
|
override suspend fun sendGiftWraps(wraps: List<GiftWrapEvent>) {
|
||||||
wraps.forEach { wrap ->
|
wraps.forEach { wrap ->
|
||||||
val relayList = computeRelayListToBroadcast(wrap)
|
val relayList = computeRelayListToBroadcast(wrap)
|
||||||
client.send(wrap, relayList)
|
client.publish(wrap, relayList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,7 +1704,7 @@ class Account(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val relayList = computeRelayListToBroadcast(wrap)
|
val relayList = computeRelayListToBroadcast(wrap)
|
||||||
client.send(wrap, relayList)
|
client.publish(wrap, relayList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1892,7 +1892,7 @@ class Account(
|
|||||||
cache.justConsumeMyOwnEvent(request)
|
cache.justConsumeMyOwnEvent(request)
|
||||||
onReady(request)
|
onReady(request)
|
||||||
delay(100)
|
delay(100)
|
||||||
client.send(request, relayList)
|
client.publish(request, relayList)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cachedDecryptContent(note: Note): String? = cachedDecryptContent(note.event)
|
fun cachedDecryptContent(note: Note): String? = cachedDecryptContent(note.event)
|
||||||
@@ -2060,7 +2060,7 @@ class Account(
|
|||||||
val template = RequestToVanishEvent.build(relays, reason, createdAt)
|
val template = RequestToVanishEvent.build(relays, reason, createdAt)
|
||||||
val signedEvent = signer.sign(template)
|
val signedEvent = signer.sign(template)
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
client.send(signedEvent, outboxRelays.flow.value + relays.toSet())
|
client.publish(signedEvent, outboxRelays.flow.value + relays.toSet())
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun requestToVanishFromEverywhere(
|
suspend fun requestToVanishFromEverywhere(
|
||||||
@@ -2072,7 +2072,7 @@ class Account(
|
|||||||
val template = RequestToVanishEvent.buildVanishFromEverywhere(reason, createdAt)
|
val template = RequestToVanishEvent.buildVanishFromEverywhere(reason, createdAt)
|
||||||
val signedEvent = signer.sign(template)
|
val signedEvent = signer.sign(template)
|
||||||
cache.justConsumeMyOwnEvent(signedEvent)
|
cache.justConsumeMyOwnEvent(signedEvent)
|
||||||
client.send(signedEvent, followPlusAllMineWithIndex.flow.value + client.availableRelaysFlow().value)
|
client.publish(signedEvent, followPlusAllMineWithIndex.flow.value + client.availableRelaysFlow().value)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun sendNip65RelayList(relays: List<AdvertisedRelayInfo>) = sendLiterallyEverywhere(nip65RelayList.saveRelayList(relays))
|
suspend fun sendNip65RelayList(relays: List<AdvertisedRelayInfo>) = sendLiterallyEverywhere(nip65RelayList.saveRelayList(relays))
|
||||||
|
|||||||
+7
-7
@@ -289,13 +289,13 @@ class AccountSessionManager(
|
|||||||
|
|
||||||
val client = clientBuilder()
|
val client = clientBuilder()
|
||||||
|
|
||||||
accountSettings.backupUserMetadata?.let { client.send(it, toPost) }
|
accountSettings.backupUserMetadata?.let { client.publish(it, toPost) }
|
||||||
accountSettings.backupContactList?.let { client.send(it, toPost) }
|
accountSettings.backupContactList?.let { client.publish(it, toPost) }
|
||||||
accountSettings.backupNIP65RelayList?.let { client.send(it, toPost) }
|
accountSettings.backupNIP65RelayList?.let { client.publish(it, toPost) }
|
||||||
accountSettings.backupDMRelayList?.let { client.send(it, toPost) }
|
accountSettings.backupDMRelayList?.let { client.publish(it, toPost) }
|
||||||
accountSettings.backupSearchRelayList?.let { client.send(it, toPost) }
|
accountSettings.backupSearchRelayList?.let { client.publish(it, toPost) }
|
||||||
accountSettings.backupIndexRelayList?.let { client.send(it, toPost) }
|
accountSettings.backupIndexRelayList?.let { client.publish(it, toPost) }
|
||||||
accountSettings.backupRelayFeedsList?.let { client.send(it, toPost) }
|
accountSettings.backupRelayFeedsList?.let { client.publish(it, toPost) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -98,6 +98,7 @@ import com.vitorpamplona.quartz.nip01Core.core.toHexKey
|
|||||||
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
||||||
import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle
|
import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.EmptyNostrClient
|
import com.vitorpamplona.quartz.nip01Core.relay.client.EmptyNostrClient
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayOfflineTracker
|
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.RelayOfflineTracker
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.auth.EmptyIAuthStatus
|
import com.vitorpamplona.quartz.nip01Core.relay.client.auth.EmptyIAuthStatus
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.auth.RelayAuthenticator
|
import com.vitorpamplona.quartz.nip01Core.relay.client.auth.RelayAuthenticator
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ fun main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Window(
|
Window(
|
||||||
onSubscriptionCloseduest = ::exitApplication,
|
onCloseRequest = ::exitApplication,
|
||||||
state = windowState,
|
state = windowState,
|
||||||
title = "Amethyst",
|
title = "Amethyst",
|
||||||
) {
|
) {
|
||||||
|
|||||||
+4
-2
@@ -30,6 +30,8 @@ import com.vitorpamplona.amethyst.desktop.network.DesktopHttpClient
|
|||||||
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
|
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
|
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
|
||||||
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.listeners.RelayConnectionListener
|
import com.vitorpamplona.quartz.nip01Core.relay.client.listeners.RelayConnectionListener
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.single.IRelayClient
|
import com.vitorpamplona.quartz.nip01Core.relay.client.single.IRelayClient
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.Message
|
import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.Message
|
||||||
@@ -302,7 +304,7 @@ class AccountManager internal constructor(
|
|||||||
|
|
||||||
suspend fun loginWithBunker(bunkerUri: String): Result<AccountState.LoggedIn> {
|
suspend fun loginWithBunker(bunkerUri: String): Result<AccountState.LoggedIn> {
|
||||||
val listener = createLoginRelayListener()
|
val listener = createLoginRelayListener()
|
||||||
var client: NostrClient? = null
|
var client: INostrClient? = null
|
||||||
try {
|
try {
|
||||||
val ephemeralKeyPair = KeyPair()
|
val ephemeralKeyPair = KeyPair()
|
||||||
val ephemeralSigner = NostrSignerInternal(ephemeralKeyPair)
|
val ephemeralSigner = NostrSignerInternal(ephemeralKeyPair)
|
||||||
@@ -363,7 +365,7 @@ class AccountManager internal constructor(
|
|||||||
|
|
||||||
suspend fun loginWithNostrConnect(onUriGenerated: (String) -> Unit): Result<AccountState.LoggedIn> {
|
suspend fun loginWithNostrConnect(onUriGenerated: (String) -> Unit): Result<AccountState.LoggedIn> {
|
||||||
val listener = createLoginRelayListener()
|
val listener = createLoginRelayListener()
|
||||||
var client: NostrClient? = null
|
var client: INostrClient? = null
|
||||||
try {
|
try {
|
||||||
val ephemeralKeyPair = KeyPair()
|
val ephemeralKeyPair = KeyPair()
|
||||||
val uriData = NostrConnectLoginUseCase.generateUri(ephemeralKeyPair, NIP46_RELAYS, "Amethyst%20Desktop")
|
val uriData = NostrConnectLoginUseCase.generateUri(ephemeralKeyPair, NIP46_RELAYS, "Amethyst%20Desktop")
|
||||||
|
|||||||
+1
@@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.desktop.network
|
|||||||
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient
|
import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.listeners.RelayConnectionListener
|
import com.vitorpamplona.quartz.nip01Core.relay.client.listeners.RelayConnectionListener
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.SubscriptionListener
|
import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.SubscriptionListener
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.single.IRelayClient
|
import com.vitorpamplona.quartz.nip01Core.relay.client.single.IRelayClient
|
||||||
|
|||||||
Vendored
+2
-2
@@ -103,11 +103,11 @@ class CoordinatorPipelineTest {
|
|||||||
filters: Map<NormalizedRelayUrl, List<Filter>>,
|
filters: Map<NormalizedRelayUrl, List<Filter>>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
override fun close(subId: String) {
|
override fun unsubscribe(subId: String) {
|
||||||
openedSubs.remove(subId)
|
openedSubs.remove(subId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun send(
|
override fun publish(
|
||||||
event: Event,
|
event: Event,
|
||||||
relayList: Set<NormalizedRelayUrl>,
|
relayList: Set<NormalizedRelayUrl>,
|
||||||
) {}
|
) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user