fix: clear data when changing devices (#1985)

This commit is contained in:
James Rich 2025-05-30 13:17:09 -05:00 committed by GitHub
parent ead0c43381
commit 25ecdc912e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 102 additions and 22 deletions

View file

@ -81,7 +81,7 @@ class BTScanModel @Inject constructor(
}
// Include a placeholder for "None"
addDevice(DeviceListEntry(context.getString(R.string.none), "n", true))
addDevice(DeviceListEntry(context.getString(R.string.none), NO_DEVICE_SELECTED, true))
if (showMockInterface) {
addDevice(DeviceListEntry("Demo Mode", "m", true))
@ -158,7 +158,7 @@ class BTScanModel @Inject constructor(
val selectedBluetooth: Boolean get() = selectedAddress?.getOrNull(0) == 'x'
// / Use the string for the NopInterface
val selectedNotNull: String get() = selectedAddress ?: "n"
val selectedNotNull: String get() = selectedAddress ?: NO_DEVICE_SELECTED
val scanResult = MutableLiveData<MutableMap<String, DeviceListEntry>>(mutableMapOf())
@ -280,3 +280,5 @@ class BTScanModel @Inject constructor(
private val _spinner = MutableLiveData(false)
val spinner: LiveData<Boolean> get() = _spinner
}
const val NO_DEVICE_SELECTED = "n"