diff --git a/Puffery.xcodeproj/xcuserdata/vknabel.xcuserdatad/xcschemes/xcschememanagement.plist b/Puffery.xcodeproj/xcuserdata/vknabel.xcuserdatad/xcschemes/xcschememanagement.plist index c503fdf..1b379a2 100644 --- a/Puffery.xcodeproj/xcuserdata/vknabel.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Puffery.xcodeproj/xcuserdata/vknabel.xcuserdatad/xcschemes/xcschememanagement.plist @@ -42,7 +42,7 @@ PufferyWidgetExtension.xcscheme_^#shared#^_ orderHint - 8 + 9 SuppressBuildableAutocreation diff --git a/Puffery/AppDelegate.swift b/Puffery/AppDelegate.swift index 5ce507c..fb609f0 100644 --- a/Puffery/AppDelegate.swift +++ b/Puffery/AppDelegate.swift @@ -43,6 +43,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { pufferyApp.didRegisterForRemoteNotifications(with: deviceToken) } + func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { + Widgets.reloadAll() + } + func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { Widgets.reloadAll() completionHandler(.newData) diff --git a/Puffery/Info.plist b/Puffery/Info.plist index cda9076..be987df 100644 --- a/Puffery/Info.plist +++ b/Puffery/Info.plist @@ -74,6 +74,10 @@ + UIBackgroundModes + + remote-notification + UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities diff --git a/Puffery/Puffery.entitlements b/Puffery/Puffery.entitlements index eed35c6..a3d640f 100644 --- a/Puffery/Puffery.entitlements +++ b/Puffery/Puffery.entitlements @@ -13,8 +13,6 @@ com.apple.security.app-sandbox - com.apple.security.device.audio-input - com.apple.security.network.client com.apple.security.personal-information.photos-library diff --git a/Puffery/PufferyDebug.entitlements b/Puffery/PufferyDebug.entitlements index eed35c6..a3d640f 100644 --- a/Puffery/PufferyDebug.entitlements +++ b/Puffery/PufferyDebug.entitlements @@ -13,8 +13,6 @@ com.apple.security.app-sandbox - com.apple.security.device.audio-input - com.apple.security.network.client com.apple.security.personal-information.photos-library diff --git a/PufferyKit/Sources/PlatformSupport/NotificationsService.swift b/PufferyKit/Sources/PlatformSupport/NotificationsService.swift index db5d377..a484884 100644 --- a/PufferyKit/Sources/PlatformSupport/NotificationsService.swift +++ b/PufferyKit/Sources/PlatformSupport/NotificationsService.swift @@ -15,15 +15,14 @@ import UserNotifications didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void ) { - defer { - DispatchQueue.main.async(execute: Widgets.reloadAll) - } if let subscribedChannel = ReceivedMessageNotification(content: response.notification.request.content) { NotificationCenter.default.post(name: .receivedMessage, object: nil, userInfo: [ "ReceivedMessageNotification": subscribedChannel, ]) + DispatchQueue.main.async(execute: Widgets.reloadAll) completionHandler() } else { + DispatchQueue.main.async(execute: Widgets.reloadAll) completionHandler() } } diff --git a/ReceivedMessageNotification.apns b/ReceivedMessageNotification.apns index 498ddb5..de37d4e 100644 --- a/ReceivedMessageNotification.apns +++ b/ReceivedMessageNotification.apns @@ -6,7 +6,8 @@ "body": "Some new details", }, "sound": "default", - "badge": 1 + "badge": 1, + "content-available": 1 }, "subscribedChannelID": "912732A6-7A55-4A97-B80C-327BE73525EF", "receivedMessageID": "DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF"