Feeding goes from loading -> success, causing whole feed to recreate? Added logging statements

Change-Id: I39f9a31c8fb324bce684f1a0145d58251c70181a
caren/onboarding_prevent_scroll_on_action
Caren 2 years ago
parent dd011c6d3b
commit 02307fc507

@ -18,6 +18,7 @@ package com.google.samples.apps.nowinandroid.core.ui
import android.content.Context import android.content.Context
import android.net.Uri import android.net.Uri
import android.util.Log
import androidx.annotation.ColorInt import androidx.annotation.ColorInt
import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent import androidx.browser.customtabs.CustomTabsIntent
@ -51,6 +52,7 @@ fun LazyGridScope.newsFeed(
when (feedState) { when (feedState) {
NewsFeedUiState.Loading -> Unit NewsFeedUiState.Loading -> Unit
is NewsFeedUiState.Success -> { is NewsFeedUiState.Success -> {
Log.i("CarenNewsFeed", "Recreating news feed")
items(feedState.feed, key = { it.newsResource.id }) { saveableNewsResource -> items(feedState.feed, key = { it.newsResource.id }) { saveableNewsResource ->
val resourceUrl by remember { val resourceUrl by remember {
mutableStateOf(Uri.parse(saveableNewsResource.newsResource.url)) mutableStateOf(Uri.parse(saveableNewsResource.newsResource.url))

@ -17,6 +17,7 @@
package com.google.samples.apps.nowinandroid.feature.foryou package com.google.samples.apps.nowinandroid.feature.foryou
import android.app.Activity import android.app.Activity
import android.util.Log
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
@ -97,10 +98,13 @@ internal fun ForYouRoute(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
viewModel: ForYouViewModel = hiltViewModel() viewModel: ForYouViewModel = hiltViewModel()
) { ) {
val onboardingUiState by viewModel.onboardingUiState.collectAsStateWithLifecycle() val onboardingUiState by viewModel.onboardingUiState.collectAsStateWithLifecycle()
val feedState by viewModel.feedState.collectAsStateWithLifecycle() val feedState by viewModel.feedState.collectAsStateWithLifecycle()
val isSyncing by viewModel.isSyncing.collectAsStateWithLifecycle() val isSyncing by viewModel.isSyncing.collectAsStateWithLifecycle()
Log.i("Caren", "Executing ForYouRoute: $feedState")
ForYouScreen( ForYouScreen(
isSyncing = isSyncing, isSyncing = isSyncing,
onboardingUiState = onboardingUiState, onboardingUiState = onboardingUiState,
@ -125,6 +129,8 @@ internal fun ForYouScreen(
val isOnboardingLoading = onboardingUiState is OnboardingUiState.Loading val isOnboardingLoading = onboardingUiState is OnboardingUiState.Loading
val isFeedLoading = feedState is NewsFeedUiState.Loading val isFeedLoading = feedState is NewsFeedUiState.Loading
Log.i("Caren", "Recreating ForYouScreen")
// Workaround to call Activity.reportFullyDrawn from Jetpack Compose. // Workaround to call Activity.reportFullyDrawn from Jetpack Compose.
// This code should be called when the UI is ready for use // This code should be called when the UI is ready for use
// and relates to Time To Full Display. // and relates to Time To Full Display.

Loading…
Cancel
Save