refactor: move error message handling to ServiceRepository

This commit is contained in:
andrekir 2024-04-07 16:35:04 -03:00
parent cf239e3634
commit 76151e153f
6 changed files with 29 additions and 18 deletions

View file

@ -194,7 +194,7 @@ class BTScanModel @Inject constructor(
addDevice(entry)
}
}.catch { ex ->
radioInterfaceService.setErrorMessage("Unexpected Bluetooth scan failure: ${ex.message}")
serviceRepository.setErrorMessage("Unexpected Bluetooth scan failure: ${ex.message}")
}.launchIn(viewModelScope)
}

View file

@ -159,9 +159,9 @@ class UIViewModel @Inject constructor(
val snackbarText: LiveData<Any?> get() = _snackbarText
init {
radioInterfaceService.errorMessage.filterNotNull().onEach {
radioConfigRepository.errorMessage.filterNotNull().onEach {
_snackbarText.value = it
radioInterfaceService.clearErrorMessage()
radioConfigRepository.clearErrorMessage()
}.launchIn(viewModelScope)
viewModelScope.launch {