iOS push notification custom sound

This commit is contained in:
2026-01-12 01:08:52 +08:00
parent bf2844162d
commit 4ac10706ae
4 changed files with 15 additions and 3 deletions

View File

@@ -53,8 +53,10 @@ class NotificationService: UNNotificationServiceExtension {
private func processNotification(request: UNNotificationRequest, content: UNMutableNotificationContent) throws {
switch content.userInfo["type"] as? String {
case "messages.new":
content.sound = UNNotificationSound(named: UNNotificationSoundName("SfxMessage.caf"))
try handleMessagingNotification(request: request, content: content)
default:
content.sound = UNNotificationSound(named: UNNotificationSoundName("SfxNotification.caf"))
try handleDefaultNotification(content: content)
}
}