From b48e23804fb9dbc74342901da36cc9ca8b5f8399 Mon Sep 17 00:00:00 2001 From: atsunatsu Date: Tue, 29 Sep 2026 17:58:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(radar):=20=E7=94=9F=E6=88=90=E9=80=9A?= =?UTF-8?q?=E8=81=94=E8=AE=B0=E5=BD=95=E5=B8=96=E5=AD=90=E5=8F=AA=E5=90=AB?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E8=BF=87=E5=A2=83=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit generatePost 的筛选从最近 24 小时改为当前过境窗口(aos..los), 与日志列表 recent 同一套过滤逻辑,不再混入其他过境的 QSO --- .../java/com/rtbishop/look4sat/feature/radar/LogPage.kt | 2 +- .../com/rtbishop/look4sat/feature/radar/LogViewModel.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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)