Skip to content

Commit

Permalink
Able to filter events
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchiles committed Aug 4, 2014
1 parent 996a14b commit 19b287f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions iBurn/BRCEventsFilterTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ - (void)viewWillDisappear:(BOOL)animated
NSArray *filteredArray = [self filteredTypes];
[[NSUserDefaults standardUserDefaults] setSelectedEventTypes:filteredArray];
[[NSUserDefaults standardUserDefaults] setShowExpiredEvents:self.showExpiredEvents];
[self updateFilteredViews];
}

- (NSArray *)filteredTypes
Expand All @@ -142,13 +143,16 @@ - (void)updateFilteredViews
if ([object isKindOfClass:[BRCEventObject class]]) {
BRCEventObject *eventObject = (BRCEventObject*)object;
BOOL eventHasEnded = eventObject.hasEnded;
#warning eventMatchesTypeFilter filter won't work because containsObject compares pointers not values
//BOOL eventMatchesTypeFilter = [filteredArray containsObject:@(eventObject.eventType)];
if (showExpiredEvents) {
return YES;
} else {
return !eventHasEnded;
BOOL eventMatchesTypeFilter = [filteredArray containsObject:@(eventObject.eventType)];

if ((eventMatchesTypeFilter || [filteredArray count] == 0)) {
if (showExpiredEvents) {
return YES;
} else {
return !eventHasEnded;
}
}

}
return NO;
};
Expand Down

0 comments on commit 19b287f

Please sign in to comment.