on master help sign in
Allow remote badge updates while app is in foreground
5427323Sam Tay
jsaddle-wkwebview/cbits-uikit/AppDelegate.m+7
@@ -109,6 +109,13 @@ HsStablePtr global_didFailToRegisterForRemoteNotificationsWithError = 0;
109 callWithCString([deviceTokenString UTF8String], global_didRegisterForRemoteNotificationsWithDeviceToken);
109 callWithCString([deviceTokenString UTF8String], global_didRegisterForRemoteNotificationsWithDeviceToken);
110}
110}
111
111
112+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
113+ // Sent when the application receives remote notifications in the foreground or background
114+ // TODO Allow a configurable CString -> IO () to be passed into AppDelegateConfig
115+ [UIApplication sharedApplication].applicationIconBadgeNumber=[[[userInfo objectForKey:@"aps"] valueForKey:@"badge"] intValue];
116+ completionHandler(UIBackgroundFetchResultNewData);
117+}
118+
112- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
119- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
113 // Sent to the delegate when Apple Push Notification service cannot successfully complete the registration process.
120 // Sent to the delegate when Apple Push Notification service cannot successfully complete the registration process.
114 NSString *errorString = [error localizedDescription];
121 NSString *errorString = [error localizedDescription];