b953908f58
Complete implementation of a SwiftUI iOS app that serves as a "Single Source of Truth" for health data. The app reads from all Apple Health sources, detects conflicts between devices, merges data using configurable strategies, and writes cleaned data back. Features: - Phase 1: HealthKit integration with automatic source discovery - Phase 2: DataReader with conflict detection (time-window based) - Phase 3: RuleEngine with 8 merge strategies (exclusive, priority, higher wins, etc.) - Phase 4: MergeEngine for conflict resolution + DataWriter for HealthKit writes - Phase 5: SwiftUI UI for dashboard, conflicts, rules, and sources management - Phase 6: Background sync with configurable intervals and push notifications - Phase 7: Complete rule editor and polished UI components Supported data types: - Steps, Heart Rate, Blood Pressure, SpO2, Sleep - Distance, Floors Climbed, Active Energy, HRV, Respiratory Rate Architecture: SourceManager -> DataReader -> RuleEngine -> MergeEngine -> DataWriter
43 lines
1.2 KiB
Swift
43 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@EnvironmentObject var appState: AppState
|
|
@EnvironmentObject var syncCoordinator: SyncCoordinator
|
|
|
|
var body: some View {
|
|
TabView(selection: $appState.selectedTab) {
|
|
DashboardView()
|
|
.tabItem {
|
|
Label("Dashboard", systemImage: "chart.bar.fill")
|
|
}
|
|
.tag(AppState.Tab.dashboard)
|
|
|
|
ConflictsView()
|
|
.tabItem {
|
|
Label("Konflikte", systemImage: "arrow.triangle.2.circlepath")
|
|
}
|
|
.tag(AppState.Tab.conflicts)
|
|
.badge(syncCoordinator.pendingConflicts.count)
|
|
|
|
RulesView()
|
|
.tabItem {
|
|
Label("Regeln", systemImage: "slider.horizontal.3")
|
|
}
|
|
.tag(AppState.Tab.rules)
|
|
|
|
SourcesView()
|
|
.tabItem {
|
|
Label("Quellen", systemImage: "antenna.radiowaves.left.and.right")
|
|
}
|
|
.tag(AppState.Tab.sources)
|
|
}
|
|
.tint(.blue)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ContentView()
|
|
.environmentObject(AppState())
|
|
.environmentObject(SyncCoordinator.shared)
|
|
}
|