Commit 208d13ea by Sebastián Katzer

Added 'secondly' and 'minutely' as new repeat time aliases (Solves #102)

parent f43aa60d
...@@ -54,6 +54,7 @@ More informations can be found [here](https://build.phonegap.com/plugins/413). ...@@ -54,6 +54,7 @@ More informations can be found [here](https://build.phonegap.com/plugins/413).
- [bugfix:] cancel callbacks have not been fired after all notifications have been canceled on iOS. - [bugfix:] cancel callbacks have not been fired after all notifications have been canceled on iOS.
- [change:] The `oncancel` callback will be called at last if `autoCancel` is set to true (iOS). - [change:] The `oncancel` callback will be called at last if `autoCancel` is set to true (iOS).
- [bugfix:] Callbacks for non-repeating notifications were not called if they were not created in the current app instance on iOS. - [bugfix:] Callbacks for non-repeating notifications were not called if they were not created in the current app instance on iOS.
- [enhancement:] Added 'secondly' and 'minutely' as new repeat time aliases.
#### Version 0.7.2 (09.02.2014) #### Version 0.7.2 (09.02.2014)
- [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**. - [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**.
...@@ -141,7 +142,7 @@ window.plugin.notification.local.add({ ...@@ -141,7 +142,7 @@ window.plugin.notification.local.add({
date: Date, // This expects a date object date: Date, // This expects a date object
message: String, // The message that is displayed message: String, // The message that is displayed
title: String, // The title of the message title: String, // The title of the message
repeat: String, // Has the options of 'hourly', 'daily', 'weekly', 'monthly', 'yearly' repeat: String, // Has the options of 'secondly', 'minutely', 'hourly', 'daily', 'weekly', 'monthly', 'yearly'
badge: Number, // Displays number badge to notification badge: Number, // Displays number badge to notification
sound: String, // A sound to be played sound: String, // A sound to be played
json: String, // Data to be passed through the notification json: String, // Data to be passed through the notification
......
...@@ -58,7 +58,11 @@ public class Options { ...@@ -58,7 +58,11 @@ public class Options {
this.options = options; this.options = options;
if (repeat.equalsIgnoreCase("hourly")) { if (repeat.equalsIgnoreCase("secondly")) {
interval = 1000;
} if (repeat.equalsIgnoreCase("minutely")) {
interval = AlarmManager.INTERVAL_FIFTEEN_MINUTES / 15;
} if (repeat.equalsIgnoreCase("hourly")) {
interval = AlarmManager.INTERVAL_HOUR; interval = AlarmManager.INTERVAL_HOUR;
} if (repeat.equalsIgnoreCase("daily")) { } if (repeat.equalsIgnoreCase("daily")) {
interval = AlarmManager.INTERVAL_DAY; interval = AlarmManager.INTERVAL_DAY;
......
...@@ -199,20 +199,24 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; ...@@ -199,20 +199,24 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
NSMutableDictionary* repeatDict = [[NSMutableDictionary alloc] init]; NSMutableDictionary* repeatDict = [[NSMutableDictionary alloc] init];
#ifdef NSCalendarUnitHour #ifdef NSCalendarUnitHour
[repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitHour] forKey:@"hourly"]; [repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitSecond] forKey:@"secondly"];
[repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitDay] forKey:@"daily"]; [repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitMinute] forKey:@"minutely"];
[repeatDict setObject:[NSNumber numberWithInt:NSWeekCalendarUnit] forKey:@"weekly"]; [repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitHour] forKey:@"hourly"];
[repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitMonth] forKey:@"monthly"]; [repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitDay] forKey:@"daily"];
[repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitYear] forKey:@"yearly"]; [repeatDict setObject:[NSNumber numberWithInt:NSWeekCalendarUnit] forKey:@"weekly"];
[repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitMonth] forKey:@"monthly"];
[repeatDict setObject:[NSNumber numberWithInt:NSCalendarUnitYear] forKey:@"yearly"];
#else #else
[repeatDict setObject:[NSNumber numberWithInt:NSHourCalendarUnit] forKey:@"hourly"]; [repeatDict setObject:[NSNumber numberWithInt:NSSecondCalendarUnit] forKey:@"secondly"];
[repeatDict setObject:[NSNumber numberWithInt:NSDayCalendarUnit] forKey:@"daily"]; [repeatDict setObject:[NSNumber numberWithInt:NSMinuteCalendarUnit] forKey:@"minutely"];
[repeatDict setObject:[NSNumber numberWithInt:NSWeekCalendarUnit] forKey:@"weekly"]; [repeatDict setObject:[NSNumber numberWithInt:NSHourCalendarUnit] forKey:@"hourly"];
[repeatDict setObject:[NSNumber numberWithInt:NSMonthCalendarUnit] forKey:@"monthly"]; [repeatDict setObject:[NSNumber numberWithInt:NSDayCalendarUnit] forKey:@"daily"];
[repeatDict setObject:[NSNumber numberWithInt:NSYearCalendarUnit] forKey:@"yearly"]; [repeatDict setObject:[NSNumber numberWithInt:NSWeekCalendarUnit] forKey:@"weekly"];
[repeatDict setObject:[NSNumber numberWithInt:NSMonthCalendarUnit] forKey:@"monthly"];
[repeatDict setObject:[NSNumber numberWithInt:NSYearCalendarUnit] forKey:@"yearly"];
#endif #endif
[repeatDict setObject:[NSNumber numberWithInt:NSEraCalendarUnit] forKey:@""]; [repeatDict setObject:[NSNumber numberWithInt:NSEraCalendarUnit] forKey:@""];
return repeatDict; return repeatDict;
} }
......
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