Commit 00fe2003 by Sebastián Katzer

Back-port PR's from master

parent c02c926a
## ChangeLog ## ChangeLog
#### Version 0.7.6 (03.10.2014)
- [bugfix:] `hasPermission` and `promptForPermission` let the app crash on iOS7 and older.
- [bugfix:] Convert the id value to a String before comparison.
- [bugfix:] Prevent possible crash when calling `cancelAll`.
- [enhancement:] Do not inherit any notification defaults.
#### Version 0.7.5 (29.09.2014) #### Version 0.7.5 (29.09.2014)
- [enhancement:] __iOS8 Support__ - [enhancement:] __iOS8 Support__
- [feature:] New method `hasPermission` to ask if the user has granted to display local notifications. - [feature:] New method `hasPermission` to ask if the user has granted to display local notifications.
......
...@@ -70,6 +70,12 @@ More informations can be found [here][PGB_plugin]. ...@@ -70,6 +70,12 @@ More informations can be found [here][PGB_plugin].
## ChangeLog ## ChangeLog
#### Version 0.7.6 (03.10.2014)
- [bugfix:] `hasPermission` and `promptForPermission` let the app crash on iOS7 and older.
- [bugfix:] Convert the id value to a String before comparison.
- [bugfix:] Prevent possible crash when calling `cancelAll`.
- [enhancement:] Do not inherit any notification defaults.
#### Version 0.7.5 (29.09.2014) #### Version 0.7.5 (29.09.2014)
- [enhancement:] __iOS8 Support__ - [enhancement:] __iOS8 Support__
- [feature:] New method `hasPermission` to ask if the user has granted to display local notifications. - [feature:] New method `hasPermission` to ask if the user has granted to display local notifications.
......
...@@ -122,6 +122,7 @@ public class Receiver extends BroadcastReceiver { ...@@ -122,6 +122,7 @@ public class Receiver extends BroadcastReceiver {
Uri sound = options.getSound(); Uri sound = options.getSound();
Builder notification = new Notification.Builder(context) Builder notification = new Notification.Builder(context)
.setDefaults(0) // Do not inherit any defaults
.setContentTitle(options.getTitle()) .setContentTitle(options.getTitle())
.setContentText(options.getMessage()) .setContentText(options.getMessage())
.setNumber(options.getBadge()) .setNumber(options.getBadge())
......
...@@ -102,11 +102,14 @@ ...@@ -102,11 +102,14 @@
NSArray* arguments = [command arguments]; NSArray* arguments = [command arguments];
NSMutableDictionary* properties = [arguments objectAtIndex:0]; NSMutableDictionary* properties = [arguments objectAtIndex:0];
UILocalNotification* notification;
NSString* id = [properties objectForKey:@"id"]; NSString* id = [properties objectForKey:@"id"];
if ([self isNotificationScheduledWithId:id]) { if ([self isNotificationScheduledWithId:id]) {
UILocalNotification* notification = [self notificationWithId:id]; notification = [self notificationWithId:id];
}
if (notification) {
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];
...@@ -576,7 +579,8 @@ ...@@ -576,7 +579,8 @@
for (UILocalNotification* notification in notifications) for (UILocalNotification* notification in notifications)
{ {
NSString* notId = [notification.userInfo objectForKey:@"id"]; NSString* notId = [[notification.userInfo objectForKey:@"id"]
stringValue];
if ([notId isEqualToString:id]) { if ([notId isEqualToString:id]) {
return notification; return notification;
......
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