From 363a3bcbf02cb2c6035d2d2963b350a634ffe100 Mon Sep 17 00:00:00 2001 From: Ankush Aggarwal Date: Mon, 12 Mar 2018 19:40:28 -0700 Subject: [PATCH] fix #105 optional filtered flag to ignore manual steps, fix #105 --- src/ios/HealthKit.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ios/HealthKit.m b/src/ios/HealthKit.m index 3fdd382..d531d0a 100755 --- a/src/ios/HealthKit.m +++ b/src/ios/HealthKit.m @@ -1504,6 +1504,11 @@ - (void)querySampleTypeAggregated:(CDVInvokedUrlCommand *)command { // NSPredicate *predicate = [HKQuery predicateForSamplesWithStartDate:startDate endDate:endDate options:HKQueryOptionStrictStartDate]; NSPredicate *predicate = nil; + + BOOL filtered = (args[@"filtered"] != nil && [args[@"filtered"] boolValue]); + if (filtered) { + predicate = [NSPredicate predicateWithFormat:@"metadata.%K != YES", HKMetadataKeyWasUserEntered]; + } NSSet *requestTypes = [NSSet setWithObjects:type, nil]; [[HealthKit sharedHealthStore] requestAuthorizationToShareTypes:nil readTypes:requestTypes completion:^(BOOL success, NSError *error) {