Permalink
Browse files

[ios-sdk] Make consistent use of YES/NO when dealing with type BOOL

Summary:
We were inconsistent in our use of YES/NO rather than true/false when using type BOOL
rather than bool. This didn't pose a real problem, but we should be consistent in using the
correct constants for the particular datatype in question, and, more importantly, it is not
idiomatic in Objective-C to use true/false for BOOL types.

Test Plan:
- Inspection
- Ran unit tests

Revert Plan:

Reviewers: jacl, mmarucheck, gregschechte, ayden

Reviewed By: gregschechte

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D504060
  • Loading branch information...
1 parent 822524f commit 9ffdd94bbd042db58167036df6ce24ea70add39d @clang13 clang13 committed Jun 26, 2012
@@ -91,14 +91,14 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- return false;
+ return NO;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.selectItemCallback) {
self.selectItemCallback(self, [_meals objectAtIndex:indexPath.row]);
}
- [self.navigationController popViewControllerAnimated:true];
+ [self.navigationController popViewControllerAnimated:YES];
}
@@ -223,7 +223,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.popover dismissPopoverAnimated:YES];
} else {
- [self dismissModalViewControllerAnimated:true];
+ [self dismissModalViewControllerAnimated:YES];
}
[self updateSelections];
@@ -270,7 +270,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSIn
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
} else {
- [self presentModalViewController:self.imagePicker animated:true];
+ [self presentModalViewController:self.imagePicker animated:YES];
}
}
@@ -451,13 +451,13 @@ - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
cell.textLabel.font = [UIFont systemFontOfSize:16];
cell.textLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
cell.textLabel.lineBreakMode = UILineBreakModeTailTruncation;
- cell.textLabel.clipsToBounds = true;
+ cell.textLabel.clipsToBounds = YES;
cell.detailTextLabel.font = [UIFont systemFontOfSize:12];
cell.detailTextLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
cell.detailTextLabel.textColor = [UIColor colorWithRed:0.4 green:0.6 blue:0.8 alpha:1];
cell.detailTextLabel.lineBreakMode = UILineBreakModeTailTruncation;
- cell.detailTextLabel.clipsToBounds = true;
+ cell.detailTextLabel.clipsToBounds = YES;
}
switch (indexPath.row) {
@@ -497,7 +497,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- return false;
+ return NO;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -581,7 +581,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
return;
}
- [self.navigationController pushViewController:target animated:true];
+ [self.navigationController pushViewController:target animated:YES];
}
#pragma mark -
@@ -598,7 +598,7 @@ - (void)placePickerViewControllerSelectionDidChange:(FBPlacePickerViewController
self.selectedPlace = placePicker.selection;
[self updateSelections];
if (self.selectedPlace.count > 0) {
- [self.navigationController popViewControllerAnimated:true];
+ [self.navigationController popViewControllerAnimated:YES];
}
}
@@ -46,7 +46,7 @@ - (id)init {
- (void)enableWithFacebook:(Facebook*)facebook {
if (!_enabled) {
- _enabled = true;
+ _enabled = YES;
[self reloadRecipientCacheWithFacebook:facebook];
}
}
@@ -124,8 +124,8 @@ - (void)initialize
self.imageView = imageView;
[imageView release];
- self.autoresizesSubviews = true;
- self.clipsToBounds = true;
+ self.autoresizesSubviews = YES;
+ self.clipsToBounds = YES;
[self addSubview:self.imageView];
}
View
@@ -500,7 +500,7 @@ - (BOOL)transitionToState:(FBSessionState)state
logEntry:[NSString stringWithFormat:@"FBSession **INVALID** transition from %@ to %@",
[FBSession sessionStateDescription:statePrior],
[FBSession sessionStateDescription:state]]];
- return false;
+ return NO;
}
// if this is yes, someone called a method on FBSession from within a KVO will change handler
@@ -529,12 +529,12 @@ - (BOOL)transitionToState:(FBSessionState)state
withTag:self];
// identify whether we will update token and date, and what the values will be
- BOOL changingTokenAndDate = false;
+ BOOL changingTokenAndDate = NO;
if (token && date) {
- changingTokenAndDate = true;
+ changingTokenAndDate = YES;
} else if (!FB_ISSESSIONOPENWITHSTATE(state) &&
FB_ISSESSIONOPENWITHSTATE(statePrior)) {
- changingTokenAndDate = true;
+ changingTokenAndDate = YES;
token = nil;
date = nil;
}
@@ -609,7 +609,7 @@ - (BOOL)transitionToState:(FBSessionState)state
// assure the state is cohesive in common reintrant scenarios
// the NO case short-circuits after the state switch/case
- return true;
+ return YES;
}
// core authorization UX flow

0 comments on commit 9ffdd94

Please sign in to comment.