Persist lookup data to disk and refresh on app foreground

- DataManager now persists lookup data (residence types, task categories,
  priorities, statuses, specialties, templates) to disk
- Loads cached lookups on app startup for faster launch
- iOS: Refresh lookups when app becomes active, refresh widget on background
- Android: Initialize DataManager in onCreate, already had onResume refresh
- Only send ETag if lookup data is actually in memory to avoid 304 with no data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-06 11:29:14 -06:00
parent a91efd5de2
commit 04c3389e4d
4 changed files with 145 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import SwiftUI
import ComposeApp
import WidgetKit
@main
struct iOSApp: App {
@@ -44,6 +45,14 @@ struct iOSApp: App {
if newPhase == .active {
// Check and register device token when app becomes active
PushNotificationManager.shared.checkAndRegisterDeviceIfNeeded()
// Refresh lookups/static data when app becomes active
Task {
_ = try? await APILayer.shared.initializeLookups()
}
} else if newPhase == .background {
// Refresh widget when app goes to background
WidgetCenter.shared.reloadAllTimelines()
}
}
// Import confirmation dialog