Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Fix tests, fix spotless

Don Turnerbe752e779d5e
diff --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.kt
index 1eddde8e6..3ad2c6162 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
@@ -26,7 +26,6 @@ import androidx.compose.material3.adaptive.layout.ThreePaneScaffoldDestinationIt
import androidx.compose.material3.adaptive.navigation.ThreePaneScaffoldNavigator
import androidx.compose.material3.adaptive.navigation.rememberListDetailPaneScaffoldNavigator
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.mutableStateOf
@@ -34,7 +33,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
-import androidx.compose.runtime.setValue
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavGraphBuilder
@@ -47,8 +45,8 @@ import com.google.samples.apps.nowinandroid.feature.topic.TopicDetailPlaceholder
import com.google.samples.apps.nowinandroid.feature.topic.navigation.TopicDestination
import com.google.samples.apps.nowinandroid.feature.topic.navigation.navigateToTopic
import com.google.samples.apps.nowinandroid.feature.topic.navigation.topicScreen
-import java.util.UUID
import kotlinx.serialization.Serializable
+import java.util.UUID
@Serializable object TopicPlaceholderDestination
@@ -135,7 +133,7 @@ internal fun InterestsListDetailScreen(
NavHost(
navController = nestedNavController,
startDestination = nestedNavHostStartDestination,
- route = DetailPaneNavHostDestination::class
+ route = DetailPaneNavHostDestination::class,
) {
topicScreen(
showBackButton = !listDetailNavigator.isListPaneVisible(),
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.kt
index ca7228f27..91e710b32 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,6 +25,7 @@ import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserData
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
import com.google.samples.apps.nowinandroid.feature.interests.InterestsUiState
import com.google.samples.apps.nowinandroid.feature.interests.InterestsViewModel
+import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_KEY
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.UnconfinedTestDispatcher
@@ -54,8 +55,9 @@ class InterestsViewModelTest {
@Before
fun setup() {
viewModel = InterestsViewModel(
- // TODO: Figure out how to supply the correct dependency: InterestsDestination(topicId = testInputTopics[0].topic.id)
- savedStateHandle = SavedStateHandle(mapOf("topicId" to testInputTopics[0].topic.id)),
+ // TODO: Construct from destination when aosp/3073537 lands (due 14th May 2024)
+ // savedStateHandle = SavedStateHandle(InterestsDestination(initialTopicId = testInputTopics[0].topic.id)),
+ savedStateHandle = SavedStateHandle(mapOf("initialTopicId" to testInputTopics[0].topic.id)),
userDataRepository = userDataRepository,
getFollowableTopics = getFollowableTopicsUseCase,
)