From 94a1a4f7b7baa7875b6b12e382f4f3e22e08b2f6 Mon Sep 17 00:00:00 2001 From: atsunatsu Date: Tue, 22 Sep 2026 15:13:47 +0800 Subject: [PATCH] diagnostics(mutual): log prefill scroll path under tag Look4SatMutual Temporary Log.d probes at prefill, list-layout gate, scroll effect entry, scrollToItem outcome and consume, to locate why the map Match prefill scroll does not land on the device (Robolectric covers it). Bump 12.5. --- .../look4sat/feature/mutual/MutualScreen.kt | 21 +++++++++++++++++-- .../feature/mutual/MutualViewModel.kt | 4 ++++ gradle/libs.versions.toml | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualScreen.kt b/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualScreen.kt index 1a104283..3c6aa8a3 100644 --- a/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualScreen.kt +++ b/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualScreen.kt @@ -17,6 +17,7 @@ */ package com.rtbishop.look4sat.feature.mutual +import android.util.Log import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.expandVertically import androidx.compose.animation.shrinkVertically @@ -229,11 +230,17 @@ private fun MutualContent( // page stays at the top). onGloballyPositioned fires on the first real // layout, so the subsequent scrollToItem always has a measured list. var listReady by remember { mutableStateOf(false) } + Log.d(TAG, "composed: scrollToTimeRange=${state.scrollToTimeRange} matchIndex=${if (state.errorMessage != null) 2 else 1} listReady=$listReady") LazyColumn( modifier = Modifier .fillMaxSize() - .onGloballyPositioned { listReady = true }, + .onGloballyPositioned { + if (!listReady) { + Log.d(TAG, "lazy list laid out, opening prefill scroll gate") + listReady = true + } + }, state = listState, verticalArrangement = Arrangement.spacedBy(6.dp) ) { @@ -390,13 +397,23 @@ private fun MutualContent( // Compose version (verified in tests), while scrollToItem lands correctly. val matchSearchIndex = if (state.errorMessage != null) 2 else 1 LaunchedEffect(state.scrollToTimeRange, matchSearchIndex, listReady) { + Log.d(TAG, "scroll effect: scrollToTimeRange=${state.scrollToTimeRange} matchIndex=$matchSearchIndex listReady=$listReady") if (state.scrollToTimeRange && listReady) { - listState.scrollToItem(matchSearchIndex) + Log.d(TAG, "attempting scrollToItem($matchSearchIndex)") + try { + listState.scrollToItem(matchSearchIndex) + Log.d(TAG, "scrollToItem($matchSearchIndex) done, firstVisible=${listState.firstVisibleItemIndex}") + } catch (t: Throwable) { + Log.e(TAG, "scrollToItem($matchSearchIndex) threw", t) + } viewModel.consumeScrollToTimeRange() + Log.d(TAG, "scrollToTimeRange consumed") } } } +private const val TAG = "Look4SatMutual" + @Composable private fun MutualStatusChip(state: MutualUiState) { val colorScheme = MaterialTheme.colorScheme diff --git a/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualViewModel.kt b/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualViewModel.kt index 71e95434..7845757b 100644 --- a/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualViewModel.kt +++ b/feature/mutual/src/main/java/com/rtbishop/look4sat/feature/mutual/MutualViewModel.kt @@ -40,6 +40,8 @@ import kotlinx.coroutines.withContext import kotlin.math.PI import kotlin.math.roundToInt +private const val TAG = "Look4SatMutual" + data class MutualUiState( val stationALat: String = "", val stationALon: String = "", @@ -197,6 +199,7 @@ class MutualViewModel( fun prefillMatchFromGrid(grid: String) { val g = grid.trim().uppercase() val pos = qthToPosition(g) + android.util.Log.d(TAG, "prefillMatchFromGrid('$g')") _uiState.update { it.copy( stationBGrid = g, @@ -210,6 +213,7 @@ class MutualViewModel( } fun consumeScrollToTimeRange() { + android.util.Log.d(TAG, "consumeScrollToTimeRange") _uiState.update { it.copy(scrollToTimeRange = false) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index acf8a774..b74a1f33 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] #noinspection UnusedVersionCatalogEntry -appVersionCode = "490" +appVersionCode = "491" #noinspection UnusedVersionCatalogEntry -appVersionName = "4.4.7-ba7opf.12.4" +appVersionName = "4.4.7-ba7opf.12.5" #noinspection UnusedVersionCatalogEntry compileSdk = "37" #noinspection UnusedVersionCatalogEntry