- Refactoring services to be part of the App Lifecycle,

- Migrated services to Flows that are active while their flows remain subscribed
- Improved OTS Decoupling
- Moved OTS verification procedures from the local cache to the data source
- Migrated the forceProxy options to lambdas that return an OkHttpClient
- Isolated Connectivity services, from Compose to Flow
- Isolated Tor services, from Compose to Tor (only starts if the Tor option is marked as internal)
- Isolated Memory trimming services, from Compose to Flow
- Isolated Image Caching services, from Compose to Flow
- Isolated Video Caching services
- Isolated Logging services
- Isolated NIP-95 Caching services
- Isolated Pokey receiver services
- Improved support for Tor in push notifications
- Isolated OkHttpClient services as flows
- Reduced the coupling of Context objects with singleton objects.
- Migrated UserFeedStates, StringFeedStates and ZapFeedStates to MutableStateFlow, avoiding feed updates on Main
- Forces a reconnect into relays that lost connection if any tor, connectivity or account changes
- Speeds up Base64 parser
This commit is contained in:
Vitor Pamplona
2025-04-09 18:51:17 -04:00
parent 652373bd01
commit 3833f5f822
111 changed files with 1970 additions and 1063 deletions
@@ -20,7 +20,9 @@
*/
package com.vitorpamplona.ammolite.relays
import android.system.Os.close
import android.util.Log
import androidx.core.app.PendingIntentCompat.send
import com.vitorpamplona.ammolite.service.checkNotInMainThread
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relay.RelayState
@@ -51,6 +53,11 @@ class NostrClient(
fun getRelay(url: String): Relay? = relayPool.getRelay(url)
fun reconnect() {
// Reconnects all relays that may have disconnected
relayPool.requestAndWatch()
}
@Synchronized
fun reconnect(
relays: Array<RelaySetupInfoToConnect>?,
@@ -74,6 +81,9 @@ class NostrClient(
relayPool.requestAndWatch()
this.relays = newRelays.toTypedArray()
}
} else {
// Reconnects all relays that may have disconnected
relayPool.requestAndWatch()
}
} else {
if (this.relays.isNotEmpty()) {
@@ -101,7 +101,7 @@ class Relay(
val relaySubFilter = RelaySubFilter(url, activeTypes, subs)
val inner =
SimpleClientRelay(url, socketBuilderFactory.build(forceProxy), relaySubFilter, this@Relay, RelayStats.get(url))
SimpleClientRelay(url, socketBuilderFactory.build(url, forceProxy), relaySubFilter, this@Relay, RelayStats.get(url))
val brief = RelayBriefInfoCache.get(url)