From f78d181b0dfe779a845ca10129764a510453153f Mon Sep 17 00:00:00 2001 From: Kaung Khant Soe Date: Thu, 19 Oct 2023 16:30:11 +0700 Subject: [PATCH] [#535] Update state flow to use asStateFlow --- .../nimblehq/sample/compose/ui/screens/home/HomeViewModel.kt | 4 ++-- .../template/compose/ui/screens/home/HomeViewModel.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/home/HomeViewModel.kt b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/home/HomeViewModel.kt index 889254ecc..0ea523d99 100644 --- a/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/home/HomeViewModel.kt +++ b/sample-compose/app/src/main/java/co/nimblehq/sample/compose/ui/screens/home/HomeViewModel.kt @@ -22,10 +22,10 @@ class HomeViewModel @Inject constructor( ) : BaseViewModel() { private val _uiModels = MutableStateFlow>(emptyList()) - val uiModels: StateFlow> = _uiModels + val uiModels = _uiModels.asStateFlow() private val _isFirstTimeLaunch = MutableStateFlow(false) - val isFirstTimeLaunch: StateFlow = _isFirstTimeLaunch + val isFirstTimeLaunch = _isFirstTimeLaunch.asStateFlow() init { getModelsUseCase() diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt index 243f48553..c906eb929 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt @@ -17,7 +17,7 @@ class HomeViewModel @Inject constructor( ) : BaseViewModel() { private val _uiModels = MutableStateFlow>(emptyList()) - val uiModels: StateFlow> = _uiModels + val uiModels = _uiModels.asStateFlow() init { useCase()