diff options
| author | Dustin Mierau <mierau@users.noreply.github.com> | 2024-05-01 19:05:34 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-01 19:05:34 -0700 |
| commit | b9529a0d255ad41c62a4e3b93a47ebb5bb82a565 (patch) | |
| tree | c4b715eda4031617aac75ffcc890f0e5130de638 /Hotline/Models/Hotline.swift | |
| parent | a5c1e0b475d14b176479f662bf29163f2220180b (diff) | |
| parent | 8cb41e9fce82fc8e209348b51c2b79e6cace8e18 (diff) | |
Merge pull request #15 from jhalter/add_sound_settings
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 cccb4d4..f1c745f 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -647,7 +647,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 @@ -680,7 +682,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())) } @@ -717,7 +721,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) + } } } @@ -800,8 +806,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 }) { @@ -822,7 +829,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)") |