Commit 284ebdc7 authored by Greg Wilson's avatar Greg Wilson

cleaned up after refactor

parent b59daac3
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
@implementation RCTAppleHealthKit (Methods_Body) @implementation RCTAppleHealthKit (Methods_Body)
- (void)body_getCurrentWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback - (void)body_getCurrentWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback
{ {
// Query to get the user's latest weight, if it exists. // Query to get the user's latest weight, if it exists.
...@@ -32,8 +33,6 @@ ...@@ -32,8 +33,6 @@
} }
- (void)body_saveWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback - (void)body_saveWeight:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback
{ {
double weight= [[input objectForKey:@"weight"] doubleValue]; double weight= [[input objectForKey:@"weight"] doubleValue];
...@@ -58,7 +57,6 @@ ...@@ -58,7 +57,6 @@
} }
- (void)body_getLatestBodyMassIndex:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback - (void)body_getLatestBodyMassIndex:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback
{ {
// Query to get the user's latest BMI, if it exists. // Query to get the user's latest BMI, if it exists.
...@@ -80,5 +78,4 @@ ...@@ -80,5 +78,4 @@
} }
@end @end
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
- (void)isHealthKitAvailable:(RCTResponseSenderBlock)callback; - (void)isHealthKitAvailable:(RCTResponseSenderBlock)callback;
- (void)initializeHealthKit:(NSDictionary *)input callback:(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; - (void)getModuleInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback;
@end @end
...@@ -44,7 +44,6 @@ RCT_EXPORT_METHOD(getLatestBmi:(NSDictionary *)input callback:(RCTResponseSender ...@@ -44,7 +44,6 @@ RCT_EXPORT_METHOD(getLatestBmi:(NSDictionary *)input callback:(RCTResponseSender
[self body_getLatestBodyMassIndex:input callback:callback]; [self body_getLatestBodyMassIndex:input callback:callback];
} }
RCT_EXPORT_METHOD(getStepCountForToday:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) RCT_EXPORT_METHOD(getStepCountForToday:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback)
{ {
[self fitness_getStepCountForToday:input callback:callback]; [self fitness_getStepCountForToday:input callback:callback];
...@@ -109,76 +108,6 @@ RCT_EXPORT_METHOD(getInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock ...@@ -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 - (void)getModuleInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback
{ {
...@@ -186,6 +115,4 @@ RCT_EXPORT_METHOD(getInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock ...@@ -186,6 +115,4 @@ RCT_EXPORT_METHOD(getInfo:(NSDictionary *)input callback:(RCTResponseSenderBlock
} }
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment