From 71275813da8f8dccc7777eac0de2796bd199a22c Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Sat, 1 Oct 2022 14:20:21 +0100 Subject: [PATCH] add custom notification sound Added a blip sound file to the Resources and the iOS target. Changed the notification code to use the sound. --- NetNewsWire.xcodeproj/project.pbxproj | 4 ++++ .../UserNotificationManager.swift | 3 ++- iOS/Resources/notificationSoundBlip.caf | Bin 0 -> 7224 bytes 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 iOS/Resources/notificationSoundBlip.caf diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index adef6cf2a..3b5ab6fd8 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -853,6 +853,7 @@ D5F4EDB720074D6500B9E363 /* WebFeed+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB620074D6500B9E363 /* WebFeed+Scriptability.swift */; }; D5F4EDB920074D7C00B9E363 /* Folder+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB820074D7C00B9E363 /* Folder+Scriptability.swift */; }; DD82AB0A231003F6002269DF /* SharingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD82AB09231003F6002269DF /* SharingTests.swift */; }; + DDE6A35128E8741F00612823 /* notificationSoundBlip.caf in Resources */ = {isa = PBXBuildFile; fileRef = DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */; }; DF5AD10128D6922200CA3BF7 /* SmartFeedSummaryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */; }; DFD6AACF27ADE86E00463FAD /* NewsFax.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = DFD6AACD27ADE86E00463FAD /* NewsFax.nnwtheme */; }; DFFB8FC2279B75E300AC21D7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; @@ -1595,6 +1596,7 @@ D5F4EDB620074D6500B9E363 /* WebFeed+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WebFeed+Scriptability.swift"; sourceTree = ""; }; D5F4EDB820074D7C00B9E363 /* Folder+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Folder+Scriptability.swift"; sourceTree = ""; }; DD82AB09231003F6002269DF /* SharingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharingTests.swift; sourceTree = ""; }; + DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = notificationSoundBlip.caf; sourceTree = ""; }; DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; DFD6AACD27ADE86E00463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; DFFC199727A0D0D7004B7AEF /* NotificationsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsViewController.swift; sourceTree = ""; }; @@ -2740,6 +2742,7 @@ 514219572353C28900E07E2C /* main_ios.js */, 17D7586C2679C21700B17787 /* NetNewsWire-iOS-Bridging-Header.h */, 84C9FC9B2262A1A900D921D6 /* Assets.xcassets */, + DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */, 84C9FC9C2262A1A900D921D6 /* Info.plist */, 84BB0F812333426400DED65E /* NetNewsWire.entitlements */, 51F805ED24284C1C0022C792 /* NetNewsWire-dev.entitlements */, @@ -3447,6 +3450,7 @@ 516A09422361248000EAE89B /* Inspector.storyboard in Resources */, 51DEE81A26FBFF84006DAA56 /* Promenade.nnwtheme in Resources */, 1768140B2564BB8300D98635 /* NetNewsWire_iOSwidgetextension_target.xcconfig in Resources */, + DDE6A35128E8741F00612823 /* notificationSoundBlip.caf in Resources */, 5103A9B424216A4200410853 /* blank.html in Resources */, 51D0214826ED617100FF2E0F /* core.css in Resources */, 84C9FCA42262A1B800D921D6 /* LaunchScreenPhone.storyboard in Resources */, diff --git a/Shared/UserNotifications/UserNotificationManager.swift b/Shared/UserNotifications/UserNotificationManager.swift index 35523f595..b44d6d40e 100644 --- a/Shared/UserNotifications/UserNotificationManager.swift +++ b/Shared/UserNotifications/UserNotificationManager.swift @@ -62,7 +62,8 @@ private extension UserNotificationManager { } content.body = ArticleStringFormatter.truncatedSummary(article) content.threadIdentifier = webFeed.webFeedID - content.sound = UNNotificationSound.default + // https://freesound.org/people/cabled_mess/sounds/350862/ + content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "notificationSoundBlip.caf")) content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo] content.categoryIdentifier = "NEW_ARTICLE_NOTIFICATION_CATEGORY" if let attachment = thumbnailAttachment(for: article, webFeed: webFeed) { diff --git a/iOS/Resources/notificationSoundBlip.caf b/iOS/Resources/notificationSoundBlip.caf new file mode 100644 index 0000000000000000000000000000000000000000..07c4a8a62b6f062cdaeffb2c7a7bd501b1879dce GIT binary patch literal 7224 zcmeI1PjB1E8ODc7+%?zTjYuyF1qE7(WD?gY(wH-HFFovfsChq;Ppa1LPeL-MBU_oF(U_oF(U_oF(U_oF(U_oF(U_oF(;D;gb z>GtQ_)suew8@%KD{GagBdc8eA$@3%*eZ4NdE*H|WjM4E~o-Oe#jiX>-$aY&u&TXTY zJe(G39;Lyc+4ZD&`wuR-WsZ(dvm(usG#nT-jJdASdsJrAe0DR9!(dR~@(`G-zyjo|ODY6KR=vVm8fi6r8#%+MWv-8jhD^iTL@AFzC1FfZVZHjXi>q#8DJ1 zH^rv#T<)w)OrxI^1rC@3M$_|za2(63v9Q47F!$N@eVn`PIS%LCV#jA?Rwj8E44HeI zPVMsd*3I4V6Y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