Skip to content

Commit

Permalink
Hack together input validation for the reviews.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Wojnowski committed Dec 7, 2015
1 parent 065e8a4 commit 47a607a
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,24 @@ -(void)refreshWatchlistButtonForMovie:(Movie *)movie {

- (IBAction)submitReviewTouched:(id)sender {

BOOL const didRate = ![self.userRatingCell.image.name isEqualToString:@"starSmallOutlineBase"];
if (!didRate) {

NSAlert * const alert = [NSAlert alertWithMessageText:@"Error" defaultButton:@"Dismiss" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Please choose the rating (in stars) before submitting your review."];
[alert runModal];

return;

}
if (self.userReviewTextField.stringValue.length == 0) {

NSAlert * const alert = [NSAlert alertWithMessageText:@"Error" defaultButton:@"Dismiss" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Please enter some information about your review in the text field, before submitting your review."];
[alert runModal];

return;

}

self.submitReviewButton.title = @"Update";

[[CoreDataController sharedInstance] performBlock:^(NSManagedObjectContext *managedObjectContext) {
Expand Down

0 comments on commit 47a607a

Please sign in to comment.