From 284ebdc7f63cab4e5684b523b75819aed838e79b Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Sun, 26 Jun 2016 23:22:09 -0400 Subject: [PATCH] cleaned up after refactor --- .../RCTAppleHealthKit+Methods_Body.m | 5 +- RCTAppleHealthKit/RCTAppleHealthKit.h | 3 - RCTAppleHealthKit/RCTAppleHealthKit.m | 73 ------------------- 3 files changed, 1 insertion(+), 80 deletions(-) diff --git a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m index 186e0c4..84f4eeb 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m @@ -11,6 +11,7 @@ @implementation RCTAppleHealthKit (Methods_Body) + - (void)body_getCurrentWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback { // Query to get the user's latest weight, if it exists. @@ -32,8 +33,6 @@ } - - - (void)body_saveWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback { double weight= [[input objectForKey:@"weight"] doubleValue]; @@ -58,7 +57,6 @@ } - - (void)body_getLatestBodyMassIndex:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback { // Query to get the user's latest BMI, if it exists. @@ -80,5 +78,4 @@ } - @end diff --git a/RCTAppleHealthKit/RCTAppleHealthKit.h b/RCTAppleHealthKit/RCTAppleHealthKit.h index f18442d..28b8a96 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit.h +++ b/RCTAppleHealthKit/RCTAppleHealthKit.h @@ -18,9 +18,6 @@ - (void)isHealthKitAvailable:(RCTResponseSenderBlock)callback; - (void)initializeHealthKit:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; -//- (void)getHealthKitUserWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; -//- (void)saveHealthKitUserWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; -//- (void)getHealthKitUserStepCount:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; - (void)getModuleInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; @end diff --git a/RCTAppleHealthKit/RCTAppleHealthKit.m b/RCTAppleHealthKit/RCTAppleHealthKit.m index 4d04797..31f8dd2 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit.m @@ -44,7 +44,6 @@ RCT_EXPORT_METHOD(getLatestBmi:(NSDictionary *)input callback:(RCTResponseSender [self body_getLatestBodyMassIndex:input callback:callback]; } - RCT_EXPORT_METHOD(getStepCountForToday:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) { [self fitness_getStepCountForToday:input callback:callback]; @@ -109,76 +108,6 @@ RCT_EXPORT_METHOD(getInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock } } -// -//- (void)getHealthKitUserWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback -//{ -//// NSMassFormatter *massFormatter = [[NSMassFormatter alloc] init]; -//// massFormatter.unitStyle = NSFormattingUnitStyleLong; -// -// // NSMassFormatterUnit weightFormatterUnit = NSMassFormatterUnitPound; -// // NSString *weightUnitString = [massFormatter unitStringFromValue:10 unit:weightFormatterUnit]; -// // NSString *localizedWeightUnitDescriptionFormat = NSLocalizedString(@"Weight (%@)", nil); -// -// // Query to get the user's latest weight, if it exists. -// HKQuantityType *weightType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass]; -// -// [self fetchMostRecentQuantitySampleOfType:weightType predicate:nil completion:^(HKQuantity *mostRecentQuantity, NSError *error) { -// if (!mostRecentQuantity) { -// NSLog(@"Either an error occured fetching the user's weight information or none has been stored yet. In your app, try to handle this gracefully."); -// callback(@[RCTMakeError(@"Either an error occured fetching the user's weight information or none has been stored yet. In your app, try to handle this gracefully.", nil, nil)]); -// } -// else { -// // Determine the weight in the required unit. -// HKUnit *weightUnit = [HKUnit poundUnit]; -// double usersWeight = [mostRecentQuantity doubleValueForUnit:weightUnit]; -// -// callback(@[[NSNull null], @(usersWeight)]); -// } -// }]; -//} - -// -//- (void)saveHealthKitUserWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback -//{ -// double weight= [[input objectForKey:@"weight"] doubleValue]; -// -// HKUnit *poundUnit = [HKUnit poundUnit]; -// HKQuantity *weightQuantity = [HKQuantity quantityWithUnit:poundUnit doubleValue:weight]; -// -// HKQuantityType *weightType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass]; -// NSDate *now = [NSDate date]; -// -// HKQuantitySample *weightSample = [HKQuantitySample quantitySampleWithType:weightType quantity:weightQuantity startDate:now endDate:now]; -// -// [self.healthStore saveObject:weightSample withCompletion:^(BOOL success, NSError *error) { -// if (!success) { -// NSLog(@"An error occured saving the weight sample %@. In your app, try to handle this gracefully. The error was: %@.", weightSample, error); -// callback(@[RCTMakeError(@"An error occured saving the weight sample", nil, nil)]); -// return; -// // abort(); -// } -// callback(@[[NSNull null], @(weight)]); -// }]; -//} - - -//- (void)getHealthKitUserStepCount:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback -//{ -// HKQuantityType *stepCountType = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount]; -// HKUnit *stepsUnit = [HKUnit countUnit]; -// -// [self fetchSumOfSamplesTodayForType:stepCountType unit:stepsUnit completion:^(double totalSteps, NSError *error) { -// if (!totalSteps) { -// NSLog(@"Either an error occured fetching the user's step count information or none has been stored yet. In your app, try to handle this gracefully."); -// callback(@[RCTMakeError(@"Either an error occured fetching the user's step count information or none has been stored yet. In your app, try to handle this gracefully.", nil, nil)]); -// return; -// } -// -// callback(@[[NSNull null], @(totalSteps)]); -// }]; -//} - - - (void)getModuleInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback { @@ -186,6 +115,4 @@ RCT_EXPORT_METHOD(getInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock } - - @end -- 2.26.2