Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/fixadd #44

Merged
merged 7 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Prisma/PrivacyControls/PrivacyModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,9 @@ public class PrivacyModule: Module, EnvironmentAccessible, ObservableObject {
)
]

var configuration: Configuration {
Configuration(standard: PrismaStandard()) { }
}

public required init(sampleTypeList: [HKSampleType]) {
self.sampleTypeList = sampleTypeList

var sampleTypeIdentifiers: [String] = []
for sampleType in sampleTypeList {
if sampleType == HKWorkoutType.workoutType() {
Expand Down
28 changes: 3 additions & 25 deletions Prisma/Standard/PrismaStandard+HealthKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,9 @@
/// Adds a new `HKSample` to the Firestore.
/// - Parameter response: The `HKSample` that should be added.
func add(sample: HKSample) async {
let sampleList = [
// Activity
HKQuantityType(.stepCount),
HKQuantityType(.distanceWalkingRunning),
HKQuantityType(.basalEnergyBurned),
HKQuantityType(.activeEnergyBurned),
HKQuantityType(.flightsClimbed),
HKQuantityType(.appleExerciseTime),
HKQuantityType(.appleMoveTime),
HKQuantityType(.appleStandTime),

// Vital Signs
HKQuantityType(.heartRate),
HKQuantityType(.restingHeartRate),
HKQuantityType(.heartRateVariabilitySDNN),
HKQuantityType(.walkingHeartRateAverage),
HKQuantityType(.oxygenSaturation),
HKQuantityType(.respiratoryRate),
HKQuantityType(.bodyTemperature),

// Other events
HKCategoryType(.sleepAnalysis),
HKWorkoutType.workoutType()
]
let privacyModule = PrivacyModule(sampleTypeList: sampleList)
guard let privacyModule = privacyModule else {
dhruvna1k marked this conversation as resolved.
Show resolved Hide resolved
return
}

Check warning on line 95 in Prisma/Standard/PrismaStandard+HealthKit.swift

View check run for this annotation

Codecov / codecov/patch

Prisma/Standard/PrismaStandard+HealthKit.swift#L93-L95

Added lines #L93 - L95 were not covered by tests
let toggleMap = await privacyModule.getHKSampleTypeMappings()

let identifier: String
Expand Down
2 changes: 1 addition & 1 deletion Prisma/Standard/PrismaStandard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import SpeziOnboarding
import SpeziQuestionnaire
import SwiftUI


actor PrismaStandard: Standard, EnvironmentAccessible, HealthKitConstraint, OnboardingConstraint, AccountStorageConstraint {
enum PrismaStandardError: Error {
case userNotAuthenticatedYet
Expand All @@ -38,6 +37,7 @@ actor PrismaStandard: Standard, EnvironmentAccessible, HealthKitConstraint, Onbo

@Dependency var mockWebService: MockWebService?
@Dependency var accountStorage: FirestoreAccountStorage?
@Dependency var privacyModule: PrivacyModule?

@AccountReference var account: Account

Expand Down
3 changes: 2 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
},
"singleProjectMode": true
}
}
}

Loading