refactor: simplify wantConfig feedback

This commit is contained in:
andrekir 2024-06-03 10:17:20 -03:00
parent 88a6bcc09d
commit 814cf41f90
6 changed files with 26 additions and 59 deletions

View file

@ -50,6 +50,7 @@ class BTScanModel @Inject constructor(
private val context: Context get() = application.applicationContext
val devices = MutableLiveData<MutableMap<String, DeviceListEntry>>(mutableMapOf())
val errorText = MutableLiveData<String?>(null)
val isMockInterfaceAddressValid: Boolean by lazy {
radioInterfaceService.isAddressValid(radioInterfaceService.mockInterfaceAddress)
@ -87,6 +88,10 @@ class BTScanModel @Inject constructor(
}
}.launchIn(viewModelScope)
serviceRepository.statusMessage
.onEach { errorText.value = it }
.launchIn(viewModelScope)
debug("BTScanModel created")
}
@ -134,8 +139,6 @@ class BTScanModel @Inject constructor(
debug("BTScanModel cleared")
}
val errorText = MutableLiveData<String?>(null)
fun setErrorText(text: String) {
errorText.value = text
}