Skip to content

Commit

Permalink
Task3 (#5)
Browse files Browse the repository at this point in the history
# *Configuring HealthKit Data and Removing Notification Permissions*

## ♻️ Current situation & Problem

- The app currently does not request all the health data types needed
- The app currently has an onboarding step for notification permissions,
which is not required


## ⚙️ Release Notes 

- Updated HealthKit configurations to collect allergy, clinical note,
condition, coverage, immunization, lab result, medication, procedure and
vital sign records.
- deleted notification permissions in onboarding



## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md):
- [ ] I agree to follow the [Code of
Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
kcallon authored Jan 22, 2024
1 parent a9ca60d commit c4572dd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 136 deletions.
4 changes: 0 additions & 4 deletions Intake.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
2F4FC8D729EE69D300BFFE26 /* MockUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F4FC8D629EE69D300BFFE26 /* MockUpload.swift */; };
2F5E32BD297E05EA003432F8 /* IntakeDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F5E32BC297E05EA003432F8 /* IntakeDelegate.swift */; };
2F6025CB29BBE70F0045459E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2F6025CA29BBE70F0045459E /* GoogleService-Info.plist */; };
2F65B44E2A3B8B0600A36932 /* NotificationPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F65B44D2A3B8B0600A36932 /* NotificationPermissions.swift */; };
2FA0BFED2ACC977500E0EF83 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 2FA0BFEC2ACC977500E0EF83 /* Localizable.xcstrings */; };
2FB099AF2A875DF100B20952 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 2FB099AE2A875DF100B20952 /* FirebaseAuth */; };
2FB099B12A875DF100B20952 /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = 2FB099B02A875DF100B20952 /* FirebaseFirestore */; };
Expand Down Expand Up @@ -101,7 +100,6 @@
2F4FC8D629EE69D300BFFE26 /* MockUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockUpload.swift; sourceTree = "<group>"; };
2F5E32BC297E05EA003432F8 /* IntakeDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntakeDelegate.swift; sourceTree = "<group>"; };
2F6025CA29BBE70F0045459E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
2F65B44D2A3B8B0600A36932 /* NotificationPermissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationPermissions.swift; sourceTree = "<group>"; };
2FA0BFEC2ACC977500E0EF83 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
2FAEC07F297F583900C11C42 /* Intake.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Intake.entitlements; sourceTree = "<group>"; };
2FC94CD4298B0A1D009C8209 /* Intake.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Intake.xctestplan; sourceTree = "<group>"; };
Expand Down Expand Up @@ -230,7 +228,6 @@
2FE5DCAC29EE6107004B9AB4 /* AccountOnboarding.swift */,
2FE5DC2F29EDD7CA004B9AB4 /* Consent.swift */,
2FE5DC3029EDD7CA004B9AB4 /* HealthKitPermissions.swift */,
2F65B44D2A3B8B0600A36932 /* NotificationPermissions.swift */,
);
path = Onboarding;
sourceTree = "<group>";
Expand Down Expand Up @@ -602,7 +599,6 @@
A9FE7AD02AA39BAB0077B045 /* AccountSheet.swift in Sources */,
653A2551283387FE005D4D48 /* Intake.swift in Sources */,
2FE5DC3629EDD7CA004B9AB4 /* HealthKitPermissions.swift in Sources */,
2F65B44E2A3B8B0600A36932 /* NotificationPermissions.swift in Sources */,
5661552E2AB854C000209B80 /* PackageHelper.swift in Sources */,
27FA29902A388E9B009CAC45 /* ModalView.swift in Sources */,
2FE5DC2629EDD38A004B9AB4 /* Contacts.swift in Sources */,
Expand Down
21 changes: 18 additions & 3 deletions Intake/IntakeDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,24 @@ class IntakeDelegate: SpeziAppDelegate {

private var healthKit: HealthKit {
HealthKit {
CollectSample(
HKQuantityType(.stepCount),
deliverySetting: .anchorQuery(.afterAuthorizationAndApplicationWillLaunch)
CollectSamples(
[
HKClinicalType(.allergyRecord),
HKClinicalType(.clinicalNoteRecord),
HKClinicalType(.conditionRecord),
HKClinicalType(.coverageRecord),
HKClinicalType(.immunizationRecord),
HKClinicalType(.labResultRecord),
HKClinicalType(.medicationRecord),
HKClinicalType(.procedureRecord),
HKClinicalType(.vitalSignRecord)
],
predicate: HKQuery.predicateForSamples(
withStart: Date.distantPast,
end: nil,
options: .strictEndDate
),
deliverySetting: .anchorQuery(saveAnchor: false)
)
}
}
Expand Down
77 changes: 0 additions & 77 deletions Intake/Onboarding/NotificationPermissions.swift

This file was deleted.

9 changes: 0 additions & 9 deletions Intake/Onboarding/OnboardingFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ struct OnboardingFlow: View {

@AppStorage(StorageKeys.onboardingFlowComplete) private var completedOnboardingFlow = false

@State private var localNotificationAuthorization = false


private var healthKitAuthorization: Bool {
// As HealthKit not available in preview simulator
Expand Down Expand Up @@ -49,14 +47,7 @@ struct OnboardingFlow: View {
if HKHealthStore.isHealthDataAvailable() && !healthKitAuthorization {
HealthKitPermissions()
}

if !localNotificationAuthorization {
NotificationPermissions()
}
}
.task {
localNotificationAuthorization = await scheduler.localNotificationAuthorization
}
.interactiveDismissDisabled(!completedOnboardingFlow)
}
}
Expand Down
45 changes: 2 additions & 43 deletions Intake/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This onboarding step allows you to customize the onboarding flow to explain how the application uses the HealhtKit data and allows a user to cusomize the selection."
"value" : "Intake will use your different types of your health records in order to most effectively aid you with your intake form."
}
}
}
Expand All @@ -159,7 +159,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Spezi can access data from HealthKit using the HealthKitDataSource module."
"value" : "Intake would like to access to your health records to fill out your intake form."
}
}
}
Expand Down Expand Up @@ -317,47 +317,6 @@
}
}
},
"NOTIFICATION_PERMISSIONS_BUTTON" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Allow Notifications"
}
}
}
},
"NOTIFICATION_PERMISSIONS_DESCRIPTION" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The Spezi Scheduler module enables to send out local notifications when a new event of a task is scheduled."
}
}
}
},
"NOTIFICATION_PERMISSIONS_SUBTITLE" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Spezi Scheduler Notifications."
}
}
}
},
"NOTIFICATION_PERMISSIONS_TITLE" : {
"comment" : "MARK: Notifications",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Notifications"
}
}
}
},
"PROJECT_LICENSE_DESCRIPTION" : {
"localizations" : {
"en" : {
Expand Down

0 comments on commit c4572dd

Please sign in to comment.