Fix merge re-adding deleted/cancelled events and timer sync

- Track removed events via removedSinceLoad set in Logbook to prevent
  merge from re-adding deliberately deleted or cancelled events
- Deduplicate finalized timer events (same type + similar start time)
  to prevent duplicates when both devices stop the same timer
- Detect timer cancellation from other device: dismiss local timer
  dialog when ongoing event disappears from logbook after sync
- Fix thread safety: take snapshot of events before background merge

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 18:30:50 +01:00
parent 235a355a05
commit c0e0ec8f51
4 changed files with 123 additions and 35 deletions

View File

@@ -5,6 +5,7 @@ class Logbook(val name: String) {
const val MAX_SAFE_LOGBOOK_SIZE = 30000
}
val logs = ArrayList<LunaEvent>()
val removedSinceLoad = mutableSetOf<String>()
fun isTooBig(): Boolean {
return logs.size > MAX_SAFE_LOGBOOK_SIZE