From 21d57ecab1156d4cf362d08617d18d2f034822cf Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Tue, 19 Mar 2024 14:44:49 +0100 Subject: [PATCH] Add mock samples tab --- HealthImport.xcodeproj/project.pbxproj | 6 ++++ HealthImport/HealthImportApp.swift | 3 ++ .../Support/HKWorkoutActivityType+Icon.swift | 2 +- HealthImport/Tabs/SamplesTab.swift | 35 +++++++++++++++++++ HealthImport/WorkoutDetailView.swift | 1 + 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 HealthImport/Tabs/SamplesTab.swift diff --git a/HealthImport.xcodeproj/project.pbxproj b/HealthImport.xcodeproj/project.pbxproj index 27b3e47..5af7657 100644 --- a/HealthImport.xcodeproj/project.pbxproj +++ b/HealthImport.xcodeproj/project.pbxproj @@ -58,6 +58,7 @@ E2E552B52BA9A5D200BF5E9B /* WorkoutListRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552B42BA9A5D200BF5E9B /* WorkoutListRow.swift */; }; E2E552B72BA9A69400BF5E9B /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552B62BA9A69400BF5E9B /* Color+Extensions.swift */; }; E2E552B92BA9A77D00BF5E9B /* HKWorkoutActivityType+Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552B82BA9A77D00BF5E9B /* HKWorkoutActivityType+Icon.swift */; }; + E2E552BB2BA9CAAE00BF5E9B /* SamplesTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552BA2BA9CAAE00BF5E9B /* SamplesTab.swift */; }; E2FDFF202B6BE34C0080A7B3 /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = E2FDFF1F2B6BE34C0080A7B3 /* SwiftProtobuf */; }; E2FDFF292B6D10D60080A7B3 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FDFF282B6D10D60080A7B3 /* String+Extensions.swift */; }; /* End PBXBuildFile section */ @@ -109,6 +110,7 @@ E2E552B42BA9A5D200BF5E9B /* WorkoutListRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutListRow.swift; sourceTree = ""; }; E2E552B62BA9A69400BF5E9B /* Color+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extensions.swift"; sourceTree = ""; }; E2E552B82BA9A77D00BF5E9B /* HKWorkoutActivityType+Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HKWorkoutActivityType+Icon.swift"; sourceTree = ""; }; + E2E552BA2BA9CAAE00BF5E9B /* SamplesTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SamplesTab.swift; sourceTree = ""; }; E2FDFF282B6D10D60080A7B3 /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = ""; }; E2FDFF342B6E59030080A7B3 /* HealthImport.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HealthImport.entitlements; sourceTree = ""; }; /* End PBXFileReference section */ @@ -223,6 +225,7 @@ isa = PBXGroup; children = ( E2E552882BA2194400BF5E9B /* DatabasesTab.swift */, + E2E552BA2BA9CAAE00BF5E9B /* SamplesTab.swift */, 8850025C2B5C273C00E7D4DB /* WorkoutTab.swift */, ); path = Tabs; @@ -364,6 +367,7 @@ 885002932B5D129300E7D4DB /* ActivityDetailView.swift in Sources */, E2E552A32BA4B58F00BF5E9B /* HeartRateGraph.swift in Sources */, E2E552AF2BA98BCF00BF5E9B /* WorkoutMapView.swift in Sources */, + E2E552BB2BA9CAAE00BF5E9B /* SamplesTab.swift in Sources */, E27BC6962B5FD61D003A8873 /* WorkoutEvent+Mock.swift in Sources */, E2E5529B2BA3935600BF5E9B /* HKWorkout+Extensions.swift in Sources */, E27BC6802B5E74D7003A8873 /* LocationSampleListView.swift in Sources */, @@ -537,6 +541,7 @@ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportsDocumentBrowser = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -573,6 +578,7 @@ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportsDocumentBrowser = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/HealthImport/HealthImportApp.swift b/HealthImport/HealthImportApp.swift index 0dbc3b2..5b6997a 100644 --- a/HealthImport/HealthImportApp.swift +++ b/HealthImport/HealthImportApp.swift @@ -56,6 +56,9 @@ struct HealthImportApp: App { .environmentObject(database) .tabItem { Label("Workouts", systemSymbol: .figureRun) } .tag(TabSelection.workouts) + SamplesTab(database: database) + .tabItem { Label("Health", systemSymbol: .heartFill) } + .tag(TabSelection.samples) DatabasesTab(database: database, databases: databaseList) .tabItem {Label("Databases", systemSymbol: .archivebox) } .tag(TabSelection.databases) diff --git a/HealthImport/Support/HKWorkoutActivityType+Icon.swift b/HealthImport/Support/HKWorkoutActivityType+Icon.swift index d0d84b2..f455622 100644 --- a/HealthImport/Support/HKWorkoutActivityType+Icon.swift +++ b/HealthImport/Support/HKWorkoutActivityType+Icon.swift @@ -67,7 +67,7 @@ extension HKWorkoutActivityType { case .mixedMetabolicCardioTraining: return .figureMixedCardio case .paddleSports: - return .heart + return .oar2Crossed case .play: return .figurePlay case .preparationAndRecovery: diff --git a/HealthImport/Tabs/SamplesTab.swift b/HealthImport/Tabs/SamplesTab.swift new file mode 100644 index 0000000..79b6055 --- /dev/null +++ b/HealthImport/Tabs/SamplesTab.swift @@ -0,0 +1,35 @@ +import SwiftUI + +struct SamplesTab: View { + + @ObservedObject + var database: Database + + var body: some View { + NavigationStack { + List { + Label("Activity", systemSymbol: .flame) + Label("Body Measurements", systemSymbol: .figure) + Label("Cycle Tracking", systemSymbol: .circleHexagonpath) + Label("Hearing", systemSymbol: .ear) + Label("Heart", systemSymbol: .heartFill) + Label("Medications", systemSymbol: .pills) + Label("Mental Wellbeing", systemSymbol: .brainHeadProfile) + Label("Mobility", systemSymbol: .arrowLeftAndRight) + Label("Nutrition", systemSymbol: .carrot) + Label("Respiratory", systemSymbol: .lungs) + Label("Sleep", systemSymbol: .bedDouble) + Label("Symptoms", systemSymbol: .listBulletClipboard) + Label("Vitals", systemSymbol: .waveformPathEcgRectangle) + Label("Other Data", systemSymbol: .cross) + + } + .navigationTitle("Health") + } + } +} + +#Preview { + SamplesTab(database: Database()) + .preferredColorScheme(.dark) +} diff --git a/HealthImport/WorkoutDetailView.swift b/HealthImport/WorkoutDetailView.swift index 86974bd..ad4da05 100644 --- a/HealthImport/WorkoutDetailView.swift +++ b/HealthImport/WorkoutDetailView.swift @@ -67,6 +67,7 @@ struct WorkoutDetailView: View { if isProcessingWorkout { ProgressView() .progressViewStyle(.circular) + .padding(.trailing, 10) Text("Adding workout to health...") .foregroundStyle(.accent) } else {