Created
January 30, 2014 14:05
-
-
Save damirstuhec/8709011 to your computer and use it in GitHub Desktop.
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
NSDate *fireDate = nil; | |
NSDate *startDate = [card getLatestDateOfActivities:@[ACTIVITY_CARD_CREATED, ACTIVITY_TIME_SET, ACTIVITY_TIME_CHANGED]]; | |
NSDate *endDate = card.time.date; | |
NSTimeInterval deltaHours = (abs([startDate timeIntervalSinceReferenceDate] - [endDate timeIntervalSinceReferenceDate]) / 3600); | |
NSString *invitesNamesSentence = [card getInvitesNamesSentenceWithYourFriendsOption:YES]; | |
NSMutableString *alertBody = [[NSMutableString alloc] initWithFormat:@"%@ wants to meet you ", invitesNamesSentence]; | |
if (endDate && deltaHours < 24) | |
{ | |
fireDate = [startDate dateByAddingMinutes:30]; | |
[alertBody appendFormat:@"%@. Don't wait and respond on card %@.", [card.time getUniversalTimeDateString], card.category.name]; | |
} | |
else | |
{ | |
fireDate = [startDate dateByAddingHours:5]; | |
[alertBody appendFormat:@"for %@", card.category.name]; | |
if (endDate) | |
{ | |
[alertBody appendFormat:@", %@", [card.time getUniversalTimeDateString]]; | |
} | |
if (card.location) | |
{ | |
[alertBody appendFormat:@" at %@ and is still waiting for you to respond.", card.location.name]; | |
} | |
else | |
{ | |
[alertBody appendFormat:@". Don’t wait, respond right away."]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment