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

Revert "Support reading clinical data (FHIR) from the HealthKit store in iOS 12" #116

Merged
merged 1 commit into from
Mar 5, 2020
Merged
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
41 changes: 0 additions & 41 deletions src/ios/HealthKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ + (HKObjectType *)getHKObjectType:(NSString *)elem {
return type;
}

if (@available(iOS 12.0, *)) {
type = [HKObjectType clinicalTypeForIdentifier:elem];
if (type != nil) {
return type;
}
}

// @TODO | The fall through here is inefficient.
// @TODO | It needs to be refactored so the same HK method isnt called twice
return [HealthKit getHKSampleType:elem];
Expand Down Expand Up @@ -245,13 +238,6 @@ + (HKSampleType *)getHKSampleType:(NSString *)elem {
}
}

if (@available(iOS 12.0, *)) {
type = [HKObjectType clinicalTypeForIdentifier:elem];
if (type != nil) {
return type;
}
}

// leave this here for if/when apple adds other sample types
return type;

Expand Down Expand Up @@ -1366,33 +1352,6 @@ - (void)querySampleType:(CDVInvokedUrlCommand *)command {
HKWorkout *wsample = (HKWorkout *) sample;
[entry setValue:@(wsample.duration) forKey:@"duration"];

} else {

if (@available(iOS 12.0, *)) {

if ([sample isKindOfClass:[HKClinicalRecord class]]) {
HKClinicalRecord *clinicalRecord = (HKClinicalRecord *) sample;
NSError *err = nil;
NSDictionary *fhirData = [NSJSONSerialization JSONObjectWithData:clinicalRecord.FHIRResource.data options:NSJSONReadingMutableContainers error:&err];

if (err != nil) {
dispatch_sync(dispatch_get_main_queue(), ^{
[HealthKit triggerErrorCallbackWithMessage:err.localizedDescription command:command delegate:bSelf.commandDelegate];
});
return;
} else {
NSDictionary *fhirResource = @{
@"identifier": clinicalRecord.FHIRResource.identifier,
@"sourceURL": clinicalRecord.FHIRResource.sourceURL.absoluteString,
@"displayName": clinicalRecord.displayName,
@"data": fhirData
};
entry[@"FHIRResource"] = fhirResource;
}
}

}

}

[finalResults addObject:entry];
Expand Down