From 80d7a5ed0840c4dc3f03b80ed079abe1fae8e251 Mon Sep 17 00:00:00 2001 From: Jonathan Koren Date: Thu, 15 Feb 2024 14:24:46 -0800 Subject: [PATCH] spotless fixes Change-Id: I5ca91db033a658450144439e90ea4b880f57b7fd --- .../nowinandroid/feature/interests/InterestsViewModel.kt | 6 +++--- .../feature/interests/navigation/InterestsNavigation.kt | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt b/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt index ad96732dd..587ad5603 100644 --- a/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt +++ b/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt @@ -23,7 +23,7 @@ import com.google.samples.apps.nowinandroid.core.data.repository.UserDataReposit import com.google.samples.apps.nowinandroid.core.domain.GetFollowableTopicsUseCase import com.google.samples.apps.nowinandroid.core.domain.TopicSortField import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic -import com.google.samples.apps.nowinandroid.feature.interests.navigation.topicIdArg +import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARG import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow @@ -40,7 +40,7 @@ class InterestsViewModel @Inject constructor( ) : ViewModel() { val uiState: StateFlow = combine( - savedStateHandle.getStateFlow(topicIdArg, null), + savedStateHandle.getStateFlow(TOPIC_ID_ARG, null), getFollowableTopics(sortBy = TopicSortField.NAME), InterestsUiState::Interests, ).stateIn( @@ -57,7 +57,7 @@ class InterestsViewModel @Inject constructor( fun onTopicClick(topicId: String) { viewModelScope.launch { - savedStateHandle[topicIdArg] = topicId + savedStateHandle[TOPIC_ID_ARG] = topicId } } } diff --git a/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/navigation/InterestsNavigation.kt b/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/navigation/InterestsNavigation.kt index 56f8e6602..66125889f 100644 --- a/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/navigation/InterestsNavigation.kt +++ b/feature/interests/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/navigation/InterestsNavigation.kt @@ -25,8 +25,7 @@ import androidx.navigation.navArgument import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute -internal const val topicIdArg = "topicId" -//const val interestsRoute = "interests_route?$topicIdArg={$topicIdArg}" +internal const val TOPIC_ID_ARG = "topicId" const val INTERESTS_ROUTE = "interests_route" fun NavController.navigateToInterestsGraph( @@ -36,7 +35,7 @@ fun NavController.navigateToInterestsGraph( if (topicId == null) { navigate(INTERESTS_ROUTE, navOptions) } else { - navigate("$INTERESTS_ROUTE?$topicIdArg=$topicId", navOptions) + navigate("$INTERESTS_ROUTE?$TOPIC_ID_ARG=$topicId", navOptions) } } @@ -46,7 +45,7 @@ fun NavGraphBuilder.interestsGraph( composable( route = INTERESTS_ROUTE, arguments = listOf( - navArgument(topicIdArg) { + navArgument(TOPIC_ID_ARG) { defaultValue = null nullable = true },