From 88fe99f7c491c4a09de1dcaee6ae9269c1c87f53 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Wed, 1 May 2024 21:38:44 -0700 Subject: Merge and use new shared SoundEffectsPlayer. --- .../xcshareddata/swiftpm/Package.resolved | 7 ++++--- Hotline/Models/Hotline.swift | 13 +++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Hotline.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Hotline.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 125ba89..d76a9ac 100644 --- a/Hotline.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Hotline.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "e60904df125ffbce75adea70452a77ae65a068371a6b6c4cfe0e6c155c4bdcee", "pins" : [ { "identity" : "networkimage", @@ -14,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/stevengharris/SplitView", "state" : { - "revision" : "13ff85ae02a01ae257c0a5cf8b6eb1c2a9fff597", - "version" : "3.5.0" + "revision" : "b37d559fd334cd5403433a29a5da6fe78f80714a", + "version" : "3.5.2" } }, { @@ -28,5 +29,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index 3cc8366..95a21c6 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -651,7 +651,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { } else if status == .loggedIn { if Prefs().playSounds && Prefs().playLoggedInSound { - soundEffects.playSoundEffect(.loggedIn) + SoundEffectPlayer.shared.playSoundEffect(.loggedIn) } } @@ -667,7 +667,6 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { } func hotlineReceivedNewsPost(message: String) { - soundEffects.playSoundEffect(.newNews) let messageBoardRegex = /([\s\r\n]*[_\-]+[\s\r\n]+)/ let matches = message.matches(of: messageBoardRegex) @@ -677,6 +676,8 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { } else { self.messageBoard.insert(message, at: 0) } + + SoundEffectPlayer.shared.playSoundEffect(.newNews) } func hotlineReceivedServerMessage(message: String) { @@ -686,7 +687,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { func hotlineReceivedChatMessage(message: String) { if Prefs().playSounds && Prefs().playChatSound { - soundEffects.playSoundEffect(.chatMessage) + SoundEffectPlayer.shared.playSoundEffect(.chatMessage) } self.chat.append(ChatMessage(text: message, type: .message, date: Date())) } @@ -725,7 +726,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { self.chat.append(ChatMessage(text: "\(user.name) left", type: .status, date: Date())) if Prefs().playSounds && Prefs().playLeaveSound { - soundEffects.playSoundEffect(.userLogout) + SoundEffectPlayer.shared.playSoundEffect(.userLogout) } } } @@ -810,7 +811,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { transfer.fileURL = at transfer.downloadCallback?(transfer, at) if Prefs().playSounds && Prefs().playFileTransferCompleteSound { - soundEffects.playSoundEffect(.transferComplete) + SoundEffectPlayer.shared.playSoundEffect(.transferComplete) } } @@ -833,7 +834,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { else { if !self.users.isEmpty { if Prefs().playSounds && Prefs().playJoinSound { - soundEffects.playSoundEffect(.userLogin) + SoundEffectPlayer.shared.playSoundEffect(.userLogin) } } -- cgit