mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-09 00:28:53 +01:00
Add icon badge notification number.
This commit is contained in:
parent
91e009932b
commit
717d09b2be
@ -9,6 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
import RSCore
|
import RSCore
|
||||||
import Account
|
import Account
|
||||||
|
import UserNotifications
|
||||||
|
|
||||||
var appDelegate: AppDelegate!
|
var appDelegate: AppDelegate!
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
|||||||
didSet {
|
didSet {
|
||||||
if unreadCount != oldValue {
|
if unreadCount != oldValue {
|
||||||
postUnreadCountDidChangeNotification()
|
postUnreadCountDidChangeNotification()
|
||||||
|
UIApplication.shared.applicationIconBadgeNumber = unreadCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,6 +80,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
|||||||
self.unreadCount = AccountManager.shared.unreadCount
|
self.unreadCount = AccountManager.shared.unreadCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNUserNotificationCenter.current().requestAuthorization(options:[.badge]) { (granted, error) in
|
||||||
|
if granted {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
UIApplication.shared.registerForRemoteNotifications()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user