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:
Claude
2026-05-11 10:34:32 +00:00
parent 38445c0018
commit da8351b7d5
4 changed files with 5 additions and 48 deletions
@@ -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) {