diff --git a/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogPage.kt b/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogPage.kt index d226024f..b64096f8 100644 --- a/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogPage.kt +++ b/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogPage.kt @@ -178,7 +178,7 @@ fun LogPage( Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth()) { OutlinedButton( - onClick = { logViewModel.generatePost(satName, maxElev) }, + onClick = { logViewModel.generatePost(satName, maxElev, passWindow) }, enabled = recent.isNotEmpty(), modifier = Modifier.weight(1f) ) { Text("生成通联记录", fontSize = 13.sp) } diff --git a/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogViewModel.kt b/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogViewModel.kt index e318d0fc..93e6d03e 100644 --- a/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogViewModel.kt +++ b/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogViewModel.kt @@ -142,16 +142,16 @@ class LogViewModel( */ fun updateRecord(record: QsoRecord) = viewModelScope.launch { qsoRepository.save(record) } - /** English social post from the recorded QSOs of the current satellite (last 24h). */ - fun generatePost(satName: String, maxElev: Double) { + /** English social post from the recorded QSOs of the current satellite. + * Same window logic as the on-screen list: only the current pass (aos..los). */ + fun generatePost(satName: String, maxElev: Double, passWindow: ClosedRange?) { viewModelScope.launch { - val now = System.currentTimeMillis() // Records carry the ARRL name while the pass carries the tracker's name, so the // operator's own contacts are collected by identity, not by the raw name. val identity = satelliteIdentity(satName) val list = qsoRepository.records.first() .filter { satelliteIdentity(it.satelliteName) == identity } - .filter { it.startUtcMillis > now - 24 * 3_600_000L } + .filter { passWindow?.contains(it.startUtcMillis) == true } .sortedBy { it.startUtcMillis } if (list.isEmpty()) return@launch val shortName = officialSatelliteName(satName).substringBefore('(').trim().uppercase(Locale.US)