Commit 8505fc8d by Sebastián Katzer

Update example

parent 59794a70
......@@ -236,10 +236,10 @@
B15E0B313C114B988FFDB3DF /* APPLocalNotificationOptions.m */,
49F49C19231D4BBE83DBF480 /* UIApplication+APPLocalNotification.h */,
3FAE800EBDCA42B2A38B569B /* UIApplication+APPLocalNotification.m */,
DAB48B85CF1041E08D93312D /* UILocalNotification+APPLocalNotification.m */,
49A917BFEDB54EBE90626CB7 /* APPLocalNotification.h */,
3EEEE9F809E44CCDA96CDFF7 /* APPLocalNotificationOptions.h */,
7C2E1A851E1C499084223237 /* UILocalNotification+APPLocalNotification.h */,
DAB48B85CF1041E08D93312D /* UILocalNotification+APPLocalNotification.m */,
);
name = Plugins;
path = NotificationExample/Plugins;
......
......@@ -82,7 +82,7 @@
- (BOOL) autoCancel
{
if (IsAtLeastiOSVersion(@"8.0")){
return YES;
return self.repeatInterval == NSCalendarUnitEra;
} else {
return [[dict objectForKey:@"autoCancel"] boolValue];
}
......
......@@ -28,7 +28,7 @@
// The options provided by the plug-in
- (APPLocalNotificationOptions*) options;
// Timeinterval since fire date
- (NSTimeInterval) timeIntervalSinceFireDate;
- (double) timeIntervalSinceFireDate;
// If the fire date was in the past
- (BOOL) wasInThePast;
// If the notification was already triggered
......
......@@ -96,14 +96,43 @@ static char optionsKey;
}
/**
* The repeating interval in seconds.
*/
- (int) repeatIntervalInSeconds
{
switch (self.repeatInterval) {
case NSCalendarUnitMinute:
return 60;
case NSCalendarUnitHour:
return 60000;
case NSCalendarUnitDay:
case NSCalendarUnitWeekOfYear:
case NSCalendarUnitMonth:
case NSCalendarUnitYear:
return 86400;
default:
return 1;
}
}
/**
* Timeinterval since fire date.
*/
- (NSTimeInterval) timeIntervalSinceFireDate
- (double) timeIntervalSinceFireDate
{
NSDate* now = [NSDate date];
NSDate* fireDate = self.options.fireDate;
return [now timeIntervalSinceDate:fireDate];
int timespan = [now timeIntervalSinceDate:fireDate];
if (self.repeatInterval != NSCalendarUnitEra) {
timespan = timespan % [self repeatIntervalInSeconds];
}
return timespan;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment