Skip to content

Commit

Permalink
Code review changes suggested by @AugustoRamos94:
Browse files Browse the repository at this point in the history
- Removed unnecessary 'return'
- Checking for error instead of checking value before calling error callback
  • Loading branch information
GGGava committed Jan 23, 2023
1 parent d2e1bf0 commit b3b7ba2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ - (void)body_getLatestPeakFlow:(NSDictionary *)input callback:(RCTResponseSender
[self fetchMostRecentQuantitySampleOfType:peakFlowType
predicate:nil
completion:^(HKQuantity *mostRecentQuantity, NSDate *startDate, NSDate *endDate, NSError *error) {
if (!mostRecentQuantity) {
if (error) {
NSLog(@"error getting latest peak flow: %@", error);
callback(@[RCTMakeError(@"error getting latest peak flow", error, nil)]);
}
Expand Down Expand Up @@ -348,10 +348,8 @@ - (void)body_getPeakFlowSamples:(NSDictionary *)input callback:(RCTResponseSende
completion:^(NSArray *results, NSError *error) {
if(results){
callback(@[[NSNull null], results]);
return;
} else {
callback(@[RCTJSErrorFromNSError(error)]);
return;
}
}];
}
Expand Down

0 comments on commit b3b7ba2

Please sign in to comment.