Add cross-device timer sync via WebDAV

When a sleep or breastfeeding timer is started, an "ongoing" event is
immediately saved to the logbook and synced via WebDAV. Other devices
detect this event on sync and can display/stop the timer. This allows
partners to stop timers started on another device.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 17:36:13 +01:00
parent 0776e4d6c2
commit 81473f8f9f
8 changed files with 227 additions and 18 deletions

View File

@@ -79,14 +79,14 @@ class StatisticsCalculator(private val events: List<LunaEvent>) {
}
private fun getEventsInRange(startUnix: Long, endUnix: Long): List<LunaEvent> {
return events.filter { it.time >= startUnix && it.time < endUnix }
return events.filter { it.time >= startUnix && it.time < endUnix && !it.ongoing }
}
private fun getEventsForDays(days: Int): List<LunaEvent> {
val now = System.currentTimeMillis() / 1000
val startOfToday = getStartOfDay(now)
val startTime = startOfToday - (days - 1) * 24 * 60 * 60
return events.filter { it.time >= startTime }
return events.filter { it.time >= startTime && !it.ongoing }
}
/**