- Propagate Auth event to sendAndWaitForResponse
- Pass feed types to `sendSingle` when sending signed event
This commit is contained in:
@@ -152,6 +152,7 @@ class NostrClient(
|
|||||||
onDone: (() -> Unit)? = null,
|
onDone: (() -> Unit)? = null,
|
||||||
additionalListener: Listener? = null,
|
additionalListener: Listener? = null,
|
||||||
timeoutInSeconds: Long = 15,
|
timeoutInSeconds: Long = 15,
|
||||||
|
onAuth: ((Relay, String) -> Unit)? = null,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
checkNotInMainThread()
|
checkNotInMainThread()
|
||||||
|
|
||||||
@@ -164,6 +165,16 @@ class NostrClient(
|
|||||||
|
|
||||||
val subscription =
|
val subscription =
|
||||||
object : Listener {
|
object : Listener {
|
||||||
|
override fun onAuth(
|
||||||
|
relay: Relay,
|
||||||
|
challenge: String,
|
||||||
|
) {
|
||||||
|
onAuth?.let {
|
||||||
|
it(relay, challenge)
|
||||||
|
}
|
||||||
|
Log.d("sendAndWaitForResponse", "onAuth Auth from relay ${relay.url} count: ${latch.count} challenge: $challenge")
|
||||||
|
}
|
||||||
|
|
||||||
override fun onError(
|
override fun onError(
|
||||||
error: Error,
|
error: Error,
|
||||||
subscriptionId: String,
|
subscriptionId: String,
|
||||||
@@ -225,7 +236,7 @@ class NostrClient(
|
|||||||
} else if (relay == null) {
|
} else if (relay == null) {
|
||||||
send(signedEvent)
|
send(signedEvent)
|
||||||
} else {
|
} else {
|
||||||
sendSingle(signedEvent, RelaySetupInfoToConnect(relay, forceProxy, true, true, emptySet()), onDone ?: {})
|
sendSingle(signedEvent, RelaySetupInfoToConnect(relay, forceProxy, true, true, feedTypes ?: emptySet()), onDone ?: {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
job.join()
|
job.join()
|
||||||
|
|||||||
Reference in New Issue
Block a user