mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
添加默认响铃
This commit is contained in:
parent
78f2c8a5c8
commit
f588f839df
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user