diff options
author | Vitaly Takmazov | 2017-12-07 22:07:24 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-12-07 22:07:24 +0300 |
commit | 229137d8c7f044dbda90e0d6fdf5f46666b0770d (patch) | |
tree | 88e91e6c27d06727cce0a41ebf9edd4fe3aa8746 /Juick | |
parent | d958ef04d427b284ccaa161a5634cd602802d415 (diff) |
handle foreground push
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/AppDelegate.m | 18 | ||||
-rw-r--r-- | Juick/Supporting Files/Juick-Info.plist | 2 |
2 files changed, 15 insertions, 5 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 diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index 7aabcda..f544bf8 100644 --- a/Juick/Supporting Files/Juick-Info.plist +++ b/Juick/Supporting Files/Juick-Info.plist @@ -21,7 +21,7 @@ <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>1.0.28</string> + <string>1.0.29</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>LSApplicationCategoryType</key> |