diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt b/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt index 9bed5066..f4bc1f81 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/Amber.kt @@ -67,7 +67,7 @@ class Amber : Application() { val factory = OkHttpWebSocket.BuilderFactory { _, useProxy -> HttpClientManager.getHttpClient(useProxy) } - var client: NostrClient = NostrClient(factory) + val client: NostrClient = NostrClient(factory) var profileClient = ConcurrentHashMap() val profileDataSource = ConcurrentHashMap() val applicationIOScope = CoroutineScope(Dispatchers.IO + SupervisorJob()) @@ -255,10 +255,7 @@ class Amber : Application() { val hasNewRelays = allClientRelays.any { it.url !in savedUrls } if (savedRelays.isEmpty()) { - client.getAll().forEach { - it.disconnect() - } - client = NostrClient(factory) + client.reconnect(relays = null) NotificationDataSource.stop() AmberRelayStats.updateNotification() return