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

Add pragma macros

parent e3fca1da
Loading
Loading
Loading
Loading
+61 −46
Changes for src/ios/APPLocalNotification.m: 61 added lines, 46 removed lines.
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@

@synthesize deviceready, eventQueue, applicationState, scheduledNotifications;

#pragma mark -
#pragma mark Plugin interface methods

/**
 * Executes all queued events.
 */
@@ -216,6 +219,9 @@
    }];
}

#pragma mark -
#pragma mark Plugin core methods

/**
 * Schedules a new local notification and fies the coresponding event.
 *
@@ -285,52 +291,6 @@
    }
}

/**
 * Retrurns a key-value dictionary for repeat intervals.
 *
 * @return {NSMutableDictionary}
 */
- (NSMutableDictionary*) repeatDict
{
    NSMutableDictionary* repeatDict = [[NSMutableDictionary alloc] init];

    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitSecond] forKey:@"secondly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitMinute] forKey:@"minutely"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitHour] forKey:@"hourly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitDay] forKey:@"daily"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSWeekCalendarUnit] forKey:@"weekly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitMonth] forKey:@"monthly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitYear] forKey:@"yearly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitEra] forKey:@""];

    return repeatDict;
}

/**
 * Returns the userDict for a local notification.
 *
 * @param {NSMutableDictionary} options
 *      The properties for the local notification
 * @return {NSDictionary}
 */
- (NSDictionary*) userDict:(NSMutableDictionary*)options
{
    NSString* id = [options objectForKey:@"id"];
    NSString* ac = [options objectForKey:@"autoCancel"];
    NSString* js = [options objectForKey:@"json"];

    return [NSDictionary dictionaryWithObjectsAndKeys:
            id, @"id", ac, @"autoCancel", js, @"json", nil];
}

/**
 * Creates an notification object based on the given properties.
 *
@@ -379,6 +339,9 @@
    return notification;
}

#pragma mark -
#pragma mark Plugin delegate and life cycle methods

/**
 * Calls the cancel or trigger event after a local notification was received.
 * Cancels the local notification if autoCancel was set to true.
@@ -457,6 +420,55 @@
    [self cancelAllNotificationsWhichAreOlderThen:432000];
}

#pragma mark -
#pragma mark Plugin helper methods

/**
 * Retrurns a key-value dictionary for repeat intervals.
 *
 * @return {NSMutableDictionary}
 */
- (NSMutableDictionary*) repeatDict
{
    NSMutableDictionary* repeatDict = [[NSMutableDictionary alloc] init];

    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitSecond] forKey:@"secondly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitMinute] forKey:@"minutely"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitHour] forKey:@"hourly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitDay] forKey:@"daily"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSWeekCalendarUnit] forKey:@"weekly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitMonth] forKey:@"monthly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitYear] forKey:@"yearly"];
    [repeatDict setObject:
     [NSNumber numberWithInt:NSCalendarUnitEra] forKey:@""];

    return repeatDict;
}

/**
 * Returns the userDict for a local notification.
 *
 * @param {NSMutableDictionary} options
 *      The properties for the local notification
 * @return {NSDictionary}
 */
- (NSDictionary*) userDict:(NSMutableDictionary*)options
{
    NSString* id = [options objectForKey:@"id"];
    NSString* ac = [options objectForKey:@"autoCancel"];
    NSString* js = [options objectForKey:@"json"];

    return [NSDictionary dictionaryWithObjectsAndKeys:
            id, @"id", ac, @"autoCancel", js, @"json", nil];
}

/**
 * Checks weather the given string is empty or not.
 *
@@ -553,6 +565,9 @@
    return notificationsWithoutNIL;
}

#pragma mark -
#pragma mark Plugin callback methods

/**
 * Simply invokes the callback without any parameter.
 */