mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
Drop unused dispose()/clearForAccount helpers
NotificationSubscription/ProfileSubscription/ZapstoreUpdater.dispose() and LocalKeyAccountIndex.clearForAccount() had no callers — these singletons are constructed exactly once per process and their state is rebuilt by NotificationSubscription.updateFilter, so the cleanup paths are dead code. https://claude.ai/code/session_01GiLqaAahYySDdmBa4VksWR
This commit is contained in:
@@ -19,8 +19,4 @@ object LocalKeyAccountIndex {
|
||||
byLocalPubKey.keys.retainAll(entries.keys)
|
||||
byLocalPubKey.putAll(entries)
|
||||
}
|
||||
|
||||
fun clearForAccount(npub: String) {
|
||||
byLocalPubKey.entries.removeAll { it.value.npub == npub }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,23 +44,9 @@ class NotificationSubscription(
|
||||
private val eventNotificationConsumer = EventNotificationConsumer(appContext)
|
||||
private val subIds = mutableMapOf<String, String>()
|
||||
|
||||
@Volatile
|
||||
private var registered = false
|
||||
|
||||
init {
|
||||
// listens until the app crashes — guard so re-init in tests
|
||||
// doesn't double-register the listener.
|
||||
if (!registered) {
|
||||
client.addConnectionListener(this)
|
||||
registered = true
|
||||
}
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
if (registered) {
|
||||
client.removeConnectionListener(this)
|
||||
registered = false
|
||||
}
|
||||
// listens until the app crashes.
|
||||
client.addConnectionListener(this)
|
||||
}
|
||||
|
||||
override fun onIncomingMessage(relay: IRelayClient, msgStr: String, msg: Message) {
|
||||
|
||||
@@ -54,21 +54,9 @@ class ProfileSubscription(
|
||||
private val relaysPerSubId = mutableMapOf<String, MutableSet<NormalizedRelayUrl>>()
|
||||
private val timeoutJobs = mutableMapOf<String, Job>()
|
||||
|
||||
@Volatile
|
||||
private var registered = false
|
||||
|
||||
init {
|
||||
if (!registered) {
|
||||
client.addConnectionListener(this)
|
||||
registered = true
|
||||
}
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
if (registered) {
|
||||
client.removeConnectionListener(this)
|
||||
registered = false
|
||||
}
|
||||
// listens until the app crashes.
|
||||
client.addConnectionListener(this)
|
||||
}
|
||||
|
||||
override fun onIncomingMessage(relay: IRelayClient, msgStr: String, msg: Message) {
|
||||
|
||||
@@ -66,21 +66,8 @@ class ZapstoreUpdater(
|
||||
UPDATE_RELAY_URLS.mapNotNull { RelayUrlNormalizer.normalizeOrNull(it) }
|
||||
private var timeoutJob: Job? = null
|
||||
|
||||
@Volatile
|
||||
private var registered = false
|
||||
|
||||
init {
|
||||
if (!registered) {
|
||||
client.addConnectionListener(this)
|
||||
registered = true
|
||||
}
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
if (registered) {
|
||||
client.removeConnectionListener(this)
|
||||
registered = false
|
||||
}
|
||||
client.addConnectionListener(this)
|
||||
}
|
||||
|
||||
override fun onIncomingMessage(relay: IRelayClient, msgStr: String, msg: Message) {
|
||||
|
||||
Reference in New Issue
Block a user