Browse Source

Added support for title property

Sebastián Katzer 12 years ago
parent
commit
fe2116db50
1 changed files with 7 additions and 6 deletions
  1. 7 6
      src/ios/APPLocalNotification.m

+ 7 - 6
src/ios/APPLocalNotification.m

@@ -103,8 +103,9 @@
 {
 	double               timestamp          = [[options objectForKey:@"date"] doubleValue];
 	NSString*            msg                = [options objectForKey:@"message"];
-    NSString*            sound              = [options objectForKey:@"sound"];
-    NSString*            repeat             = [options objectForKey:@"repeat"];
+	NSString*            title              = [options objectForKey:@"title"];
+	NSString*            sound              = [options objectForKey:@"sound"];
+	NSString*            repeat             = [options objectForKey:@"repeat"];
 	NSInteger            badge              = [[options objectForKey:@"badge"] intValue];
 
 	NSDate*              date               = [NSDate dateWithTimeIntervalSince1970:timestamp];
@@ -112,10 +113,10 @@
 
 	notification.fireDate                   = date;
 	notification.timeZone                   = [NSTimeZone defaultTimeZone];
-    notification.repeatInterval             = [[[self repeatDict] objectForKey: repeat] intValue];
-	notification.alertBody                  = ([msg isEqualToString:@""]) ? nil : msg;
-    notification.soundName                  = sound;
-    notification.applicationIconBadgeNumber = badge;
+	notification.repeatInterval             = [[[self repeatDict] objectForKey: repeat] intValue];
+	notification.alertBody                  = title ? [NSString stringWithFormat:@"%@\n%@", title, msg] : msg;
+	notification.soundName                  = sound;
+	notification.applicationIconBadgeNumber = badge;
 
     return notification;
 }