Commit a729de77 by Sebastián Katzer

Fix trigger/click issue with repeating notifications on iOS

parent e8d8cae1
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
- (BOOL) autoCancel - (BOOL) autoCancel
{ {
if (IsAtLeastiOSVersion(@"8.0")){ if (IsAtLeastiOSVersion(@"8.0")){
return YES; return self.repeatInterval == NSCalendarUnitEra;
} else { } else {
return [[dict objectForKey:@"autoCancel"] boolValue]; return [[dict objectForKey:@"autoCancel"] boolValue];
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
// The options provided by the plug-in // The options provided by the plug-in
- (APPLocalNotificationOptions*) options; - (APPLocalNotificationOptions*) options;
// Timeinterval since fire date // Timeinterval since fire date
- (NSTimeInterval) timeIntervalSinceFireDate; - (double) timeIntervalSinceFireDate;
// If the fire date was in the past // If the fire date was in the past
- (BOOL) wasInThePast; - (BOOL) wasInThePast;
// If the notification was already triggered // If the notification was already triggered
......
...@@ -96,14 +96,43 @@ static char optionsKey; ...@@ -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. * Timeinterval since fire date.
*/ */
- (NSTimeInterval) timeIntervalSinceFireDate - (double) timeIntervalSinceFireDate
{ {
NSDate* now = [NSDate date]; NSDate* now = [NSDate date];
NSDate* fireDate = self.options.fireDate; 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