From 229137d8c7f044dbda90e0d6fdf5f46666b0770d Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Thu, 7 Dec 2017 22:07:24 +0300
Subject: handle foreground push
---
Juick/AppDelegate.m | 18 ++++++++++++++----
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 @@
CFBundleSignature
????
CFBundleVersion
- 1.0.28
+ 1.0.29
ITSAppUsesNonExemptEncryption
LSApplicationCategoryType
--
cgit v1.2.3