chore: KMP audit — commonize code, centralize utilities, eliminate dead abstractions (#5133)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich 2026-04-14 21:17:50 -05:00 committed by GitHub
parent 50ade01e55
commit 72b981f73b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
132 changed files with 2186 additions and 916 deletions

View file

@ -33,6 +33,7 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import org.koin.core.annotation.Named
import org.koin.core.annotation.Single
import org.meshtastic.core.common.util.normalizeAddress
import org.meshtastic.core.di.CoroutineDispatchers
import org.meshtastic.core.prefs.cachedFlow
import org.meshtastic.core.repository.MeshPrefs
@ -95,15 +96,6 @@ class MeshPrefsImpl(
private fun storeForwardKey(address: String?): String = "store-forward-last-request-${normalizeAddress(address)}"
private fun normalizeAddress(address: String?): String {
val raw = address?.trim()?.takeIf { it.isNotEmpty() }
return when {
raw == null -> "DEFAULT"
raw.equals(NO_DEVICE_SELECTED, ignoreCase = true) -> "DEFAULT"
else -> raw.uppercase().replace(":", "")
}
}
companion object {
val KEY_DEVICE_ADDRESS_PREF = stringPreferencesKey("device_address")
}