diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-05-01 14:55:19 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-05-01 14:55:19 -0700 |
| commit | 8cb41e9fce82fc8e209348b51c2b79e6cace8e18 (patch) | |
| tree | a4ed555482280373600a503b2e17e02030d064c7 /Hotline/Models/Hotline.swift | |
| parent | 1a82975ad00bced8bba8cd6df6a9920a7ae93c61 (diff) | |
Add sound settings
Diffstat (limited to 'Hotline/Models/Hotline.swift')
| -rw-r--r-- | Hotline/Models/Hotline.swift | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index 6b5e3a7..1439755 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -636,7 +636,9 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { self.deleteAllTransfers() } else if status == .loggedIn { - soundEffects.playSoundEffect(.loggedIn) + if Prefs().playSounds && Prefs().playLoggedInSound { + soundEffects.playSoundEffect(.loggedIn) + } } self.status = status @@ -656,7 +658,9 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { } func hotlineReceivedChatMessage(message: String) { - soundEffects.playSoundEffect(.chatMessage) + if Prefs().playSounds && Prefs().playChatSound { + soundEffects.playSoundEffect(.chatMessage) + } self.chat.append(ChatMessage(text: message, type: .message, date: Date())) } @@ -693,7 +697,9 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { let user = self.users.remove(at: existingUserIndex) self.chat.append(ChatMessage(text: "\(user.name) left", type: .status, date: Date())) - soundEffects.playSoundEffect(.userLogout) + if Prefs().playSounds && Prefs().playLeaveSound { + soundEffects.playSoundEffect(.userLogout) + } } } @@ -776,8 +782,9 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { let transfer = self.transfers[i] transfer.fileURL = at transfer.downloadCallback?(transfer, at) - - soundEffects.playSoundEffect(.transferComplete) + if Prefs().playSounds && Prefs().playFileTransferCompleteSound { + soundEffects.playSoundEffect(.transferComplete) + } } if let i = self.downloads.firstIndex(where: { $0.referenceNumber == reference }) { @@ -798,7 +805,9 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { } else { if !self.users.isEmpty { - soundEffects.playSoundEffect(.userLogin) + if Prefs().playSounds && Prefs().playJoinSound { + soundEffects.playSoundEffect(.userLogin) + } } print("Hotline: added user: \(user.name)") |