Loading src/ios/AppDelegate+notification.m +2 −2 Changes for src/ios/AppDelegate+notification.m: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ static char launchNotificationKey; if (appState == UIApplicationStateActive) { PushPlugin *pushHandler = [self getCommandInstance:@"PushPlugin"]; pushHandler.notificationMessage = [userInfo objectForKey:@"aps"]; pushHandler.notificationMessage = userInfo; pushHandler.isInline = YES; [pushHandler notificationReceived]; } else { Loading @@ -58,7 +58,7 @@ static char launchNotificationKey; if (![self.viewController.webView isLoading] && self.launchNotification) { PushPlugin *pushHandler = [self getCommandInstance:@"PushPlugin"]; pushHandler.notificationMessage = [self.launchNotification objectForKey:@"aps"]; pushHandler.notificationMessage = self.launchNotification; self.launchNotification = nil; Loading src/ios/PushPlugin.m +22 −9 Changes for src/ios/PushPlugin.m: 22 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -156,15 +156,12 @@ - (void)notificationReceived { NSLog(@"Notification received"); NSLog(@"Msg: %@", [notificationMessage descriptionWithLocale:[NSLocale currentLocale] indent:4]); if (notificationMessage) { if (notificationMessage) { NSMutableString *jsonStr = [NSMutableString stringWithString:@"{"]; if ([notificationMessage objectForKey:@"alert"]) [jsonStr appendFormat:@"alert:'%@',", [[notificationMessage objectForKey:@"alert"] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]]; if ([notificationMessage objectForKey:@"badge"]) [jsonStr appendFormat:@"badge:%d,", [[notificationMessage objectForKey:@"badge"] intValue]]; [self parseDictionary:notificationMessage intoJSON:jsonStr]; if (isInline) { Loading @@ -172,11 +169,10 @@ isInline = NO; } if ([notificationMessage objectForKey:@"sound"]) [jsonStr appendFormat:@"sound:'%@',", [notificationMessage objectForKey:@"sound"]]; [jsonStr appendString:@"}"]; NSLog(@"Msg: %@", jsonStr); NSString * jsCallBack = [NSString stringWithFormat:@"%@(%@);", self.callback, jsonStr]; [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack]; Loading @@ -184,6 +180,23 @@ } } // reentrant method to drill down and surface all sub-dictionaries' key/value pairs into the top level json -(void)parseDictionary:(NSDictionary *)inDictionary intoJSON:(NSMutableString *)jsonString { NSArray *keys = [inDictionary allKeys]; NSString *key; for (key in keys) { id thisObject = [inDictionary objectForKey:key]; if ([thisObject isKindOfClass:[NSDictionary class]]) [self parseDictionary:thisObject intoJSON:jsonString]; else [jsonString appendFormat:@"%@:'%@',", key, [inDictionary objectForKey:key]]; } } - (void)setApplicationIconBadgeNumber:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { DLog(@"setApplicationIconBadgeNumber:%@\n withDict:%@", arguments, options); Loading Loading
src/ios/AppDelegate+notification.m +2 −2 Changes for src/ios/AppDelegate+notification.m: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ static char launchNotificationKey; if (appState == UIApplicationStateActive) { PushPlugin *pushHandler = [self getCommandInstance:@"PushPlugin"]; pushHandler.notificationMessage = [userInfo objectForKey:@"aps"]; pushHandler.notificationMessage = userInfo; pushHandler.isInline = YES; [pushHandler notificationReceived]; } else { Loading @@ -58,7 +58,7 @@ static char launchNotificationKey; if (![self.viewController.webView isLoading] && self.launchNotification) { PushPlugin *pushHandler = [self getCommandInstance:@"PushPlugin"]; pushHandler.notificationMessage = [self.launchNotification objectForKey:@"aps"]; pushHandler.notificationMessage = self.launchNotification; self.launchNotification = nil; Loading
src/ios/PushPlugin.m +22 −9 Changes for src/ios/PushPlugin.m: 22 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -156,15 +156,12 @@ - (void)notificationReceived { NSLog(@"Notification received"); NSLog(@"Msg: %@", [notificationMessage descriptionWithLocale:[NSLocale currentLocale] indent:4]); if (notificationMessage) { if (notificationMessage) { NSMutableString *jsonStr = [NSMutableString stringWithString:@"{"]; if ([notificationMessage objectForKey:@"alert"]) [jsonStr appendFormat:@"alert:'%@',", [[notificationMessage objectForKey:@"alert"] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]]; if ([notificationMessage objectForKey:@"badge"]) [jsonStr appendFormat:@"badge:%d,", [[notificationMessage objectForKey:@"badge"] intValue]]; [self parseDictionary:notificationMessage intoJSON:jsonStr]; if (isInline) { Loading @@ -172,11 +169,10 @@ isInline = NO; } if ([notificationMessage objectForKey:@"sound"]) [jsonStr appendFormat:@"sound:'%@',", [notificationMessage objectForKey:@"sound"]]; [jsonStr appendString:@"}"]; NSLog(@"Msg: %@", jsonStr); NSString * jsCallBack = [NSString stringWithFormat:@"%@(%@);", self.callback, jsonStr]; [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack]; Loading @@ -184,6 +180,23 @@ } } // reentrant method to drill down and surface all sub-dictionaries' key/value pairs into the top level json -(void)parseDictionary:(NSDictionary *)inDictionary intoJSON:(NSMutableString *)jsonString { NSArray *keys = [inDictionary allKeys]; NSString *key; for (key in keys) { id thisObject = [inDictionary objectForKey:key]; if ([thisObject isKindOfClass:[NSDictionary class]]) [self parseDictionary:thisObject intoJSON:jsonString]; else [jsonString appendFormat:@"%@:'%@',", key, [inDictionary objectForKey:key]]; } } - (void)setApplicationIconBadgeNumber:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { DLog(@"setApplicationIconBadgeNumber:%@\n withDict:%@", arguments, options); Loading