summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-30 00:16:53 +0300
committerGravatar Vitaly Takmazov2018-11-30 00:16:53 +0300
commit655a02b7695088b9dbaffd3ac9b7b867dcb11cfa (patch)
treee35cbc7fa2efe065735fcee00675db0ac7ac8ca4
parentd9a3f3beace0ff46632f9287024bb12eb9d1eec9 (diff)
Fix badge counter and enable background mode for silent notifications
-rw-r--r--Juick.xcodeproj/project.pbxproj3
-rw-r--r--Juick/AppDelegate.m1
2 files changed, 4 insertions, 0 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj
index 7500fb5..2ffe164 100644
--- a/Juick.xcodeproj/project.pbxproj
+++ b/Juick.xcodeproj/project.pbxproj
@@ -430,6 +430,9 @@
77317BA7181BBE8500D60005 = {
DevelopmentTeam = KH4MX79ZK7;
SystemCapabilities = {
+ com.apple.BackgroundModes = {
+ enabled = 1;
+ };
com.apple.Push = {
enabled = 1;
};
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index d5d5b9b..950f473 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -104,6 +104,7 @@
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
if (userInfo[@"service"]) {
+ application.applicationIconBadgeNumber = [userInfo[@"user"][@"unreadCount"] integerValue];
[[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> * _Nonnull notifications) {
for (UNNotification* notification in notifications) {
if ([notification.request.content.userInfo[@"mid"] integerValue] == [userInfo[@"mid"] integerValue]) {