优化重要警告判断代码

This commit is contained in:
Fin 2025-01-24 14:47:44 +08:00
parent 3513d2afb3
commit 8b49d6cc96
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ extension CallProcessor {
}
if let longSoundUrl = getLongSound(soundName: soundName, soundType: soundType) {
if let level = content.userInfo["level"] as? String, level == "critical" {
if content.isCritical {
LevelProcessor.setCriticalSound(content: content, soundName: longSoundUrl.lastPathComponent)
} else {
content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: longSoundUrl.lastPathComponent))

View File

@ -15,7 +15,7 @@ class LevelProcessor: NotificationContentProcessor {
return bestAttemptContent
}
if let level = bestAttemptContent.userInfo["level"] as? String, level == "critical" {
if bestAttemptContent.isCritical {
//
LevelProcessor.setCriticalSound(content: bestAttemptContent)
return bestAttemptContent
@ -39,7 +39,7 @@ class LevelProcessor: NotificationContentProcessor {
extension LevelProcessor {
class func setCriticalSound(content bestAttemptContent: UNMutableNotificationContent, soundName: String? = nil) {
guard let level = bestAttemptContent.userInfo["level"] as? String, level == "critical" else {
guard bestAttemptContent.isCritical else {
return
}
//