Skip to content

Commit

Permalink
Update Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
PSchmiedmayer committed Mar 1, 2024
1 parent f711011 commit 4a87abd
Show file tree
Hide file tree
Showing 43 changed files with 414 additions and 1,001 deletions.
19 changes: 11 additions & 8 deletions OwnYourData.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
2F42EA052B91C24700D88DB7 /* ExportPackage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F42EA022B91C24700D88DB7 /* ExportPackage.swift */; };
2F42EA062B91C24700D88DB7 /* ShareFHIRButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F42EA032B91C24700D88DB7 /* ShareFHIRButton.swift */; };
2F42EA072B91C24700D88DB7 /* URL+Zip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F42EA042B91C24700D88DB7 /* URL+Zip.swift */; };
2F42EA0E2B91CD7100D88DB7 /* OpenAIAPIKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F42EA0D2B91CD7100D88DB7 /* OpenAIAPIKey.swift */; };
2F42EA112B91CF6F00D88DB7 /* ResourceSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F42EA102B91CF6F00D88DB7 /* ResourceSelection.swift */; };
2F49B7762980407C00BCB272 /* Spezi in Frameworks */ = {isa = PBXBuildFile; productRef = 2F49B7752980407B00BCB272 /* Spezi */; };
2F4E237E2989A2FE0013F3D9 /* OnboardingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4E237D2989A2FE0013F3D9 /* OnboardingTests.swift */; };
2F4E23832989D51F0013F3D9 /* OwnYourDataTestingSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4E23822989D51F0013F3D9 /* OwnYourDataTestingSetup.swift */; };
Expand All @@ -49,8 +51,6 @@
2FB099B12A875DF100B20952 /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = 2FB099B02A875DF100B20952 /* FirebaseFirestore */; };
2FB099B32A875DF100B20952 /* FirebaseFirestoreSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 2FB099B22A875DF100B20952 /* FirebaseFirestoreSwift */; };
2FB099B62A875E2B00B20952 /* HealthKitOnFHIR in Frameworks */ = {isa = PBXBuildFile; productRef = 2FB099B52A875E2B00B20952 /* HealthKitOnFHIR */; };
2FC3439029EE6346002D773C /* SocialSupportQuestionnaire.json in Resources */ = {isa = PBXBuildFile; fileRef = 2FE5DC5529EDD811004B9AB4 /* SocialSupportQuestionnaire.json */; };
2FC3439129EE6349002D773C /* AppIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 2FE5DC2A29EDD78D004B9AB4 /* AppIcon.png */; };
2FC3439229EE634B002D773C /* ConsentDocument.md in Resources */ = {isa = PBXBuildFile; fileRef = 2FE5DC2C29EDD78E004B9AB4 /* ConsentDocument.md */; };
2FC975A82978F11A00BA99FE /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FC975A72978F11A00BA99FE /* Home.swift */; };
2FE5DC3529EDD7CA004B9AB4 /* Consent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FE5DC2F29EDD7CA004B9AB4 /* Consent.swift */; };
Expand Down Expand Up @@ -138,6 +138,8 @@
2F42EA022B91C24700D88DB7 /* ExportPackage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExportPackage.swift; sourceTree = "<group>"; };
2F42EA032B91C24700D88DB7 /* ShareFHIRButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShareFHIRButton.swift; sourceTree = "<group>"; };
2F42EA042B91C24700D88DB7 /* URL+Zip.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "URL+Zip.swift"; sourceTree = "<group>"; };
2F42EA0D2B91CD7100D88DB7 /* OpenAIAPIKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenAIAPIKey.swift; sourceTree = "<group>"; };
2F42EA102B91CF6F00D88DB7 /* ResourceSelection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResourceSelection.swift; sourceTree = "<group>"; };
2F4E237D2989A2FE0013F3D9 /* OnboardingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTests.swift; sourceTree = "<group>"; };
2F4E23822989D51F0013F3D9 /* OwnYourDataTestingSetup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OwnYourDataTestingSetup.swift; sourceTree = "<group>"; };
2F4E23862989DB360013F3D9 /* ContactsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsTests.swift; sourceTree = "<group>"; };
Expand All @@ -147,7 +149,6 @@
2FAEC07F297F583900C11C42 /* OwnYourData.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OwnYourData.entitlements; sourceTree = "<group>"; };
2FC94CD4298B0A1D009C8209 /* OwnYourData.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = OwnYourData.xctestplan; sourceTree = "<group>"; };
2FC975A72978F11A00BA99FE /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = "<group>"; };
2FE5DC2A29EDD78D004B9AB4 /* AppIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AppIcon.png; sourceTree = "<group>"; };
2FE5DC2C29EDD78E004B9AB4 /* ConsentDocument.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = ConsentDocument.md; sourceTree = "<group>"; };
2FE5DC2F29EDD7CA004B9AB4 /* Consent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Consent.swift; sourceTree = "<group>"; };
2FE5DC3029EDD7CA004B9AB4 /* HealthKitPermissions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HealthKitPermissions.swift; sourceTree = "<group>"; };
Expand All @@ -159,7 +160,6 @@
2FE5DC4229EDD7F2004B9AB4 /* Binding+Negate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Binding+Negate.swift"; sourceTree = "<group>"; };
2FE5DC4329EDD7F2004B9AB4 /* Bundle+Image.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Bundle+Image.swift"; sourceTree = "<group>"; };
2FE5DC4429EDD7F2004B9AB4 /* CodableArray+RawRepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CodableArray+RawRepresentable.swift"; sourceTree = "<group>"; };
2FE5DC5529EDD811004B9AB4 /* SocialSupportQuestionnaire.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = SocialSupportQuestionnaire.json; sourceTree = "<group>"; };
2FE5DCAC29EE6107004B9AB4 /* AccountOnboarding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountOnboarding.swift; sourceTree = "<group>"; };
2FF53D8C2A8729D600042B76 /* OwnYourDataStandard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OwnYourDataStandard.swift; sourceTree = "<group>"; };
566155282AB8447C00209B80 /* Package+LicenseType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Package+LicenseType.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -308,6 +308,7 @@
2FE5DC3429EDD7CA004B9AB4 /* Welcome.swift */,
2FE5DC3229EDD7CA004B9AB4 /* InterestingModules.swift */,
2FE5DCAC29EE6107004B9AB4 /* AccountOnboarding.swift */,
2F42EA0D2B91CD7100D88DB7 /* OpenAIAPIKey.swift */,
2FE5DC2F29EDD7CA004B9AB4 /* Consent.swift */,
2FE5DC3029EDD7CA004B9AB4 /* HealthKitPermissions.swift */,
);
Expand All @@ -320,8 +321,6 @@
653A255428338800005D4D48 /* Assets.xcassets */,
2FA0BFEC2ACC977500E0EF83 /* Localizable.xcstrings */,
2FE5DC2C29EDD78E004B9AB4 /* ConsentDocument.md */,
2FE5DC2A29EDD78D004B9AB4 /* AppIcon.png */,
2FE5DC5529EDD811004B9AB4 /* SocialSupportQuestionnaire.json */,
);
path = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -435,6 +434,7 @@
A9FE7ACF2AA39BAB0077B045 /* AccountSheet.swift */,
A9720E422ABB68CC00872D23 /* AccountSetupHeader.swift */,
A9DFE8A82ABE551400428242 /* AccountButton.swift */,
2F42EA102B91CF6F00D88DB7 /* ResourceSelection.swift */,
);
path = Account;
sourceTree = "<group>";
Expand Down Expand Up @@ -594,9 +594,7 @@
buildActionMask = 2147483647;
files = (
2FC3439229EE634B002D773C /* ConsentDocument.md in Resources */,
2FC3439129EE6349002D773C /* AppIcon.png in Resources */,
653A255528338800005D4D48 /* Assets.xcassets in Resources */,
2FC3439029EE6346002D773C /* SocialSupportQuestionnaire.json in Resources */,
2FA0BFED2ACC977500E0EF83 /* Localizable.xcstrings in Resources */,
2F6025CB29BBE70F0045459E /* GoogleService-Info.plist in Resources */,
);
Expand Down Expand Up @@ -653,6 +651,7 @@
2F42E9DE2B91BB2500D88DB7 /* PDFView.swift in Sources */,
2FE5DC3829EDD7CA004B9AB4 /* InterestingModules.swift in Sources */,
2F42E9F42B91BBF300D88DB7 /* Instructions.swift in Sources */,
2F42EA112B91CF6F00D88DB7 /* ResourceSelection.swift in Sources */,
2F42EA052B91C24700D88DB7 /* ExportPackage.swift in Sources */,
2F42E9E72B91BB8300D88DB7 /* WebView.swift in Sources */,
2FE5DC3529EDD7CA004B9AB4 /* Consent.swift in Sources */,
Expand Down Expand Up @@ -688,6 +687,7 @@
2F42EA062B91C24700D88DB7 /* ShareFHIRButton.swift in Sources */,
A9FE7AD02AA39BAB0077B045 /* AccountSheet.swift in Sources */,
653A2551283387FE005D4D48 /* OwnYourData.swift in Sources */,
2F42EA0E2B91CD7100D88DB7 /* OpenAIAPIKey.swift in Sources */,
2FE5DC3629EDD7CA004B9AB4 /* HealthKitPermissions.swift in Sources */,
5661552E2AB854C000209B80 /* PackageHelper.swift in Sources */,
2F42E9FF2B91BE3100D88DB7 /* FHIRStore+Extensions.swift in Sources */,
Expand Down Expand Up @@ -812,6 +812,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "OwnYourData/Supporting Files/Info.plist";
INFOPLIST_KEY_NSCameraUsageDescription = "This message should never appear. Please adjust this when you start using camera information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSHealthClinicalHealthRecordsShareUsageDescription = "The OwnYourData app needs access to your health records to display them in the application.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The OwnYourData uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The OwnYourData uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "This message should never appear. Please adjust this when you start using location information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
Expand Down Expand Up @@ -1014,6 +1015,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "OwnYourData/Supporting Files/Info.plist";
INFOPLIST_KEY_NSCameraUsageDescription = "This message should never appear. Please adjust this when you start using camera information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSHealthClinicalHealthRecordsShareUsageDescription = "The OwnYourData app needs access to your health records to display them in the application.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The OwnYourData uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The OwnYourData uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "This message should never appear. Please adjust this when you start using location information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
Expand Down Expand Up @@ -1061,6 +1063,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "OwnYourData/Supporting Files/Info.plist";
INFOPLIST_KEY_NSCameraUsageDescription = "This message should never appear. Please adjust this when you start using camera information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
INFOPLIST_KEY_NSHealthClinicalHealthRecordsShareUsageDescription = "The OwnYourData app needs access to your health records to display them in the application.";
INFOPLIST_KEY_NSHealthShareUsageDescription = "The OwnYourData uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSHealthUpdateUsageDescription = "The OwnYourData uses the step count to demonstrate Spezi's integration with HealthKit.";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "This message should never appear. Please adjust this when you start using location information. We have to put this in here as ResearchKit has the possibility to use it and not putting it here returns an error on AppStore Connect.";
Expand Down
2 changes: 1 addition & 1 deletion OwnYourData/Account/AccountButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct AccountButton: View {
}) {
Image(systemName: "person.crop.circle")
}
.accessibilityLabel("ACCOUNT_TITLE")
.accessibilityLabel("Your Account")
}


Expand Down
6 changes: 3 additions & 3 deletions OwnYourData/Account/AccountSetupHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ struct AccountSetupHeader: View {

var body: some View {
VStack {
Text("ACCOUNT_TITLE")
Text("Your Account")
.font(.largeTitle)
.bold()
.padding(.bottom)
.padding(.top, 30)
Text("ACCOUNT_SUBTITLE")
.padding(.bottom, 8)
if account.signedIn, case .generic = setupState {
Text("ACCOUNT_SIGNED_IN_DESCRIPTION")
Text("You signed in with the following account:")
} else {
Text("ACCOUNT_SETUP_DESCRIPTION")
Text("We respect your privacy. All data storage and sharing happens directly from your phone.")
}
}
.multilineTextAlignment(.center)
Expand Down
27 changes: 19 additions & 8 deletions OwnYourData/Account/AccountSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ struct AccountSheet: View {
ZStack {
if account.signedIn && !isInSetup {
AccountOverview(isEditing: $overviewIsEditing) {
NavigationLink {
ContributionsList()
} label: {
Text("LICENSE_INFO_TITLE")
}
ShareFHIRButton()
additionalSections
}
.onDisappear {
overviewIsEditing = false
Expand Down Expand Up @@ -59,13 +54,29 @@ struct AccountSheet: View {
}
}

var closeButton: some ToolbarContent {
private var closeButton: some ToolbarContent {
ToolbarItem(placement: .cancellationAction) {
Button("CLOSE") {
Button("Close") {
dismiss()
}
}
}

@ViewBuilder private var additionalSections: some View {
Section("License Information") {
NavigationLink {
ContributionsList()
} label: {
Text("License Information")
}
}
Section("Resource Selection") {
NavigationLink(destination: ResourceSelection()) {
Text("Resource Selection")
}
}
ShareFHIRSection()
}
}


Expand Down
96 changes: 96 additions & 0 deletions OwnYourData/Account/ResourceSelection.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//
// This source file is part of the Stanford LLM on FHIR project
//
// SPDX-FileCopyrightText: 2023 Stanford University
//
// SPDX-License-Identifier: MIT
//

import ModelsR4
import SpeziFHIR
import SpeziFHIRMockPatients
import SwiftUI


struct ResourceSelection: View {
@Environment(OwnYourDataStandard.self) private var standard
@Environment(FHIRStore.self) private var store

@State private var bundles: [ModelsR4.Bundle] = []
@State private var showBundleSelection = false

@MainActor var useHealthKitResources: Binding<Bool> {
Binding(
get: {
if FeatureFlags.mockPatients {
showBundleSelection = true
return false
}
return standard.useHealthKitResources
},
set: { newValue in
showBundleSelection = !newValue
standard.useHealthKitResources = newValue
}
)
}


var body: some View {
Form {
Section {
Toggle(isOn: useHealthKitResources) {
Text("Use HealthKit Resources")
}
.onChange(of: useHealthKitResources.wrappedValue, initial: true) {
if useHealthKitResources.wrappedValue {
_Concurrency.Task {
await standard.loadHealthKitResources()
}
} else {
guard let firstMockPatient = bundles.first else {
return
}

store.removeAllResources()
store.load(bundle: firstMockPatient)
}
}
}
if showBundleSelection {
Section {
if bundles.isEmpty {
HStack {
Spacer()
ProgressView()
Spacer()
}
} else {
FHIRBundleSelector(bundles: bundles)
.pickerStyle(.inline)
}
}
}
}
.task {
self.bundles = await mockPatients
}
.onAppear {
showBundleSelection = !standard.useHealthKitResources
}
.navigationTitle(Text("Resource Settings"))
}

private var mockPatients: [ModelsR4.Bundle] {
get async {
await [
.allen322Ferry570,
.beatris270Bogan287,
.edythe31Morar593,
.gonzalo160Duenas839,
.jacklyn830Veum823,
.milton509Ortiz186
]
}
}
}
10 changes: 5 additions & 5 deletions OwnYourData/Contributions/ContributionsList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ struct ContributionsList: View {

var body: some View {
List {
Section(footer: Text("PROJECT_LICENSE_DESCRIPTION")) {
Text("CONTRIBUTIONS_LIST_DESCRIPTION")
Section(footer: Text("This project is licensed under the MIT License.")) {
Text("The following list contains all Swift Package dependencies of the SpeziOwnYourData.")
}
Section(
header: Text("CONTRIBUTIONS_LIST_HEADER"),
footer: Text("CONTRIBUTIONS_LIST_FOOTER")
header: Text("Packages"),
footer: Text("Please refer to the individual repository links for packages without license labels.")
) {
ForEach(packages.sorted(by: { $0.name < $1.name }), id: \.name) { package in
PackageCell(package: package)
}
}
}
.navigationTitle("LICENSE_INFO_TITLE")
.navigationTitle("License Information")
.navigationBarTitleDisplayMode(.inline)
}
}
Expand Down
2 changes: 1 addition & 1 deletion OwnYourData/Documents/DocumentGallery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI


struct DocumentGallery: View {
@EnvironmentObject var documentManager: DocumentManager
@Environment(DocumentManager.self) var documentManager
@State var documentScanner = false


Expand Down
Loading

0 comments on commit 4a87abd

Please sign in to comment.