mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
调整推送
This commit is contained in:
parent
2db35c6048
commit
a60ab895d7
@ -13,7 +13,7 @@ import RealmSwift
|
||||
import IceCream
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate{
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate{
|
||||
|
||||
var window: UIWindow?
|
||||
var syncEngine: SyncEngine?
|
||||
@ -34,6 +34,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate{
|
||||
UNUserNotificationCenter.current().getNotificationSettings { (settings) in
|
||||
dispatch_sync_safely_main_queue {
|
||||
if settings.authorizationStatus == .authorized {
|
||||
UNUserNotificationCenter.current().delegate = self
|
||||
Client.shared.registerForRemoteNotifications()
|
||||
}
|
||||
}
|
||||
@ -77,7 +78,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate{
|
||||
//注册设备
|
||||
Client.shared.bindDeviceToken()
|
||||
}
|
||||
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
||||
notificatonHandler(userInfo: notification.request.content.userInfo)
|
||||
}
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
||||
notificatonHandler(userInfo: response.notification.request.content.userInfo)
|
||||
}
|
||||
private func notificatonHandler(userInfo:[AnyHashable:Any]){
|
||||
|
||||
let navigationController = ((self.window?.rootViewController as? BarkSnackbarController)?
|
||||
.rootViewController as? BarkNavigationController)
|
||||
@ -150,7 +157,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate{
|
||||
else{
|
||||
presentController()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user