Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2025-09-08 15:52:11 -05:00
parent f4f365f4c7
commit 6322f1cbd3
13 changed files with 24 additions and 18 deletions

View File

@ -38,11 +38,12 @@ enum NotificationUtils {
if soundName == AppConstants.SystemSounds.defaultSound { if soundName == AppConstants.SystemSounds.defaultSound {
content.sound = UNNotificationSound.default content.sound = UNNotificationSound.default
print("🔔 Using default notification sound")
} else { } else {
// For alarm sounds, use the default notification sound since custom sounds need to be in the app bundle // Use the sound name directly since sounds.json now references CAF files
// and properly configured. For now, use default to ensure notifications work. content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: soundName))
content.sound = UNNotificationSound.default print("🔔 Using custom alarm sound: \(soundName)")
print("🔔 Using default notification sound for alarm: \(soundName)") print("🔔 Sound file should be in main bundle: \(soundName)")
} }
return content return content

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -27,42 +27,42 @@
{ {
"id": "digital-alarm", "id": "digital-alarm",
"name": "Digital Alarm", "name": "Digital Alarm",
"fileName": "digital-alarm.mp3", "fileName": "digital-alarm.caf",
"category": "alarm", "category": "alarm",
"description": "Classic digital alarm sound", "description": "Classic digital alarm sound",
"bundleName": "AlarmSounds" "bundleName": null
}, },
{ {
"id": "iphone-alarm", "id": "iphone-alarm",
"name": "Buzzing Alarm", "name": "Buzzing Alarm",
"fileName": "buzzing-alarm.mp3", "fileName": "buzzing-alarm.caf",
"category": "alarm", "category": "alarm",
"description": "Buzzing sound", "description": "Buzzing sound",
"bundleName": "AlarmSounds" "bundleName": null
}, },
{ {
"id": "classic-alarm", "id": "classic-alarm",
"name": "Classic Alarm", "name": "Classic Alarm",
"fileName": "classic-alarm.mp3", "fileName": "classic-alarm.caf",
"category": "alarm", "category": "alarm",
"description": "Traditional alarm sound", "description": "Traditional alarm sound",
"bundleName": "AlarmSounds" "bundleName": null
}, },
{ {
"id": "beep-alarm", "id": "beep-alarm",
"name": "Beep Alarm", "name": "Beep Alarm",
"fileName": "beep-alarm.mp3", "fileName": "beep-alarm.caf",
"category": "alarm", "category": "alarm",
"description": "Short beep alarm sound", "description": "Short beep alarm sound",
"bundleName": "AlarmSounds" "bundleName": null
}, },
{ {
"id": "siren-alarm", "id": "siren-alarm",
"name": "Siren Alarm", "name": "Siren Alarm",
"fileName": "siren-alarm.mp3", "fileName": "siren-alarm.caf",
"category": "alarm", "category": "alarm",
"description": "Emergency siren alarm for heavy sleepers", "description": "Emergency siren alarm for heavy sleepers",
"bundleName": "AlarmSounds" "bundleName": null
} }
], ],
"categories": [ "categories": [

View File

@ -100,10 +100,15 @@ class FocusModeService {
let content = UNMutableNotificationContent() let content = UNMutableNotificationContent()
content.title = title content.title = title
content.body = body content.body = body
// Use default notification sound for now to ensure notifications work // Use the sound name directly since sounds.json now references CAF files
// Custom sounds require proper bundle configuration if soundName == AppConstants.SystemSounds.defaultSound {
content.sound = UNNotificationSound.default content.sound = UNNotificationSound.default
print("🔔 Using default notification sound for alarm: \(soundName)") print("🔔 Using default notification sound")
} else {
content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: soundName))
print("🔔 Using custom alarm sound: \(soundName)")
print("🔔 Sound file should be in main bundle: \(soundName)")
}
content.categoryIdentifier = "ALARM_CATEGORY" content.categoryIdentifier = "ALARM_CATEGORY"
content.userInfo = [ content.userInfo = [
"alarmId": identifier, "alarmId": identifier,