spotless fixes

Change-Id: I5ca91db033a658450144439e90ea4b880f57b7fd
feature/list-detail-pane-scaffold
Jonathan Koren 11 months ago
parent 05bdcd217e
commit 80d7a5ed08

@ -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.GetFollowableTopicsUseCase
import com.google.samples.apps.nowinandroid.core.domain.TopicSortField 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.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 dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
@ -40,7 +40,7 @@ class InterestsViewModel @Inject constructor(
) : ViewModel() { ) : ViewModel() {
val uiState: StateFlow<InterestsUiState> = combine( val uiState: StateFlow<InterestsUiState> = combine(
savedStateHandle.getStateFlow<String?>(topicIdArg, null), savedStateHandle.getStateFlow<String?>(TOPIC_ID_ARG, null),
getFollowableTopics(sortBy = TopicSortField.NAME), getFollowableTopics(sortBy = TopicSortField.NAME),
InterestsUiState::Interests, InterestsUiState::Interests,
).stateIn( ).stateIn(
@ -57,7 +57,7 @@ class InterestsViewModel @Inject constructor(
fun onTopicClick(topicId: String) { fun onTopicClick(topicId: String) {
viewModelScope.launch { viewModelScope.launch {
savedStateHandle[topicIdArg] = topicId savedStateHandle[TOPIC_ID_ARG] = topicId
} }
} }
} }

@ -25,8 +25,7 @@ import androidx.navigation.navArgument
import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute
internal const val topicIdArg = "topicId" internal const val TOPIC_ID_ARG = "topicId"
//const val interestsRoute = "interests_route?$topicIdArg={$topicIdArg}"
const val INTERESTS_ROUTE = "interests_route" const val INTERESTS_ROUTE = "interests_route"
fun NavController.navigateToInterestsGraph( fun NavController.navigateToInterestsGraph(
@ -36,7 +35,7 @@ fun NavController.navigateToInterestsGraph(
if (topicId == null) { if (topicId == null) {
navigate(INTERESTS_ROUTE, navOptions) navigate(INTERESTS_ROUTE, navOptions)
} else { } else {
navigate("$INTERESTS_ROUTE?$topicIdArg=$topicId", navOptions) navigate("$INTERESTS_ROUTE?$TOPIC_ID_ARG=$topicId", navOptions)
} }
} }
@ -46,7 +45,7 @@ fun NavGraphBuilder.interestsGraph(
composable( composable(
route = INTERESTS_ROUTE, route = INTERESTS_ROUTE,
arguments = listOf( arguments = listOf(
navArgument(topicIdArg) { navArgument(TOPIC_ID_ARG) {
defaultValue = null defaultValue = null
nullable = true nullable = true
}, },

Loading…
Cancel
Save