Files
letro-ios/ElementX/Sources/Other/Extensions/UNNotificationContent.swift
Doug 9b6324b295 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.
2026-02-06 15:18:09 +00:00

75 lines
2.2 KiB
Swift

//
// Copyright 2025 Element Creations Ltd.
// Copyright 2023-2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Foundation
import UserNotifications
extension UNNotificationContent {
@objc var receiverID: String? {
userInfo[NotificationConstants.UserInfoKey.receiverIdentifier] as? String
}
@objc var roomID: String? {
userInfo[NotificationConstants.UserInfoKey.roomIdentifier] as? String
}
@objc var eventID: String? {
userInfo[NotificationConstants.UserInfoKey.eventIdentifier] as? String
}
@objc var pusherNotificationClientIdentifier: String? {
userInfo[NotificationConstants.UserInfoKey.pusherNotificationClientIdentifier] as? String
}
@objc var threadRootEventID: String? {
userInfo[NotificationConstants.UserInfoKey.threadRootEventIdentifier] as? String
}
var unreadCount: Int? {
userInfo[NotificationConstants.UserInfoKey.unreadCount] as? Int
}
}
extension UNMutableNotificationContent {
override var receiverID: String? {
get {
userInfo[NotificationConstants.UserInfoKey.receiverIdentifier] as? String
}
set {
userInfo[NotificationConstants.UserInfoKey.receiverIdentifier] = newValue
}
}
override var roomID: String? {
get {
userInfo[NotificationConstants.UserInfoKey.roomIdentifier] as? String
}
set {
userInfo[NotificationConstants.UserInfoKey.roomIdentifier] = newValue
}
}
override var eventID: String? {
get {
userInfo[NotificationConstants.UserInfoKey.eventIdentifier] as? String
}
set {
userInfo[NotificationConstants.UserInfoKey.eventIdentifier] = newValue
}
}
override var threadRootEventID: String? {
get {
userInfo[NotificationConstants.UserInfoKey.threadRootEventIdentifier] as? String
}
set {
userInfo[NotificationConstants.UserInfoKey.threadRootEventIdentifier] = newValue
}
}
}