forked from vhaudiquet/rhema-claw
fix(android): refresh the phone's own row when it reports
The fleet card reads last-seen from the claw, and only a landed report moves it. Periodic work is deferred while the device idles — Doze stretches the fifteen-minute floor to hours — so a phone sitting in the human's hand could show itself as "last seen 3h ago" with nothing wrong on the claw. Kick a status run on resume, the same way the commands worker already is, and reload the fleet whenever a run lands. The landed-run signal is a new clock in StatusRepository, written in the same edit that saves the snapshot (which only happens once every post of the run succeeded), so the card reloads on a report that actually reached the claw.
This commit is contained in:
1 parent
4a91635730
commit
385788c935
4 files changed
+39
-5
No files matched your search
@@ -58,6 +58,11 @@ fun PhonesCard(container: AppContainer) {
|
||||
var forgetCandidate by remember { mutableStateOf<PhoneInfo?>(null) }
|
||||
var forgotName by remember { mutableStateOf<String?>(null) }
|
||||
val deviceId by container.settings.deviceIdFlow.collectAsState(initial = "")
|
||||
// The last run that landed every post. The fleet is read from the claw,
|
||||
// so this device's last-seen only moves when a report has actually
|
||||
// reached it; reloading on this flow keeps the phone from calling
|
||||
// itself hours stale while it is in hand.
|
||||
val lastReportAt by container.status.lastReportAt.collectAsState(initial = 0L)
|
||||
|
||||
fun load() {
|
||||
scope.launch {
|
||||
@@ -73,7 +78,9 @@ fun PhonesCard(container: AppContainer) {
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) { load() }
|
||||
// First paint loads the fleet as-is; every landed status run reloads it,
|
||||
// so the row this phone reads about itself carries the new last-seen.
|
||||
LaunchedEffect(lastReportAt) { load() }
|
||||
|
||||
RhemaCard(title = stringResource(R.string.card_phones), meta = stringResource(R.string.phones_hint)) {
|
||||
Column(
|
||||
|
||||
Reference in new issue
Block a user