File tree Expand file tree Collapse file tree 7 files changed +12
-10
lines changed
androidMain/kotlin/org/michaelbel/movies/details
iosMain/kotlin/org/michaelbel/movies/details
jvmMain/kotlin/org/michaelbel/movies/details
feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed
gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery
main-impl/src/androidMain/kotlin/org/michaelbel/movies/main
search-impl/src/androidMain/kotlin/org/michaelbel/movies/search Expand file tree Collapse file tree 7 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class DetailsViewModel(
29
29
private val movieId: MovieId = savedStateHandle.require(" movieId" )
30
30
31
31
private val _detailsState = MutableStateFlow <ScreenState >(ScreenState .Loading )
32
- val detailsState = _detailsState .asStateFlow()
32
+ val detailsState: StateFlow < ScreenState > get() = _detailsState .asStateFlow()
33
33
34
34
val networkStatus: StateFlow <NetworkStatus > = networkManager.status
35
35
.stateIn(
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.michaelbel.movies.details
3
3
import androidx.lifecycle.SavedStateHandle
4
4
import androidx.lifecycle.viewModelScope
5
5
import kotlinx.coroutines.flow.MutableStateFlow
6
+ import kotlinx.coroutines.flow.StateFlow
6
7
import kotlinx.coroutines.flow.asStateFlow
7
8
import kotlinx.coroutines.launch
8
9
import org.michaelbel.movies.common.viewmodel.BaseViewModel
@@ -20,7 +21,7 @@ class DetailsViewModel(
20
21
private val movieId: MovieId = savedStateHandle[" movieId" ] ? : 0
21
22
22
23
private val _detailsState = MutableStateFlow <ScreenState >(ScreenState .Loading )
23
- val detailsState = _detailsState .asStateFlow()
24
+ val detailsState: StateFlow < ScreenState > get() = _detailsState .asStateFlow()
24
25
25
26
init {
26
27
println (" movieList=$movieList , movieId=$movieId " )
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.michaelbel.movies.details
3
3
import androidx.lifecycle.SavedStateHandle
4
4
import androidx.lifecycle.viewModelScope
5
5
import kotlinx.coroutines.flow.MutableStateFlow
6
+ import kotlinx.coroutines.flow.StateFlow
6
7
import kotlinx.coroutines.flow.asStateFlow
7
8
import kotlinx.coroutines.launch
8
9
import org.michaelbel.movies.common.ktx.require
@@ -21,7 +22,7 @@ class DetailsViewModel(
21
22
private val movieId: MovieId = savedStateHandle.require(" movieId" )
22
23
23
24
private val _detailsState = MutableStateFlow <ScreenState >(ScreenState .Loading )
24
- val detailsState = _detailsState .asStateFlow()
25
+ val detailsState: StateFlow < ScreenState > get() = _detailsState .asStateFlow()
25
26
26
27
init {
27
28
println (" movieList=$movieList , movieId=$movieId " )
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ class FeedViewModel(
76
76
.cachedIn(this )
77
77
78
78
private var _notificationsPermissionRequired : MutableStateFlow <Boolean > = MutableStateFlow (false )
79
- val notificationsPermissionRequired: StateFlow <Boolean > = _notificationsPermissionRequired .asStateFlow()
79
+ val notificationsPermissionRequired: StateFlow <Boolean > get() = _notificationsPermissionRequired .asStateFlow()
80
80
81
81
var isAuthFailureSnackbarShowed: Boolean by mutableStateOf(false )
82
82
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class GalleryViewModel(
40
40
)
41
41
42
42
private val _workInfoFlow : MutableStateFlow <WorkInfo ?> = MutableStateFlow (null )
43
- val workInfoFlow: StateFlow <WorkInfo ?> = _workInfoFlow .asStateFlow()
43
+ val workInfoFlow: StateFlow <WorkInfo ?> get() = _workInfoFlow .asStateFlow()
44
44
45
45
init {
46
46
loadMovieImages(movieId.toInt())
Original file line number Diff line number Diff line change @@ -39,13 +39,13 @@ class MainViewModel(
39
39
): BaseViewModel() {
40
40
41
41
private val _authenticateFlow = Channel <Unit >(Channel .BUFFERED )
42
- val authenticateFlow: Flow <Unit > = _authenticateFlow .receiveAsFlow()
42
+ val authenticateFlow: Flow <Unit > get() = _authenticateFlow .receiveAsFlow()
43
43
44
44
private val _cancelFlow = Channel <Unit >(Channel .BUFFERED )
45
- val cancelFlow: Flow <Unit > = _cancelFlow .receiveAsFlow()
45
+ val cancelFlow: Flow <Unit > get() = _cancelFlow .receiveAsFlow()
46
46
47
47
private val _splashLoading = MutableStateFlow (true )
48
- val splashLoading: StateFlow <Boolean > = _splashLoading .asStateFlow()
48
+ val splashLoading: StateFlow <Boolean > get() = _splashLoading .asStateFlow()
49
49
50
50
val themeData: StateFlow <ThemeData > = interactor.themeData
51
51
.stateIn(
Original file line number Diff line number Diff line change @@ -61,12 +61,12 @@ class SearchViewModel(
61
61
)
62
62
63
63
private val _query : MutableStateFlow <String > = MutableStateFlow (" " )
64
- private val query: StateFlow <String > = _query .asStateFlow()
64
+ private val query: StateFlow <String > get() = _query .asStateFlow()
65
65
66
66
val isSearchActive: StateFlow <Boolean > = interactor.isSearchActive
67
67
68
68
val pagingDataFlow: Flow <PagingData <MoviePojo >> = query
69
- .flatMapLatest { query -> movieBlockingInteractor. moviesPagingData(query) }
69
+ .flatMapLatest( movieBlockingInteractor:: moviesPagingData)
70
70
.cachedIn(this )
71
71
72
72
init {
You can’t perform that action at this time.
0 commit comments