Commit 984f0d80 by Sebastián Katzer

Add pragma macros

parent e3fca1da
...@@ -77,6 +77,9 @@ ...@@ -77,6 +77,9 @@
@synthesize deviceready, eventQueue, applicationState, scheduledNotifications; @synthesize deviceready, eventQueue, applicationState, scheduledNotifications;
#pragma mark -
#pragma mark Plugin interface methods
/** /**
* Executes all queued events. * Executes all queued events.
*/ */
...@@ -110,8 +113,8 @@ ...@@ -110,8 +113,8 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC),
dispatch_get_main_queue(), ^{ dispatch_get_main_queue(), ^{
[self cancelNotification:notification fireEvent:NO]; [self cancelNotification:notification fireEvent:NO];
}); });
} }
[self scheduleNotificationWithProperties:properties]; [self scheduleNotificationWithProperties:properties];
...@@ -216,6 +219,9 @@ ...@@ -216,6 +219,9 @@
}]; }];
} }
#pragma mark -
#pragma mark Plugin core methods
/** /**
* Schedules a new local notification and fies the coresponding event. * Schedules a new local notification and fies the coresponding event.
* *
...@@ -286,52 +292,6 @@ ...@@ -286,52 +292,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. * Creates an notification object based on the given properties.
* *
* @param {NSMutableDictionary} properties * @param {NSMutableDictionary} properties
...@@ -379,6 +339,9 @@ ...@@ -379,6 +339,9 @@
return notification; return notification;
} }
#pragma mark -
#pragma mark Plugin delegate and life cycle methods
/** /**
* Calls the cancel or trigger event after a local notification was received. * Calls the cancel or trigger event after a local notification was received.
* Cancels the local notification if autoCancel was set to true. * Cancels the local notification if autoCancel was set to true.
...@@ -457,6 +420,55 @@ ...@@ -457,6 +420,55 @@
[self cancelAllNotificationsWhichAreOlderThen:432000]; [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. * Checks weather the given string is empty or not.
* *
...@@ -553,6 +565,9 @@ ...@@ -553,6 +565,9 @@
return notificationsWithoutNIL; return notificationsWithoutNIL;
} }
#pragma mark -
#pragma mark Plugin callback methods
/** /**
* Simply invokes the callback without any parameter. * Simply invokes the callback without any parameter.
*/ */
......
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