From 6279b6fac023bf1115622b08cdbedfc3a337cff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Mlynari=C4=8D?= Date: Thu, 30 Jun 2022 15:59:03 +0200 Subject: [PATCH] Fix comment Change-Id: I9b776c9074c4d0aa15292d6cb43c3c5268828c51 --- .../apps/nowinandroid/feature/foryou/ForYouScreen.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt index fc5bd016b..a808511fe 100644 --- a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt +++ b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt @@ -175,8 +175,10 @@ fun ForYouScreen( if (interestsLoaded && feedLoaded) { val localView = LocalView.current - // Unit prevents calling it only once on recomposition, but doesn't prevent when the composable goes out of scope. - // Activity.reportFullyDrawn has inside check to be called only once. + // We use Unit to call reportFullyDrawn only on the first recomposition, + // however it will be called again if this composable goes out of scope. + // Activity.reportFullyDrawn() has its own check for this + // and is safe to call multiple times though. LaunchedEffect(Unit) { // We're leveraging the fact, that the current view is directly set as content of Activity. val activity = localView.context as? Activity ?: return@LaunchedEffect