From 63fd5a523b36ff4316b266b3f2f2b5e96798c947 Mon Sep 17 00:00:00 2001 From: madroid Date: Fri, 5 Aug 2022 17:41:58 +0800 Subject: [PATCH] Rename followedInterestsState to followedInterestsUiState --- ...InterestsState.kt => FollowedInterestsUiState.kt} | 8 ++++---- .../nowinandroid/feature/foryou/ForYouViewModel.kt | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) rename feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/{FollowedInterestsState.kt => FollowedInterestsUiState.kt} (86%) diff --git a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/FollowedInterestsState.kt b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/FollowedInterestsUiState.kt similarity index 86% rename from feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/FollowedInterestsState.kt rename to feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/FollowedInterestsUiState.kt index 61088d7c6..744cebbaa 100644 --- a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/FollowedInterestsState.kt +++ b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/FollowedInterestsUiState.kt @@ -19,17 +19,17 @@ package com.google.samples.apps.nowinandroid.feature.foryou /** * A sealed hierarchy for the user's current followed interests state. */ -sealed interface FollowedInterestsState { +sealed interface FollowedInterestsUiState { /** * The current state is unknown (hasn't loaded yet) */ - object Unknown : FollowedInterestsState + object Unknown : FollowedInterestsUiState /** * The user hasn't followed any interests yet. */ - object None : FollowedInterestsState + object None : FollowedInterestsUiState /** * The user has followed the given (non-empty) set of [topicIds] or [authorIds]. @@ -37,5 +37,5 @@ sealed interface FollowedInterestsState { data class FollowedInterests( val topicIds: Set, val authorIds: Set - ) : FollowedInterestsState + ) : FollowedInterestsUiState } diff --git a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt index 6c8dc3470..a64e6b1c4 100644 --- a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt +++ b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt @@ -33,9 +33,9 @@ import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic import com.google.samples.apps.nowinandroid.core.model.data.NewsResource import com.google.samples.apps.nowinandroid.core.model.data.SaveableNewsResource import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState -import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsState.FollowedInterests -import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsState.None -import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsState.Unknown +import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.FollowedInterests +import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.None +import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.Unknown import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject import kotlinx.coroutines.flow.Flow @@ -60,7 +60,7 @@ class ForYouViewModel @Inject constructor( savedStateHandle: SavedStateHandle ) : ViewModel() { - private val followedInterestsState: StateFlow = + private val followedInterestsUiState: StateFlow = userDataRepository.userDataStream .map { userData -> if (userData.followedAuthors.isEmpty() && userData.followedTopics.isEmpty()) { @@ -107,7 +107,7 @@ class ForYouViewModel @Inject constructor( val feedState: StateFlow = combine( - followedInterestsState, + followedInterestsUiState, snapshotFlow { inProgressTopicSelection }, snapshotFlow { inProgressAuthorSelection } ) { followedInterestsUserState, inProgressTopicSelection, inProgressAuthorSelection -> @@ -148,7 +148,7 @@ class ForYouViewModel @Inject constructor( val interestsSelectionState: StateFlow = combine( - followedInterestsState, + followedInterestsUiState, topicsRepository.getTopicsStream(), authorsRepository.getAuthorsStream(), snapshotFlow { inProgressTopicSelection },