mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add boot detection in the NSE and use this to inform the user that there may be more notifications. (#5054)
* Add an initial implementation of the receivedWhileOfflineNotification. * Only deliver a single receivedWhileOffline notification per boot and clarify the API. * Add a 15-minute threshold for the receiveWhileOfflineNotification.
This commit is contained in:
@@ -56,8 +56,14 @@ final class NotificationManager: NSObject, NotificationManagerProtocol {
|
||||
self?.enableNotifications(newValue)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)
|
||||
.sink { [weak self] _ in
|
||||
self?.removeReceivedWhileOfflineNotification()
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func requestAuthorization() {
|
||||
guard appSettings.enableNotifications, !userSession.isNil else { return }
|
||||
Task {
|
||||
@@ -151,6 +157,10 @@ final class NotificationManager: NSObject, NotificationManagerProtocol {
|
||||
|
||||
notificationCenter.removeDeliveredNotifications(withIdentifiers: notificationsIdentifiers)
|
||||
}
|
||||
|
||||
private func removeReceivedWhileOfflineNotification() {
|
||||
notificationCenter.removeDeliveredNotifications(withIdentifiers: [NotificationServiceExtension.receivedWhileOfflineNotificationID])
|
||||
}
|
||||
|
||||
private func setPusher(with deviceToken: Data, clientProxy: ClientProxyProtocol) async -> Bool {
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user