A fully functional Android app built entirely with Kotlin and Jetpack Compose
Fix spotless
Don Turner924391cd22e5
diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.ktindex 40011b6d4..3fd213fe7 100644--- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt+++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt@@ -97,7 +97,7 @@ class NiaAppState(.currentBackStackEntryAsState().value?.destinationval currentTopLevelDestination: TopLevelDestination?- @Composable get(){+ @Composable get() {with(currentDestination) {if (this?.hasRoute<ForYouDestination>() == true) return FOR_YOUif (this?.hasRoute<BookmarksDestination>() == true) return BOOKMARKSdiff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.ktindex 0b6eb653e..53071473b 100644--- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt+++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt@@ -41,17 +41,18 @@ import com.google.samples.apps.nowinandroid.feature.topic.navigation.topicScreenimport kotlinx.serialization.Serializable@Serializable object TopicPlaceholderDestination+@Serializable object DetailPaneNavHostDestinationfun NavGraphBuilder.interestsListDetailScreen() {- composable<InterestsDestination>{+ composable<InterestsDestination> {InterestsListDetailScreen()}}@Composableinternal fun InterestsListDetailScreen() {- var selectedTopicId : String? by rememberSaveable { mutableStateOf(null) }+ var selectedTopicId: String? by rememberSaveable { mutableStateOf(null) }InterestsListDetailScreen(selectedTopicId = selectedTopicId,onTopicClick = { topicId -> selectedTopicId = topicId },@@ -92,8 +93,8 @@ internal fun InterestsListDetailScreen(NavHost(navController = nestedNavController,startDestination = TopicPlaceholderDestination::class,- route = DetailPaneNavHostDestination::class- ){+ route = DetailPaneNavHostDestination::class,+ ) {topicScreen(showBackButton = !listDetailNavigator.isListPaneVisible(),onBackClick = listDetailNavigator::navigateBack,diff --git a/feature/bookmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/navigation/BookmarksNavigation.kt b/feature/bookmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/navigation/BookmarksNavigation.ktindex f717a76f1..1e044ec74 100644--- a/feature/bookmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/navigation/BookmarksNavigation.kt+++ b/feature/bookmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/navigation/BookmarksNavigation.kt@@ -36,4 +36,3 @@ fun NavGraphBuilder.bookmarksScreen(BookmarksRoute(onTopicClick, onShowSnackbar)}}-diff --git a/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt b/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.ktindex 202921c33..c61bfe907 100644--- a/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt+++ b/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt@@ -27,6 +27,7 @@ import kotlinx.serialization.Serializableconst val LINKED_NEWS_RESOURCE_ID = "linkedNewsResourceId"private const val DEEP_LINK_URI_PATTERN ="https://www.nowinandroid.apps.samples.google.com/foryou/{$LINKED_NEWS_RESOURCE_ID}"+@Serializable data class ForYouDestination(val linkedNewsResourceId: String? = null)fun NavController.navigateToForYou(navOptions: NavOptions) = navigate(route = ForYouDestination(), navOptions)@@ -35,7 +36,7 @@ fun NavGraphBuilder.forYouScreen(onTopicClick: (String) -> Unit) {composable<ForYouDestination>(deepLinks = listOf(navDeepLink { uriPattern = DEEP_LINK_URI_PATTERN },- )+ ),) {ForYouRoute(onTopicClick)}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.ktindex cd1625c17..777d85e5f 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@@ -25,7 +25,6 @@ import com.google.samples.apps.nowinandroid.core.domain.GetFollowableTopicsUseCaimport com.google.samples.apps.nowinandroid.core.domain.TopicSortFieldimport com.google.samples.apps.nowinandroid.core.model.data.FollowableTopicimport com.google.samples.apps.nowinandroid.feature.interests.navigation.InterestsDestination-import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARGimport dagger.hilt.android.lifecycle.HiltViewModelimport kotlinx.coroutines.flow.SharingStartedimport kotlinx.coroutines.flow.StateFlow@@ -41,7 +40,7 @@ class InterestsViewModel @Inject constructor(getFollowableTopics: GetFollowableTopicsUseCase,) : ViewModel() {- private val interestsDestination : InterestsDestination = savedStateHandle.toRoute()+ private val interestsDestination: InterestsDestination = savedStateHandle.toRoute()val uiState: StateFlow<InterestsUiState> =getFollowableTopics(sortBy = TopicSortField.NAME).map { topics ->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.ktindex a1c267461..487bb0d8c 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@@ -20,11 +20,10 @@ import androidx.navigation.NavControllerimport androidx.navigation.NavOptionsimport kotlinx.serialization.Serializable-const val TOPIC_ID_ARG = "topicId"@Serializable data class InterestsDestination(val topicId: String?)fun NavController.navigateToInterests(topicId: String? = null, navOptions: NavOptions? = null) {navigate(route = InterestsDestination(topicId), navOptions)-}\ No newline at end of file+}diff --git a/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.kt b/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.ktindex 901c9b796..ca7228f27 100644--- a/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.kt+++ b/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.kt@@ -25,7 +25,6 @@ import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataimport com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRuleimport com.google.samples.apps.nowinandroid.feature.interests.InterestsUiStateimport com.google.samples.apps.nowinandroid.feature.interests.InterestsViewModel-import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARGimport kotlinx.coroutines.flow.collectimport kotlinx.coroutines.launchimport kotlinx.coroutines.test.UnconfinedTestDispatcher@@ -55,7 +54,7 @@ class InterestsViewModelTest {@Beforefun setup() {viewModel = InterestsViewModel(- //TODO: Figure out how to supply the correct dependency: InterestsDestination(topicId = testInputTopics[0].topic.id)+ // TODO: Figure out how to supply the correct dependency: InterestsDestination(topicId = testInputTopics[0].topic.id)savedStateHandle = SavedStateHandle(mapOf("topicId" to testInputTopics[0].topic.id)),userDataRepository = userDataRepository,getFollowableTopics = getFollowableTopicsUseCase,diff --git a/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModel.kt b/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModel.ktindex 5de77ccd1..3d36dbdf5 100644--- a/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModel.kt+++ b/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModel.kt@@ -48,7 +48,7 @@ class TopicViewModel @Inject constructor(userNewsResourceRepository: UserNewsResourceRepository,) : ViewModel() {- private val topicDestination : TopicDestination = savedStateHandle.toRoute()+ private val topicDestination: TopicDestination = savedStateHandle.toRoute()val topicId = topicDestination.iddiff --git a/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/navigation/TopicNavigation.kt b/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/navigation/TopicNavigation.ktindex 0cdfcb502..c116c6432 100644--- a/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/navigation/TopicNavigation.kt+++ b/feature/topic/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/topic/navigation/TopicNavigation.kt@@ -44,4 +44,3 @@ fun NavGraphBuilder.topicScreen()}}-diff --git a/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt b/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.ktindex 4ebb6990d..f4a0903bd 100644--- a/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt+++ b/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt@@ -59,7 +59,7 @@ class TopicViewModelTest {@Beforefun setup() {viewModel = TopicViewModel(- //TODO: Figure out how to supply the correct dependency TopicDestination(id = testInputTopics[0].topic.id)+ // TODO: Figure out how to supply the correct dependency TopicDestination(id = testInputTopics[0].topic.id)savedStateHandle = SavedStateHandle(mapOf("id" to testInputTopics[0].topic.id)),userDataRepository = userDataRepository,topicsRepository = topicsRepository,