diff --git a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/base/BaseViewModel.kt b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/base/BaseViewModel.kt index 85c95dfeb..e787f7676 100644 --- a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/base/BaseViewModel.kt +++ b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/base/BaseViewModel.kt @@ -2,7 +2,6 @@ package co.nimblehq.sample.compose.ui.base import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import co.nimblehq.sample.compose.lib.IsLoading import co.nimblehq.sample.compose.ui.AppDestination import kotlinx.coroutines.* import kotlinx.coroutines.flow.* @@ -15,13 +14,13 @@ abstract class BaseViewModel : ViewModel() { private var loadingCount: Int = 0 private val _isLoading = MutableStateFlow(false) - val isLoading: StateFlow = _isLoading + val isLoading = _isLoading.asStateFlow() protected val _error = MutableSharedFlow() - val error: SharedFlow = _error + val error = _error.asSharedFlow() protected val _navigator = MutableSharedFlow() - val navigator: SharedFlow = _navigator + val navigator = _navigator.asSharedFlow() /** * To show loading manually, should call `hideLoading` after diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseViewModel.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseViewModel.kt index fc560b4ec..b6f4f4068 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseViewModel.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/base/BaseViewModel.kt @@ -2,7 +2,6 @@ package co.nimblehq.template.compose.ui.base import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import co.nimblehq.template.compose.lib.IsLoading import co.nimblehq.template.compose.ui.AppDestination import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch @@ -15,13 +14,13 @@ abstract class BaseViewModel : ViewModel() { private var loadingCount: Int = 0 private val _isLoading = MutableStateFlow(false) - val isLoading: StateFlow = _isLoading + val isLoading = _isLoading.asStateFlow() protected val _error = MutableSharedFlow() - val error: SharedFlow = _error + val error = _error.asSharedFlow() protected val _navigator = MutableSharedFlow() - val navigator: SharedFlow = _navigator + val navigator = _navigator.asSharedFlow() /** * To show loading manually, should call `hideLoading` after