Revert "Clear repository when enter a screen"

This reverts commit 9354dd0b44.
This commit is contained in:
Sylwester Zielinski
2023-04-26 12:44:28 +02:00
parent 9354dd0b44
commit c5b808cd4f
16 changed files with 26 additions and 60 deletions

View File

@@ -124,11 +124,8 @@ class UARTRepository @Inject internal constructor(
configurationDataSource.saveConfigurationName(name)
}
fun stop() {
fun release() {
_data.value = UARTServiceData()
_stopEvent.tryEmit(DisconnectAndStopEvent())
}
fun clear() {
_data.value = UARTServiceData()
}
}

View File

@@ -91,8 +91,6 @@ internal class UARTViewModel @Inject constructor(
val state = _state.asStateFlow()
init {
repository.clear()
viewModelScope.launch {
if (repository.isRunning.firstOrNull() == false) {
requestBluetoothDevice()
@@ -235,7 +233,7 @@ internal class UARTViewModel @Inject constructor(
}
private fun disconnect() {
repository.stop()
repository.release()
navigationManager.navigateUp()
}
}