From dbff140b64da33e9802206102ce3dcfd1ef15dcb Mon Sep 17 00:00:00 2001 From: Don Turner Date: Fri, 21 Oct 2022 21:20:28 +0100 Subject: [PATCH] Fix minor issues --- .../apps/nowinandroid/navigation/TopLevelDestination.kt | 2 +- .../com/google/samples/apps/nowinandroid/ui/NiaApp.kt | 9 ++++++--- .../google/samples/apps/nowinandroid/ui/NiaAppState.kt | 2 +- .../core/navigation/NiaNavigationDestination.kt | 0 .../apps/nowinandroid/feature/foryou/ForYouViewModel.kt | 1 - 5 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 core/navigation/src/main/java/com/google/samples/apps/nowinandroid/core/navigation/NiaNavigationDestination.kt diff --git a/app/src/main/java/com/google/samples/apps/nowinandroid/navigation/TopLevelDestination.kt b/app/src/main/java/com/google/samples/apps/nowinandroid/navigation/TopLevelDestination.kt index 247b2934b..956037f29 100644 --- a/app/src/main/java/com/google/samples/apps/nowinandroid/navigation/TopLevelDestination.kt +++ b/app/src/main/java/com/google/samples/apps/nowinandroid/navigation/TopLevelDestination.kt @@ -16,6 +16,7 @@ package com.google.samples.apps.nowinandroid.navigation +import com.google.samples.apps.nowinandroid.R import com.google.samples.apps.nowinandroid.core.designsystem.icon.Icon import com.google.samples.apps.nowinandroid.core.designsystem.icon.Icon.DrawableResourceIcon import com.google.samples.apps.nowinandroid.core.designsystem.icon.Icon.ImageVectorIcon @@ -23,7 +24,6 @@ import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons import com.google.samples.apps.nowinandroid.feature.bookmarks.R as bookmarksR import com.google.samples.apps.nowinandroid.feature.foryou.R as forYouR import com.google.samples.apps.nowinandroid.feature.interests.R as interestsR -import com.google.samples.apps.nowinandroid.R /** * Type for the top level destinations in the application. Each of these destinations diff --git a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt index be9713f61..7556213d5 100644 --- a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt +++ b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt @@ -52,6 +52,7 @@ import androidx.lifecycle.compose.ExperimentalLifecycleComposeApi import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavDestination import androidx.navigation.NavDestination.Companion.hierarchy +import com.google.samples.apps.nowinandroid.R import com.google.samples.apps.nowinandroid.core.data.util.NetworkMonitor import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaBackground import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaGradientBackground @@ -64,10 +65,9 @@ import com.google.samples.apps.nowinandroid.core.designsystem.icon.Icon.Drawable import com.google.samples.apps.nowinandroid.core.designsystem.icon.Icon.ImageVectorIcon import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons import com.google.samples.apps.nowinandroid.feature.settings.R as settingsR +import com.google.samples.apps.nowinandroid.feature.settings.SettingsDialog import com.google.samples.apps.nowinandroid.navigation.NiaNavHost import com.google.samples.apps.nowinandroid.navigation.TopLevelDestination -import com.google.samples.apps.nowinandroid.R -import com.google.samples.apps.nowinandroid.feature.settings.SettingsDialog @OptIn( ExperimentalMaterial3Api::class, @@ -86,7 +86,10 @@ fun NiaApp( ) { val background: @Composable (@Composable () -> Unit) -> Unit = when (appState.currentDestination?.route) { - TopLevelDestination.FOR_YOU.name -> { content -> NiaGradientBackground(content = content) } + TopLevelDestination.FOR_YOU.name -> { + content -> + NiaGradientBackground(content = content) + } else -> { content -> NiaBackground(content = content) } } diff --git a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt index a1638e416..bc5724c02 100644 --- a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt +++ b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt @@ -76,7 +76,7 @@ class NiaAppState( .currentBackStackEntryAsState().value?.destination val currentTopLevelDestination: TopLevelDestination? - @Composable get() = when(currentDestination?.route){ + @Composable get() = when (currentDestination?.route) { forYouNavigationRoute -> FOR_YOU bookmarksRoute -> BOOKMARKS interestsRoute -> INTERESTS diff --git a/core/navigation/src/main/java/com/google/samples/apps/nowinandroid/core/navigation/NiaNavigationDestination.kt b/core/navigation/src/main/java/com/google/samples/apps/nowinandroid/core/navigation/NiaNavigationDestination.kt deleted file mode 100644 index e69de29bb..000000000 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 f88cd9d39..548e786fe 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 @@ -25,7 +25,6 @@ import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewmodel.compose.SavedStateHandleSaveableApi import androidx.lifecycle.viewmodel.compose.saveable import com.google.samples.apps.nowinandroid.core.data.repository.UserDataRepository -import com.google.samples.apps.nowinandroid.core.data.util.NetworkMonitor import com.google.samples.apps.nowinandroid.core.data.util.SyncStatusMonitor import com.google.samples.apps.nowinandroid.core.domain.GetFollowableTopicsStreamUseCase import com.google.samples.apps.nowinandroid.core.domain.GetSaveableNewsResourcesStreamUseCase