aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-05-01 21:38:44 -0700
committerDustin Mierau <dustin@mierau.me>2024-05-01 21:38:44 -0700
commit88fe99f7c491c4a09de1dcaee6ae9269c1c87f53 (patch)
treea9cb308df47d878d8c9ff2b605ebe80fe109b4e3 /Hotline/Models
parent60a3f2d29dfff945f59787f5a7786c6e78ba7bb9 (diff)
Merge and use new shared SoundEffectsPlayer.
Diffstat (limited to 'Hotline/Models')
-rw-r--r--Hotline/Models/Hotline.swift13
1 files changed, 7 insertions, 6 deletions
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)
}
}