Commit a729de77 authored by Sebastián Katzer's avatar Sebastián Katzer
Browse files

Fix trigger/click issue with repeating notifications on iOS

parent e8d8cae1
Loading
Loading
Loading
Loading
+1 −1
Changes for src/ios/APPLocalNotificationOptions.m: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@
- (BOOL) autoCancel
{
    if (IsAtLeastiOSVersion(@"8.0")){
        return YES;
        return self.repeatInterval == NSCalendarUnitEra;
    } else {
        return [[dict objectForKey:@"autoCancel"] boolValue];
    }
+1 −1
Changes for src/ios/UILocalNotification+APPLocalNotification.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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
+31 −2
Changes for src/ios/UILocalNotification+APPLocalNotification.m: 31 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -95,15 +95,44 @@ static char optionsKey;
                             options, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

/**
 * 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;
}

/**