Skip to content

Comments

Fix Live Activity silent start, token upsert, and stale token deletion bug#133

Merged
JulianKahnert merged 1 commit intodevelopfrom
feature/live-activity-and-token-fixes
Feb 19, 2026
Merged

Fix Live Activity silent start, token upsert, and stale token deletion bug#133
JulianKahnert merged 1 commit intodevelopfrom
feature/live-activity-and-token-fixes

Conversation

@JulianKahnert
Copy link
Owner

Summary

  • Live Activity silent start: APNSStartLiveActivityNotification wird jetzt mit leerem APNSAlertNotificationContent() gesendet – kein Banner beim Starten der Live Activity. Der eigentliche Alert kommt erst nach maxOpenDuration via sendNotification.
  • Stale token deletion bug fix: Invertierter Filter (.filter(\.$id != tokenId)) hat ALLE anderen Tokens gelöscht statt nur den alten Token. Korrigiert auf .filter(\.$id == tokenId).
  • Token upsert: OpenAPIController nutzt jetzt ein Upsert-Pattern (update wenn vorhanden, sonst insert) statt delete+insert für Device Tokens – robuster gegen Race Conditions.
  • FlowKitAdapter task restart: .onChange(of: serverAddress) + .task ersetzt durch .task(id: serverAddress), sodass der Runloop automatisch bei Server-Adressänderung neu startet.

Test plan

  • Fenster öffnen → Live Activity startet ohne Notification-Banner
  • Fenster bleibt offen > maxOpenDuration → Alert-Notification wird gesendet
  • Fenster schließen vor Ablauf → Live Activity endet, kein Alert
  • Token-Registrierung bei wiederholtem App-Start erzeugt keinen doppelten DB-Eintrag
  • Server-Adresse in FlowKitAdapter ändern → Verbindung wird neu aufgebaut

…n bug

- PushNotificationService: start Live Activity silently (no banner) by
  sending APNSStartLiveActivityNotification with empty alert content;
  alert is only triggered after maxOpenDuration via sendNotification
- PushNotificationService: fix inverted filter that deleted all tokens
  instead of just the specific stale liveActivityUpdate token
- OpenAPIController: replace delete+insert with upsert pattern for
  device tokens to avoid race conditions and duplicate entries
- FlowKitAdapter: replace .onChange(of: serverAddress) + .task with
  .task(id: serverAddress) so runloop restarts automatically on address change
@JulianKahnert JulianKahnert merged commit 3a16d8d into develop Feb 19, 2026
4 checks passed
@JulianKahnert JulianKahnert deleted the feature/live-activity-and-token-fixes branch February 19, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant