diff options
Diffstat (limited to 'Juick/AppDelegate.m')
-rw-r--r-- | Juick/AppDelegate.m | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index 04a441c..26b10a8 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -17,6 +17,10 @@ #import "DeviceRegistration.h" #import "NewPostViewController.h" +@interface AppDelegate() +-(void) parseNotificationPayload:(NSDictionary *)userInfo; +@end + @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions @@ -30,9 +34,7 @@ [self registerForRemoteNotifications]; NSDictionary *userInfo = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]; - if (userInfo != nil) { - self.pushedThread = [userInfo objectForKey:@"mid"]; - } + [self parseNotificationPayload:userInfo]; return YES; } @@ -68,7 +70,9 @@ //Called when a notification is delivered to a foreground app. -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{ - NSLog(@"User Info : %@",notification.request.content.userInfo); + NSDictionary *userInfo = notification.request.content.userInfo; + NSLog(@"User Info : %@", userInfo); + [self parseNotificationPayload:userInfo]; completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge); } @@ -78,4 +82,10 @@ completionHandler(); } +-(void) parseNotificationPayload:(NSDictionary *)userInfo { + if (userInfo != nil) { + self.pushedThread = [userInfo objectForKey:@"mid"]; + } +} + @end |