fix profile not loading

This commit is contained in:
nrobi144
2026-01-05 06:46:19 +02:00
parent 64eec9844b
commit 115c622dca
5 changed files with 23 additions and 20 deletions
@@ -104,18 +104,8 @@ open class RelayConnectionManager(
* Events will be sent to relays as they become connected.
*/
fun broadcastToAll(event: Event) {
// Use all configured relays, not just currently connected ones
// The NostrClient will queue/send events as relays connect
val configuredRelays = relayStatuses.value.keys
val connectedCount = connectedRelays.value.size
println("[RelayManager] broadcastToAll: event kind=${event.kind}, ID=${event.id.take(8)}...")
println("[RelayManager] Configured relays: ${configuredRelays.size}, Connected: $connectedCount")
configuredRelays.forEach { relay ->
val isConnected = connectedRelays.value.contains(relay)
println("[RelayManager] - $relay: ${if (isConnected) "CONNECTED" else "pending"}")
}
send(event, configuredRelays)
println("[RelayManager] broadcastToAll complete")
}
private fun updateRelayStatus(
@@ -81,7 +81,7 @@ fun createContactListSubscription(
onEose: (NormalizedRelayUrl, List<Filter>?) -> Unit = { _, _ -> },
): SubscriptionConfig =
SubscriptionConfig(
subId = generateSubId("contact-list-$pubKeyHex"),
subId = generateSubId("contacts-${pubKeyHex.take(8)}"),
filters = listOf(FilterBuilders.contactList(pubKeyHex)),
relays = relays,
onEvent = onEvent,
@@ -35,7 +35,7 @@ fun createMetadataSubscription(
onEose: (NormalizedRelayUrl, List<Filter>?) -> Unit = { _, _ -> },
): SubscriptionConfig =
SubscriptionConfig(
subId = generateSubId("profile-metadata-$pubKeyHex"),
subId = generateSubId("meta-${pubKeyHex.take(8)}"),
filters = listOf(FilterBuilders.userMetadata(pubKeyHex)),
relays = relays,
onEvent = onEvent,
@@ -53,7 +53,7 @@ fun createUserPostsSubscription(
onEose: (NormalizedRelayUrl, List<Filter>?) -> Unit = { _, _ -> },
): SubscriptionConfig =
SubscriptionConfig(
subId = generateSubId("profile-posts-$pubKeyHex"),
subId = generateSubId("posts-${pubKeyHex.take(8)}"),
filters = listOf(FilterBuilders.textNotesFromAuthors(listOf(pubKeyHex), limit = limit)),
relays = relays,
onEvent = onEvent,
@@ -71,7 +71,7 @@ fun createNotificationsSubscription(
onEose: (NormalizedRelayUrl, List<Filter>?) -> Unit = { _, _ -> },
): SubscriptionConfig =
SubscriptionConfig(
subId = generateSubId("notifications-$pubKeyHex"),
subId = generateSubId("notif-${pubKeyHex.take(8)}"),
filters = listOf(FilterBuilders.notificationsForUser(pubKeyHex, limit = limit)),
relays = relays,
onEvent = onEvent,