mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
新增通知中断级别参数
This commit is contained in:
parent
3adf99e93e
commit
0cea545dbd
@ -250,6 +250,19 @@ class NotificationService: UNNotificationServiceExtension {
|
|||||||
|
|
||||||
let userInfo = bestAttemptContent.userInfo
|
let userInfo = bestAttemptContent.userInfo
|
||||||
|
|
||||||
|
// 通知中断级别
|
||||||
|
if #available(iOSApplicationExtension 15.0, *) {
|
||||||
|
if let level = userInfo["level"] as? String {
|
||||||
|
let interruptionLevels: [String: UNNotificationInterruptionLevel] = [
|
||||||
|
"passive": UNNotificationInterruptionLevel.passive,
|
||||||
|
"active": UNNotificationInterruptionLevel.active,
|
||||||
|
"timeSensitive": UNNotificationInterruptionLevel.timeSensitive,
|
||||||
|
"critical": UNNotificationInterruptionLevel.critical,
|
||||||
|
]
|
||||||
|
bestAttemptContent.interruptionLevel = interruptionLevels[level] ?? .active
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 自动复制
|
// 自动复制
|
||||||
autoCopy(userInfo, defaultCopy: bestAttemptContent.body)
|
autoCopy(userInfo, defaultCopy: bestAttemptContent.body)
|
||||||
// 保存推送
|
// 保存推送
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user