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

@@ -98,12 +98,9 @@ class HTSRepository @Inject constructor(
_loggerEvent.tryEmit(OpenLoggerEvent())
}
fun stop() {
fun release() {
logger = null
_data.value = HTSServiceData()
_stopEvent.tryEmit(DisconnectAndStopEvent())
}
fun clear() {
_data.value = HTSServiceData()
}
}

View File

@@ -66,8 +66,6 @@ internal class HTSViewModel @Inject constructor(
val state = repository.data
init {
repository.clear()
viewModelScope.launch {
if (repository.isRunning.firstOrNull() == false) {
requestBluetoothDevice()
@@ -110,7 +108,7 @@ internal class HTSViewModel @Inject constructor(
}
private fun disconnect() {
repository.stop()
repository.release()
navigationManager.navigateUp()
}