refactor(connections)!: Use sealed class for device list entries (#2538)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-07-28 20:49:17 -05:00 committed by GitHub
parent aa6a048084
commit ceabafb545
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 506 additions and 537 deletions

View file

@ -327,6 +327,15 @@ constructor(
private val _showQuickChat = MutableStateFlow(preferences.getBoolean("show-quick-chat", false))
val showQuickChat: StateFlow<Boolean> = _showQuickChat
private val _hasShownNotPairedWarning =
MutableStateFlow(preferences.getBoolean(HAS_SHOWN_NOT_PAIRED_WARNING_PREF, false))
val hasShownNotPairedWarning: StateFlow<Boolean> = _hasShownNotPairedWarning.asStateFlow()
fun suppressNoPairedWarning() {
_hasShownNotPairedWarning.value = true
preferences.edit { putBoolean(HAS_SHOWN_NOT_PAIRED_WARNING_PREF, true) }
}
private fun toggleBooleanPreference(
state: MutableStateFlow<Boolean>,
key: String,
@ -719,6 +728,8 @@ constructor(
companion object {
fun getPreferences(context: Context): SharedPreferences =
context.getSharedPreferences("ui-prefs", Context.MODE_PRIVATE)
const val HAS_SHOWN_NOT_PAIRED_WARNING_PREF = "has_shown_not_paired_warning"
}
// Connection state to our radio device