mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-06 12:37:26 +00:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8138c948b | ||
|
|
0e28231c4a | ||
|
|
d6bdf5ecb6 | ||
|
|
6962a4bfa1 | ||
|
|
94a1a4f7b7 | ||
|
|
dbf2229774 | ||
|
|
f2fc1b7b28 | ||
|
|
d600836e19 | ||
|
|
94bffe80b0 | ||
|
|
4260fbb096 | ||
|
|
3d5b55faa3 | ||
|
|
466f2f6088 | ||
|
|
14bd984327 | ||
|
|
d5c100903b |
No files matched your search
@@ -177,6 +177,28 @@ fun MainScreen(
|
|||||||
factory = MapFilterViewModel.factory()
|
factory = MapFilterViewModel.factory()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Map grid-QSO dialog "Match" button: pre-fill the match page for that
|
||||||
|
// grid and run the query BEFORE navigating, so the page's first frame
|
||||||
|
// already contains the results (time-range card at the top, pass curves
|
||||||
|
// right below — no scroll flicker). Navigation happens once the query
|
||||||
|
// finishes (see the collector below).
|
||||||
|
val mutualState by mutualViewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
val matchCalculating = mutualState.pendingNavigation && mutualState.isCalculating
|
||||||
|
|
||||||
|
LaunchedEffect(mutualViewModel) {
|
||||||
|
mutualViewModel.uiState.collect { state ->
|
||||||
|
if (state.pendingNavigation && !state.isCalculating) {
|
||||||
|
mutualViewModel.consumePendingNavigation()
|
||||||
|
// Push Mutual on top of the Map entry instead of replacing the
|
||||||
|
// stack (bottom-nav style): the system back gesture then pops
|
||||||
|
// back to the map page, which is the page the user came from.
|
||||||
|
if (backStack.lastOrNull() !is Screen.Mutual) {
|
||||||
|
backStack.add(Screen.Mutual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalElevationThresholds provides ElevationThresholds(
|
LocalElevationThresholds provides ElevationThresholds(
|
||||||
low = otherSettings.lowElevation,
|
low = otherSettings.lowElevation,
|
||||||
@@ -246,12 +268,14 @@ fun MainScreen(
|
|||||||
entry<Screen.Map> {
|
entry<Screen.Map> {
|
||||||
MapDestination(
|
MapDestination(
|
||||||
mapFilterViewModel = mapFilterViewModel,
|
mapFilterViewModel = mapFilterViewModel,
|
||||||
|
matchCalculating = matchCalculating,
|
||||||
onMatchGrid = { grid ->
|
onMatchGrid = { grid ->
|
||||||
// Grid-QSO dialog "Match" button: pre-fill the
|
// Grid-QSO dialog "Match" button: pre-fill
|
||||||
// match page for that grid and switch to its tab.
|
// the match page for that grid and start the
|
||||||
|
// query. Navigation to the match page is
|
||||||
|
// handled by the uiState collector above,
|
||||||
|
// once the query finishes.
|
||||||
mutualViewModel.prefillMatchFromGrid(grid)
|
mutualViewModel.prefillMatchFromGrid(grid)
|
||||||
while (backStack.size > 1) backStack.removeAt(backStack.size - 1)
|
|
||||||
backStack.add(Screen.Mutual)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import androidx.compose.material3.Surface
|
|||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.DisposableEffect
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@@ -153,7 +154,10 @@ fun MapDestination(
|
|||||||
mapFilterViewModel: MapFilterViewModel,
|
mapFilterViewModel: MapFilterViewModel,
|
||||||
// Invoked with the tapped grid when the QSO dialog's "Match" button is
|
// Invoked with the tapped grid when the QSO dialog's "Match" button is
|
||||||
// pressed: navigate to the match page pre-filled for that grid.
|
// pressed: navigate to the match page pre-filled for that grid.
|
||||||
onMatchGrid: (String) -> Unit = {}
|
onMatchGrid: (String) -> Unit = {},
|
||||||
|
// True while the map "Match" query is running (the page only navigates
|
||||||
|
// once the query finished, so the match page opens with results ready).
|
||||||
|
matchCalculating: Boolean = false
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val container = (context.applicationContext as IContainerProvider).getMainContainer()
|
val container = (context.applicationContext as IContainerProvider).getMainContainer()
|
||||||
@@ -190,7 +194,7 @@ fun MapDestination(
|
|||||||
viewModel.onAction(MapAction.SetVisible(false))
|
viewModel.onAction(MapAction.SetVisible(false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MapScreen(uiState, viewModel::onAction, mapView, mapFilterViewModel, onMatchGrid)
|
MapScreen(uiState, viewModel::onAction, mapView, mapFilterViewModel, onMatchGrid, matchCalculating)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -199,7 +203,8 @@ private fun MapScreen(
|
|||||||
onAction: (MapAction) -> Unit,
|
onAction: (MapAction) -> Unit,
|
||||||
mapView: MapView,
|
mapView: MapView,
|
||||||
mapFilterViewModel: MapFilterViewModel,
|
mapFilterViewModel: MapFilterViewModel,
|
||||||
onMatchGrid: (String) -> Unit
|
onMatchGrid: (String) -> Unit,
|
||||||
|
matchCalculating: Boolean
|
||||||
) {
|
) {
|
||||||
val rotateMod = Modifier.rotate(180f)
|
val rotateMod = Modifier.rotate(180f)
|
||||||
val timeString = uiState.mapData?.aosTime ?: "00:00:00"
|
val timeString = uiState.mapData?.aosTime ?: "00:00:00"
|
||||||
@@ -423,6 +428,7 @@ private fun MapScreen(
|
|||||||
grid = grid,
|
grid = grid,
|
||||||
qsos = uiState.workedGridQsos[grid].orEmpty().sortedBy { it.epochMs },
|
qsos = uiState.workedGridQsos[grid].orEmpty().sortedBy { it.epochMs },
|
||||||
isUtc = uiState.isUtc,
|
isUtc = uiState.isUtc,
|
||||||
|
matchCalculating = matchCalculating,
|
||||||
onDismiss = { selectedGrid = null },
|
onDismiss = { selectedGrid = null },
|
||||||
onMatch = { onMatchGrid(grid) }
|
onMatch = { onMatchGrid(grid) }
|
||||||
)
|
)
|
||||||
@@ -436,6 +442,7 @@ private fun WorkedGridQsoDialog(
|
|||||||
grid: String,
|
grid: String,
|
||||||
qsos: List<com.rtbishop.look4sat.core.domain.model.GridQso>,
|
qsos: List<com.rtbishop.look4sat.core.domain.model.GridQso>,
|
||||||
isUtc: Boolean,
|
isUtc: Boolean,
|
||||||
|
matchCalculating: Boolean,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
onMatch: () -> Unit
|
onMatch: () -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -467,16 +474,24 @@ private fun WorkedGridQsoDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
TextButton(
|
TextButton(
|
||||||
|
enabled = !matchCalculating,
|
||||||
onClick = {
|
onClick = {
|
||||||
onDismiss()
|
onDismiss()
|
||||||
onMatch()
|
onMatch()
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Icon(
|
if (matchCalculating) {
|
||||||
painter = painterResource(R.drawable.ic_radio_tower),
|
CircularProgressIndicator(
|
||||||
contentDescription = null,
|
modifier = Modifier.size(18.dp),
|
||||||
modifier = Modifier.size(18.dp)
|
strokeWidth = 2.dp
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_radio_tower),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(18.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
Spacer(Modifier.width(4.dp))
|
Spacer(Modifier.width(4.dp))
|
||||||
Text(stringResource(R.string.grid_qso_match))
|
Text(stringResource(R.string.grid_qso_match))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,20 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.rtbishop.look4sat.feature.mutual"
|
namespace = "com.rtbishop.look4sat.feature.mutual"
|
||||||
}
|
testOptions {
|
||||||
|
unitTests {
|
||||||
|
// Robolectric needs real Android resources for Compose UI tests.
|
||||||
|
isIncludeAndroidResources = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testImplementation(libs.test.junit4)
|
||||||
|
testImplementation(libs.test.coroutines)
|
||||||
|
testImplementation(libs.robolectric)
|
||||||
|
testImplementation(libs.androidx.test.core)
|
||||||
|
testImplementation(libs.compose.ui.test.junit4)
|
||||||
|
testImplementation(libs.compose.navigation3)
|
||||||
|
debugImplementation(libs.compose.debug.manifest)
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.rtbishop.look4sat.feature.mutual
|
package com.rtbishop.look4sat.feature.mutual
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.expandVertically
|
import androidx.compose.animation.expandVertically
|
||||||
import androidx.compose.animation.shrinkVertically
|
import androidx.compose.animation.shrinkVertically
|
||||||
@@ -54,11 +55,13 @@ import androidx.compose.runtime.LaunchedEffect
|
|||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableFloatStateOf
|
import androidx.compose.runtime.mutableFloatStateOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.runtime.snapshotFlow
|
import androidx.compose.runtime.snapshotFlow
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.layout.onGloballyPositioned
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
@@ -77,6 +80,7 @@ import java.text.SimpleDateFormat
|
|||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -157,7 +161,7 @@ fun MutualScreen(
|
|||||||
viewModel = viewModel,
|
viewModel = viewModel,
|
||||||
state = state,
|
state = state,
|
||||||
isVertical = isVertical,
|
isVertical = isVertical,
|
||||||
onQuery = viewModel::queryMutualPasses,
|
onQuery = { viewModel.queryMutualPasses() },
|
||||||
onSelectPass = viewModel::onSelectPass,
|
onSelectPass = viewModel::onSelectPass,
|
||||||
onNavigateToRadar = navigateToRadar,
|
onNavigateToRadar = navigateToRadar,
|
||||||
onStationALat = viewModel::onStationALat,
|
onStationALat = viewModel::onStationALat,
|
||||||
@@ -220,8 +224,24 @@ private fun MutualContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set once the list has actually been laid out. The prefill scroll only
|
||||||
|
// fires after this, because on a real device the Mutual entry appears
|
||||||
|
// through the NavDisplay transition and LaunchedEffect alone can run
|
||||||
|
// before the list is measurable (the scroll then never lands and the
|
||||||
|
// 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(
|
LazyColumn(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.onGloballyPositioned {
|
||||||
|
if (!listReady) {
|
||||||
|
Log.d(TAG, "lazy list laid out, opening prefill scroll gate")
|
||||||
|
listReady = true
|
||||||
|
}
|
||||||
|
},
|
||||||
state = listState,
|
state = listState,
|
||||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||||
) {
|
) {
|
||||||
@@ -370,18 +390,43 @@ private fun MutualContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prefill from the map's grid-QSO dialog "Match" button: jump straight to
|
// Prefill from the map's grid-QSO dialog "Match" button: once the page is
|
||||||
// the time-range card. Index accounts for the optional error card at the
|
// laid out, jump straight to the time-range card. Index accounts for the
|
||||||
// top (error = 0, station inputs = 1, time range = 2; else 1).
|
// optional error card at the top (error = 0, station inputs = 1, time
|
||||||
|
// range = 2; else 1). scrollToItem is used instead of initializing the
|
||||||
|
// LazyListState at index 1: the constructor parameter is ignored by this
|
||||||
|
// Compose version (verified in tests), while scrollToItem lands correctly.
|
||||||
val matchSearchIndex = if (state.errorMessage != null) 2 else 1
|
val matchSearchIndex = if (state.errorMessage != null) 2 else 1
|
||||||
LaunchedEffect(state.scrollToTimeRange, matchSearchIndex) {
|
LaunchedEffect(state.scrollToTimeRange, matchSearchIndex, listReady) {
|
||||||
if (state.scrollToTimeRange) {
|
Log.d(TAG, "scroll effect: scrollToTimeRange=${state.scrollToTimeRange} matchIndex=$matchSearchIndex listReady=$listReady")
|
||||||
listState.scrollToItem(matchSearchIndex)
|
if (state.scrollToTimeRange && listReady) {
|
||||||
|
// Keep trying until the scroll really lands: on a device the first
|
||||||
|
// frame only contains the station cards + time-range card, which
|
||||||
|
// can be shorter than the viewport (no scroll range), so a single
|
||||||
|
// scrollToItem does nothing. When the async query results arrive
|
||||||
|
// the list grows past one screen and the scroll becomes possible.
|
||||||
|
for (attempt in 0 until 20) {
|
||||||
|
Log.d(TAG, "attempting scrollToItem($matchSearchIndex) #$attempt")
|
||||||
|
try {
|
||||||
|
listState.scrollToItem(matchSearchIndex)
|
||||||
|
} catch (t: Throwable) {
|
||||||
|
Log.e(TAG, "scrollToItem($matchSearchIndex) threw", t)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (listState.firstVisibleItemIndex == matchSearchIndex) {
|
||||||
|
Log.d(TAG, "scroll landed at $matchSearchIndex on attempt #$attempt")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
delay(100)
|
||||||
|
}
|
||||||
viewModel.consumeScrollToTimeRange()
|
viewModel.consumeScrollToTimeRange()
|
||||||
|
Log.d(TAG, "scrollToTimeRange consumed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val TAG = "Look4SatMutual"
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MutualStatusChip(state: MutualUiState) {
|
private fun MutualStatusChip(state: MutualUiState) {
|
||||||
val colorScheme = MaterialTheme.colorScheme
|
val colorScheme = MaterialTheme.colorScheme
|
||||||
|
|||||||
+51
-15
@@ -40,6 +40,8 @@ import kotlinx.coroutines.withContext
|
|||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
private const val TAG = "Look4SatMutual"
|
||||||
|
|
||||||
data class MutualUiState(
|
data class MutualUiState(
|
||||||
val stationALat: String = "",
|
val stationALat: String = "",
|
||||||
val stationALon: String = "",
|
val stationALon: String = "",
|
||||||
@@ -57,9 +59,14 @@ data class MutualUiState(
|
|||||||
val isUtc: Boolean = false,
|
val isUtc: Boolean = false,
|
||||||
val errorMessage: String? = null,
|
val errorMessage: String? = null,
|
||||||
// One-shot flag set by prefillMatchFromGrid() (map grid → Match button):
|
// One-shot flag set by prefillMatchFromGrid() (map grid → Match button):
|
||||||
// the page scrolls to the time-range card, then consumeScrollToTimeRange()
|
// the page scrolls to the time-range card after the first layout, then
|
||||||
// clears it.
|
// consumeScrollToTimeRange() clears it.
|
||||||
val scrollToTimeRange: Boolean = false
|
val scrollToTimeRange: Boolean = false,
|
||||||
|
// One-shot flag set by prefillMatchFromGrid(): the map page waits for the
|
||||||
|
// pre-filled query to finish, then navigates to the match page so the very
|
||||||
|
// first frame already contains the results (time-range card + pass curves,
|
||||||
|
// no scroll flicker). consumePendingNavigation() clears it.
|
||||||
|
val pendingNavigation: Boolean = false
|
||||||
)
|
)
|
||||||
|
|
||||||
class MutualViewModel(
|
class MutualViewModel(
|
||||||
@@ -190,30 +197,47 @@ class MutualViewModel(
|
|||||||
/**
|
/**
|
||||||
* Pre-fill the match page for a target grid picked from the map's grid-QSO
|
* Pre-fill the match page for a target grid picked from the map's grid-QSO
|
||||||
* dialog ("Match" button): set the opposite-station grid (with its
|
* dialog ("Match" button): set the opposite-station grid (with its
|
||||||
* coordinates), reset the time range to 24h, flag the page to scroll
|
* coordinates), reset the time range to 24h, start the query immediately
|
||||||
* straight to the time-range card, and start the query immediately so
|
* so results are ready when the page opens, and flag the page to scroll
|
||||||
* results are ready when the page opens.
|
* straight to the time-range card once it is laid out.
|
||||||
*/
|
*/
|
||||||
fun prefillMatchFromGrid(grid: String) {
|
fun prefillMatchFromGrid(grid: String) {
|
||||||
val g = grid.trim().uppercase()
|
val g = grid.trim().uppercase()
|
||||||
val pos = qthToPosition(g)
|
val pos = qthToPosition(g)
|
||||||
|
android.util.Log.d(TAG, "prefillMatchFromGrid('$g')")
|
||||||
_uiState.update {
|
_uiState.update {
|
||||||
it.copy(
|
it.copy(
|
||||||
stationBGrid = g,
|
stationBGrid = g,
|
||||||
stationBLat = pos?.let { p -> "%.4f".format(p.latitude) } ?: it.stationBLat,
|
stationBLat = pos?.let { p -> "%.4f".format(p.latitude) } ?: it.stationBLat,
|
||||||
stationBLon = pos?.let { p -> "%.4f".format(p.longitude) } ?: it.stationBLon,
|
stationBLon = pos?.let { p -> "%.4f".format(p.longitude) } ?: it.stationBLon,
|
||||||
hoursAhead = 24,
|
hoursAhead = 24,
|
||||||
scrollToTimeRange = true
|
scrollToTimeRange = true,
|
||||||
|
pendingNavigation = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
queryMutualPasses()
|
queryMutualPasses()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun consumePendingNavigation() {
|
||||||
|
android.util.Log.d(TAG, "consumePendingNavigation")
|
||||||
|
_uiState.update { it.copy(pendingNavigation = false) }
|
||||||
|
}
|
||||||
|
|
||||||
fun consumeScrollToTimeRange() {
|
fun consumeScrollToTimeRange() {
|
||||||
|
android.util.Log.d(TAG, "consumeScrollToTimeRange")
|
||||||
_uiState.update { it.copy(scrollToTimeRange = false) }
|
_uiState.update { it.copy(scrollToTimeRange = false) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun queryMutualPasses() {
|
/**
|
||||||
|
* Run a mutual-pass query. `initialScrollIndex` non-null forces the list
|
||||||
|
* to rebuild at that position (legacy callers); null keeps the current
|
||||||
|
* scroll position, so re-running a query from the match page does not
|
||||||
|
* jump back to the top. The previous results stay on screen while the
|
||||||
|
* query runs (the list keeps its height, so the scroll position is not
|
||||||
|
* clamped away); they are replaced — possibly with empty — when the new
|
||||||
|
* results arrive.
|
||||||
|
*/
|
||||||
|
fun queryMutualPasses(initialScrollIndex: Int? = null) {
|
||||||
val state = _uiState.value
|
val state = _uiState.value
|
||||||
|
|
||||||
// Resolve positions from lat/lon or grid
|
// Resolve positions from lat/lon or grid
|
||||||
@@ -236,14 +260,19 @@ class MutualViewModel(
|
|||||||
isCalculating = true,
|
isCalculating = true,
|
||||||
hasSearched = true,
|
hasSearched = true,
|
||||||
errorMessage = null,
|
errorMessage = null,
|
||||||
mutualPasses = emptyList(),
|
// Deliberately keep mutualPasses: clearing it would shrink the
|
||||||
|
// list below one screen and clamp the scroll position away.
|
||||||
|
// The stale results are replaced when the new ones arrive.
|
||||||
selectedPassIndex = -1
|
selectedPassIndex = -1
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// The results list is about to be replaced, so the scroll position must
|
// Scroll position: an explicit initialScrollIndex overrides (legacy
|
||||||
// not leak from the previous query's list.
|
// callers start at a fixed spot); null keeps the current position so
|
||||||
listScrollIndex = 0
|
// re-querying does not jump back to the top.
|
||||||
listScrollOffset = 0
|
if (initialScrollIndex != null) {
|
||||||
|
listScrollIndex = initialScrollIndex
|
||||||
|
listScrollOffset = 0
|
||||||
|
}
|
||||||
queryGeneration += 1
|
queryGeneration += 1
|
||||||
|
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
@@ -252,8 +281,15 @@ class MutualViewModel(
|
|||||||
val minElevB = state.stationBMinElev
|
val minElevB = state.stationBMinElev
|
||||||
val hours = state.hoursAhead
|
val hours = state.hoursAhead
|
||||||
|
|
||||||
val results = withContext(computeDispatcher) {
|
val results = try {
|
||||||
findMutualPasses(satellites, posA, posB, minElevA, minElevB, time, hours)
|
withContext(computeDispatcher) {
|
||||||
|
findMutualPasses(satellites, posA, posB, minElevA, minElevB, time, hours)
|
||||||
|
}
|
||||||
|
} catch (t: Throwable) {
|
||||||
|
// Never leave the query stuck in "calculating" (which would also
|
||||||
|
// block the pending map→match navigation forever).
|
||||||
|
android.util.Log.e(TAG, "findMutualPasses threw", t)
|
||||||
|
emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
val errorMsg = if (results.isEmpty()) {
|
val errorMsg = if (results.isEmpty()) {
|
||||||
|
|||||||
+291
@@ -0,0 +1,291 @@
|
|||||||
|
package com.rtbishop.look4sat.feature.mutual
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.test.assertIsDisplayed
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.test.junit4.createComposeRule
|
||||||
|
import androidx.compose.ui.test.onNodeWithText
|
||||||
|
import androidx.navigation3.runtime.NavBackStack
|
||||||
|
import androidx.navigation3.runtime.NavKey
|
||||||
|
import androidx.navigation3.runtime.entryProvider
|
||||||
|
import androidx.navigation3.runtime.rememberNavBackStack
|
||||||
|
import androidx.navigation3.ui.NavDisplay
|
||||||
|
import com.rtbishop.look4sat.core.presentation.Screen
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Rule
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.robolectric.RobolectricTestRunner
|
||||||
|
import org.robolectric.annotation.Config
|
||||||
|
import org.robolectric.annotation.GraphicsMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies the map grid-QSO dialog "Match" prefill: after
|
||||||
|
* [MutualViewModel.prefillMatchFromGrid] the page opens with the time-range
|
||||||
|
* card at the top and the 24h query auto-started.
|
||||||
|
*
|
||||||
|
* Note: `LazyListState(firstVisibleItemIndex = 1)` is deliberately NOT used to
|
||||||
|
* position the page. In this Compose version (BOM 2026.06.01 / ui 1.11.x) the
|
||||||
|
* constructor parameter is ignored — the list still starts at item 0 — while
|
||||||
|
* `listState.scrollToItem(1)` from a LaunchedEffect lands correctly. See
|
||||||
|
* [scrollToItemLandsAtTop] below, which guards the scrollToItem mechanism.
|
||||||
|
*
|
||||||
|
* Robolectric quirk: `assertIsNotDisplayed()` is unreliable here (a node
|
||||||
|
* scrolled fully out of the viewport can still report "displayed"), so the
|
||||||
|
* prefill test asserts the time-range card IS displayed (positive assertion)
|
||||||
|
* rather than that the station card is NOT.
|
||||||
|
*/
|
||||||
|
@RunWith(RobolectricTestRunner::class)
|
||||||
|
@GraphicsMode(GraphicsMode.Mode.NATIVE)
|
||||||
|
@Config(sdk = [34], qualifiers = "w411dp-h891dp-port")
|
||||||
|
class MutualMatchPrefillScrollTest {
|
||||||
|
|
||||||
|
@get:Rule
|
||||||
|
val composeRule = createComposeRule()
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun sanity_textRenders() {
|
||||||
|
composeRule.setContent {
|
||||||
|
MaterialTheme {
|
||||||
|
Text("sanity-check-text")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
composeRule.onNodeWithText("sanity-check-text").assertIsDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun scrollToItemLandsAtTop() {
|
||||||
|
// Guards the mechanism the prefill relies on: scrollToItem(1) from a
|
||||||
|
// LaunchedEffect moves item 1 to the top of the viewport.
|
||||||
|
composeRule.setContent {
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
val state = remember { LazyListState(firstVisibleItemIndex = 0) }
|
||||||
|
LaunchedEffect(Unit) { state.scrollToItem(1) }
|
||||||
|
LazyColumn(state = state) {
|
||||||
|
item { Text("min-item-0") }
|
||||||
|
item { Text("min-item-1") }
|
||||||
|
item { Text("min-item-2") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
composeRule.onNodeWithText("min-item-1").assertIsDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun defaultOpen_showsStationInputsAtTop() {
|
||||||
|
val vm = MutualViewModel(FakeSatelliteRepo(), FakeSettingsRepo())
|
||||||
|
composeRule.setContent {
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
MutualScreen(viewModel = vm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Without a prefill the list starts at item 0 (station inputs).
|
||||||
|
composeRule.onNodeWithText("Your Station").assertIsDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun prefillFromMap_opensAtTimeRangeCard() {
|
||||||
|
val vm = MutualViewModel(FakeSatelliteRepo(), FakeSettingsRepo())
|
||||||
|
// Same call the map grid-QSO "Match" button makes.
|
||||||
|
vm.prefillMatchFromGrid("OL62")
|
||||||
|
|
||||||
|
composeRule.setContent {
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
MutualScreen(viewModel = vm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
|
||||||
|
// The time-range card must be visible at the top of the page after the
|
||||||
|
// prefill scroll.
|
||||||
|
composeRule.onNodeWithText("Time range").assertIsDisplayed()
|
||||||
|
// The snapshotFlow write-back stores the scrolled position in the VM.
|
||||||
|
// It equals 1 only if scrollToItem(1) REALLY scrolled the station card
|
||||||
|
// out. If the list content is shorter than the viewport there is no
|
||||||
|
// scroll range, scrollToItem cannot move, and this stays 0 — that is
|
||||||
|
// exactly the device symptom ("page stays at the top").
|
||||||
|
org.junit.Assert.assertEquals(
|
||||||
|
"list must have actually scrolled to item 1 (content shorter than viewport?)",
|
||||||
|
1, vm.listScrollIndex
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun prefillAutoStartsQueryAndFillsState() {
|
||||||
|
val vm = MutualViewModel(FakeSatelliteRepo(), FakeSettingsRepo())
|
||||||
|
vm.prefillMatchFromGrid("OL62")
|
||||||
|
val s = vm.uiState.value
|
||||||
|
// Query auto-started: with the empty-satellite fake the query reaches
|
||||||
|
// the "no satellite data" guard (rather than never being triggered),
|
||||||
|
// proving prefillMatchFromGrid kicks off queryMutualPasses.
|
||||||
|
assertTrue(
|
||||||
|
"auto-query should reach the satellite guard: gridA=${s.stationAGrid} " +
|
||||||
|
"gridB=${s.stationBGrid} err=${s.errorMessage}",
|
||||||
|
s.errorMessage?.contains("satellite", ignoreCase = true) == true
|
||||||
|
)
|
||||||
|
// ...and the target grid + 24h range pre-filled.
|
||||||
|
org.junit.Assert.assertEquals("OL62", s.stationBGrid)
|
||||||
|
org.junit.Assert.assertEquals(24, s.hoursAhead)
|
||||||
|
// ...and navigation to the match page is pending until the query done.
|
||||||
|
assertTrue("navigation should be pending", s.pendingNavigation)
|
||||||
|
// The early-return guard means the query finished immediately (no
|
||||||
|
// satellites): the map page must now be free to navigate.
|
||||||
|
org.junit.Assert.assertFalse("query finished -> not calculating", s.isCalculating)
|
||||||
|
vm.consumePendingNavigation()
|
||||||
|
org.junit.Assert.assertFalse("consume clears pending navigation", vm.uiState.value.pendingNavigation)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun navDisplayEntryAfterPrefill_scrollsToTimeRange() {
|
||||||
|
// The Mutual screen composed inside a NavDisplay entry (back stack
|
||||||
|
// [Mutual]) right after prefillMatchFromGrid.
|
||||||
|
val vm = MutualViewModel(FakeSatelliteRepo(), FakeSettingsRepo())
|
||||||
|
vm.prefillMatchFromGrid("OL62")
|
||||||
|
composeRule.setContent {
|
||||||
|
val backStack = rememberNavBackStack(Screen.Mutual)
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
NavDisplay(
|
||||||
|
backStack = backStack,
|
||||||
|
onBack = { backStack.removeLastOrNull() },
|
||||||
|
entryProvider = entryProvider {
|
||||||
|
entry<Screen.Mutual> { MutualScreen(viewModel = vm) }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
composeRule.onNodeWithText("Time range").assertIsDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun navDisplay_switchToMutualEntry_scrollsToTimeRange() {
|
||||||
|
// Closest device path: start on the Map entry, then push the Mutual
|
||||||
|
// entry (what the map "Match" button does). NavDisplay runs a real
|
||||||
|
// fade transition while the Mutual screen composes.
|
||||||
|
val vm = MutualViewModel(FakeSatelliteRepo(), FakeSettingsRepo())
|
||||||
|
vm.prefillMatchFromGrid("OL62")
|
||||||
|
val backStackRef = mutableStateOf<NavBackStack<NavKey>?>(null)
|
||||||
|
composeRule.setContent {
|
||||||
|
val backStack = rememberNavBackStack(Screen.Map)
|
||||||
|
backStackRef.value = backStack
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
NavDisplay(
|
||||||
|
backStack = backStack,
|
||||||
|
onBack = { backStack.removeLastOrNull() },
|
||||||
|
entryProvider = entryProvider {
|
||||||
|
entry<Screen.Map> { Text("MAP PAGE") }
|
||||||
|
entry<Screen.Mutual> { MutualScreen(viewModel = vm) }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
// Push Mutual like onMatchGrid does, so the transition composes
|
||||||
|
// MutualScreen with scrollToTimeRange already set.
|
||||||
|
composeRule.runOnIdle { backStackRef.value?.add(Screen.Mutual) }
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
composeRule.onNodeWithText("Time range").assertIsDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun scrollRetriesUntilContentGrows() {
|
||||||
|
// Reproduces the real-device mechanism: the first frame's content
|
||||||
|
// (item 0 short) is shorter than the viewport, so scrollToItem(1) has
|
||||||
|
// no range and cannot move. Then the content grows (async results)
|
||||||
|
// past one screen; the retry loop must land on item 1.
|
||||||
|
composeRule.setContent {
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
val tall = mutableStateOf(false)
|
||||||
|
LaunchedEffect(Unit) { delay(300); tall.value = true }
|
||||||
|
val state = remember { LazyListState() }
|
||||||
|
LaunchedEffect(state) {
|
||||||
|
// Same retry loop MutualScreen uses for the prefill.
|
||||||
|
for (attempt in 0 until 20) {
|
||||||
|
state.scrollToItem(1)
|
||||||
|
if (state.firstVisibleItemIndex == 1) return@LaunchedEffect
|
||||||
|
delay(100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LazyColumn(state = state) {
|
||||||
|
item {
|
||||||
|
if (tall.value) Spacer(modifier = Modifier.height(900.dp))
|
||||||
|
else Spacer(modifier = Modifier.height(40.dp))
|
||||||
|
}
|
||||||
|
item { Text("target-item") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
composeRule.onNodeWithText("target-item").assertIsDisplayed()
|
||||||
|
// Confirm the list really scrolled (station card equivalent is gone).
|
||||||
|
// We can't read listState from here, so use the VM-style probe: none —
|
||||||
|
// the target visible + viewport tall enough implies item 1 on top.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun keepPositionAcrossTabs_thenMapMatchPrefill_scrollsToTimeRange() {
|
||||||
|
// User hypothesis: the "keep scroll position across tab switches"
|
||||||
|
// machinery (listState remember(queryGeneration) + snapshotFlow
|
||||||
|
// write-back) interferes with the prefill auto-scroll. Reproduce the
|
||||||
|
// full journey: first visit -> scroll a bit -> leave -> return
|
||||||
|
// (position restored) -> leave -> enter via map Match button.
|
||||||
|
val vm = MutualViewModel(FakeSatelliteRepo(), FakeSettingsRepo())
|
||||||
|
val showMutual = mutableStateOf(true)
|
||||||
|
|
||||||
|
// First visit (e.g. bottom nav), user scrolls a little; the
|
||||||
|
// snapshotFlow write-back stored index/offset in the VM.
|
||||||
|
composeRule.setContent {
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
if (showMutual.value) MutualScreen(viewModel = vm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
vm.listScrollIndex = 0
|
||||||
|
vm.listScrollOffset = 40
|
||||||
|
|
||||||
|
// Leave the page (tab switch destroys the composition).
|
||||||
|
showMutual.value = false
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
|
||||||
|
// Re-enter: keep-position restores the scroll offset.
|
||||||
|
showMutual.value = true
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
|
||||||
|
// Leave again, then enter via the map grid-QSO Match button.
|
||||||
|
showMutual.value = false
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
vm.prefillMatchFromGrid("OL62")
|
||||||
|
showMutual.value = true
|
||||||
|
composeRule.waitForIdle()
|
||||||
|
|
||||||
|
composeRule.onNodeWithText("Time range").assertIsDisplayed()
|
||||||
|
}
|
||||||
|
}
|
||||||
+35
@@ -285,4 +285,39 @@ class MutualViewModelTest {
|
|||||||
|
|
||||||
assertNull(vm.uiState.value.errorMessage)
|
assertNull(vm.uiState.value.errorMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `requery keeps scroll position and stale results while running`() = runTest(mainDispatcherRule.dispatcher.scheduler) {
|
||||||
|
val windows = TestOrbits.findPassWindows()
|
||||||
|
assertTrue("fixture must produce ISS windows", windows.isNotEmpty())
|
||||||
|
val vm = createVm(
|
||||||
|
satellites = listOf(TestOrbits.ISS),
|
||||||
|
passes = windows
|
||||||
|
)
|
||||||
|
vm.onStationBGrid("OL62")
|
||||||
|
queryAndSettle(vm)
|
||||||
|
assertTrue("fixture must yield passes", vm.uiState.value.mutualPasses.isNotEmpty())
|
||||||
|
|
||||||
|
// The user scrolled into the results; the snapshotFlow write-back has
|
||||||
|
// stored this position in the VM.
|
||||||
|
vm.listScrollIndex = 4
|
||||||
|
vm.listScrollOffset = 137
|
||||||
|
|
||||||
|
// Re-run the query from the match page ("query" button).
|
||||||
|
vm.queryMutualPasses()
|
||||||
|
|
||||||
|
// While the query runs, the old results stay on screen (the list keeps
|
||||||
|
// its height, so the scroll position is not clamped away)...
|
||||||
|
assertTrue("stale results kept while calculating", vm.uiState.value.mutualPasses.isNotEmpty())
|
||||||
|
// ...and the scroll position must not be reset to the top.
|
||||||
|
assertEquals(4, vm.listScrollIndex)
|
||||||
|
assertEquals(137, vm.listScrollOffset)
|
||||||
|
|
||||||
|
advanceUntilIdle()
|
||||||
|
assertFalse(vm.uiState.value.isCalculating)
|
||||||
|
assertTrue("fresh results replace the stale ones", vm.uiState.value.mutualPasses.isNotEmpty())
|
||||||
|
// Position intact after the query settled.
|
||||||
|
assertEquals(4, vm.listScrollIndex)
|
||||||
|
assertEquals(137, vm.listScrollOffset)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -30,12 +30,15 @@ import androidx.compose.foundation.layout.Row
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.grid.GridCells
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.ElevatedCard
|
import androidx.compose.material3.ElevatedCard
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
@@ -145,11 +148,16 @@ private fun PassesScreen(
|
|||||||
onAccept = dismiss,
|
onAccept = dismiss,
|
||||||
titleFontSize = 18
|
titleFontSize = 18
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
// The changelog is long; keep the dialog frame fixed and let the
|
||||||
|
// text scroll inside it (matches the update-checker page pattern).
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.pass_whatsnew_message),
|
text = stringResource(R.string.pass_whatsnew_message),
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
modifier = Modifier.padding(horizontal = padding)
|
modifier = Modifier
|
||||||
|
.padding(horizontal = padding)
|
||||||
|
.heightIn(max = 360.dp)
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[versions]
|
[versions]
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
appVersionCode = "486"
|
appVersionCode = "493"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
appVersionName = "4.4.7-ba7opf.12"
|
appVersionName = "4.4.7-ba7opf.13"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
compileSdk = "37"
|
compileSdk = "37"
|
||||||
#noinspection UnusedVersionCatalogEntry
|
#noinspection UnusedVersionCatalogEntry
|
||||||
@@ -33,6 +33,8 @@ other-okhttp = "5.4.0"
|
|||||||
other-osmdroid = "6.1.20"
|
other-osmdroid = "6.1.20"
|
||||||
|
|
||||||
test-junit4 = "4.13.2"
|
test-junit4 = "4.13.2"
|
||||||
|
robolectric = "4.16"
|
||||||
|
androidx-test-core = "1.7.0"
|
||||||
|
|
||||||
androidTest-junit = "1.3.0"
|
androidTest-junit = "1.3.0"
|
||||||
androidTest-espresso = "3.7.0"
|
androidTest-espresso = "3.7.0"
|
||||||
@@ -79,6 +81,9 @@ other-osmdroid = { module = "org.osmdroid:osmdroid-android", version.ref = "othe
|
|||||||
|
|
||||||
test-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlin-coroutines" }
|
test-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlin-coroutines" }
|
||||||
test-junit4 = { module = "junit:junit", version.ref = "test-junit4" }
|
test-junit4 = { module = "junit:junit", version.ref = "test-junit4" }
|
||||||
|
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
|
||||||
|
androidx-test-core = { module = "androidx.test:core-ktx", version.ref = "androidx-test-core" }
|
||||||
|
compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||||
# Real org.json for unit tests (android.jar stub throws "not mocked")
|
# Real org.json for unit tests (android.jar stub throws "not mocked")
|
||||||
test-json = { module = "org.json:json", version = "20240303" }
|
test-json = { module = "org.json:json", version = "20240303" }
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user