Created
May 2, 2014 22:25
-
-
Save nataliepo/85b5e5e6c2e1ece8749f to your computer and use it in GitHub Desktop.
display_encouragement_logic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)performFeedbackActionIfNeeded { | |
int index = 0; | |
BOOL found = NO; | |
int limit = [_logicUsedOnce count]; | |
// Loop over the array of logic blocks. | |
// They'll draw the right thing as necessary. | |
while (!found && (index < limit)) { | |
BOOL (^checkCase)() = [_logicUsedOnce objectAtIndex:index]; | |
if (checkCase()) { | |
[_logicUsedOnce removeObjectAtIndex:index]; | |
found = YES; | |
} | |
index++; | |
} | |
// If you still haven't shown anything to the user, | |
// check the Repeated alerts. | |
index = 0; | |
limit = [_logicUsedRepeatedly count]; | |
while (!found && (index < limit)) { | |
BOOL (^checkCase)() = [_logicUsedRepeatedly objectAtIndex:index]; | |
if (checkCase()) { | |
found = YES; | |
} | |
index++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment