添加默认响铃

This commit is contained in:
Fin 2024-07-26 17:10:50 +08:00
parent 78f2c8a5c8
commit f588f839df

View File

@ -63,12 +63,19 @@ class CallProcessor: NotificationContentProcessor {
self.startAudioWorkCompletion = completion
let sound = ((content.userInfo["aps"] as? [String: Any])?["sound"] as? String)?.split(separator: ".")
let soundName = sound?.first ?? "multiwayinvitation"
let soundType = sound?.last ?? "caf"
let soundName: String
let soundType: String
if sound?.count == 2, let first = sound?.first, let last = sound?.last {
soundName = String(first)
soundType = String(last)
} else {
soundName = "multiwayinvitation"
soundType = "caf"
}
//
guard let audioPath = getSoundInCustomSoundsDirectory(soundName: "\(soundName).\(soundType)") ??
Bundle.main.path(forResource: String(soundName), ofType: String(soundType))
Bundle.main.path(forResource: soundName, ofType: soundType)
else {
completion()
return