diff --git a/TheNoiseClock/Core/Utilities/NotificationUtils.swift b/TheNoiseClock/Core/Utilities/NotificationUtils.swift index 1f42a9b..1276043 100644 --- a/TheNoiseClock/Core/Utilities/NotificationUtils.swift +++ b/TheNoiseClock/Core/Utilities/NotificationUtils.swift @@ -38,11 +38,12 @@ enum NotificationUtils { if soundName == AppConstants.SystemSounds.defaultSound { content.sound = UNNotificationSound.default + print("🔔 Using default notification sound") } else { - // For alarm sounds, use the default notification sound since custom sounds need to be in the app bundle - // and properly configured. For now, use default to ensure notifications work. - content.sound = UNNotificationSound.default - print("🔔 Using default notification sound for alarm: \(soundName)") + // Use the sound name directly since sounds.json now references CAF files + content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: soundName)) + print("🔔 Using custom alarm sound: \(soundName)") + print("🔔 Sound file should be in main bundle: \(soundName)") } return content diff --git a/TheNoiseClock/Resources/AlarmSounds.bundle/beep-alarm.mp3 b/TheNoiseClock/Resources/AlarmSounds.bundle/beep-alarm.mp3 deleted file mode 100644 index 4be0312..0000000 Binary files a/TheNoiseClock/Resources/AlarmSounds.bundle/beep-alarm.mp3 and /dev/null differ diff --git a/TheNoiseClock/Resources/AlarmSounds.bundle/buzzing-alarm.mp3 b/TheNoiseClock/Resources/AlarmSounds.bundle/buzzing-alarm.mp3 deleted file mode 100644 index 40c22a6..0000000 Binary files a/TheNoiseClock/Resources/AlarmSounds.bundle/buzzing-alarm.mp3 and /dev/null differ diff --git a/TheNoiseClock/Resources/AlarmSounds.bundle/classic-alarm.mp3 b/TheNoiseClock/Resources/AlarmSounds.bundle/classic-alarm.mp3 deleted file mode 100644 index b9ca5cf..0000000 Binary files a/TheNoiseClock/Resources/AlarmSounds.bundle/classic-alarm.mp3 and /dev/null differ diff --git a/TheNoiseClock/Resources/AlarmSounds.bundle/digital-alarm.mp3 b/TheNoiseClock/Resources/AlarmSounds.bundle/digital-alarm.mp3 deleted file mode 100644 index a8f4cc0..0000000 Binary files a/TheNoiseClock/Resources/AlarmSounds.bundle/digital-alarm.mp3 and /dev/null differ diff --git a/TheNoiseClock/Resources/AlarmSounds.bundle/siren-alarm.mp3 b/TheNoiseClock/Resources/AlarmSounds.bundle/siren-alarm.mp3 deleted file mode 100644 index 9dba51d..0000000 Binary files a/TheNoiseClock/Resources/AlarmSounds.bundle/siren-alarm.mp3 and /dev/null differ diff --git a/TheNoiseClock/Resources/AlarmSounds/beep-alarm.caf b/TheNoiseClock/Resources/AlarmSounds/beep-alarm.caf new file mode 100644 index 0000000..d634973 Binary files /dev/null and b/TheNoiseClock/Resources/AlarmSounds/beep-alarm.caf differ diff --git a/TheNoiseClock/Resources/AlarmSounds/buzzing-alarm.caf b/TheNoiseClock/Resources/AlarmSounds/buzzing-alarm.caf new file mode 100644 index 0000000..17de145 Binary files /dev/null and b/TheNoiseClock/Resources/AlarmSounds/buzzing-alarm.caf differ diff --git a/TheNoiseClock/Resources/AlarmSounds/classic-alarm.caf b/TheNoiseClock/Resources/AlarmSounds/classic-alarm.caf new file mode 100644 index 0000000..bec46fe Binary files /dev/null and b/TheNoiseClock/Resources/AlarmSounds/classic-alarm.caf differ diff --git a/TheNoiseClock/Resources/AlarmSounds/digital-alarm.caf b/TheNoiseClock/Resources/AlarmSounds/digital-alarm.caf new file mode 100644 index 0000000..2a1d78e Binary files /dev/null and b/TheNoiseClock/Resources/AlarmSounds/digital-alarm.caf differ diff --git a/TheNoiseClock/Resources/AlarmSounds/siren-alarm.caf b/TheNoiseClock/Resources/AlarmSounds/siren-alarm.caf new file mode 100644 index 0000000..a7bb46e Binary files /dev/null and b/TheNoiseClock/Resources/AlarmSounds/siren-alarm.caf differ diff --git a/TheNoiseClock/Resources/sounds.json b/TheNoiseClock/Resources/sounds.json index 099cf61..7789856 100644 --- a/TheNoiseClock/Resources/sounds.json +++ b/TheNoiseClock/Resources/sounds.json @@ -27,42 +27,42 @@ { "id": "digital-alarm", "name": "Digital Alarm", - "fileName": "digital-alarm.mp3", + "fileName": "digital-alarm.caf", "category": "alarm", "description": "Classic digital alarm sound", - "bundleName": "AlarmSounds" + "bundleName": null }, { "id": "iphone-alarm", "name": "Buzzing Alarm", - "fileName": "buzzing-alarm.mp3", + "fileName": "buzzing-alarm.caf", "category": "alarm", "description": "Buzzing sound", - "bundleName": "AlarmSounds" + "bundleName": null }, { "id": "classic-alarm", "name": "Classic Alarm", - "fileName": "classic-alarm.mp3", + "fileName": "classic-alarm.caf", "category": "alarm", "description": "Traditional alarm sound", - "bundleName": "AlarmSounds" + "bundleName": null }, { "id": "beep-alarm", "name": "Beep Alarm", - "fileName": "beep-alarm.mp3", + "fileName": "beep-alarm.caf", "category": "alarm", "description": "Short beep alarm sound", - "bundleName": "AlarmSounds" + "bundleName": null }, { "id": "siren-alarm", "name": "Siren Alarm", - "fileName": "siren-alarm.mp3", + "fileName": "siren-alarm.caf", "category": "alarm", "description": "Emergency siren alarm for heavy sleepers", - "bundleName": "AlarmSounds" + "bundleName": null } ], "categories": [ diff --git a/TheNoiseClock/Services/FocusModeService.swift b/TheNoiseClock/Services/FocusModeService.swift index 6b127d9..3c7729b 100644 --- a/TheNoiseClock/Services/FocusModeService.swift +++ b/TheNoiseClock/Services/FocusModeService.swift @@ -100,10 +100,15 @@ class FocusModeService { let content = UNMutableNotificationContent() content.title = title content.body = body - // Use default notification sound for now to ensure notifications work - // Custom sounds require proper bundle configuration - content.sound = UNNotificationSound.default - print("🔔 Using default notification sound for alarm: \(soundName)") + // Use the sound name directly since sounds.json now references CAF files + if soundName == AppConstants.SystemSounds.defaultSound { + content.sound = UNNotificationSound.default + 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.userInfo = [ "alarmId": identifier,