From d966142a67ea99c16c71b1c791478474d37b80fd Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Mon, 29 Jul 2024 19:29:44 -0700 Subject: Actually update the file on drop. Add error message sound effect. --- Hotline/Models/Hotline.swift | 5 +++++ Hotline/Utility/SoundEffects.swift | 1 + Hotline/macOS/FilesView.swift | 4 +--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index 30d2ef5..9ea29c5 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -909,6 +909,11 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileDownloadClientDelega self.errorDisplayed = (message != nil) // Show error if there is a message to display. self.errorMessage = message + + if self.errorDisplayed, + Prefs.shared.playSounds && Prefs.shared.playErrorSound { + SoundEffectPlayer.shared.playSoundEffect(.error) + } } // MARK: - Hotline Transfer Delegate diff --git a/Hotline/Utility/SoundEffects.swift b/Hotline/Utility/SoundEffects.swift index 629af71..93f8b9a 100644 --- a/Hotline/Utility/SoundEffects.swift +++ b/Hotline/Utility/SoundEffects.swift @@ -9,6 +9,7 @@ enum SoundEffects: String { case userLogout = "user-logout" case newNews = "new-news" case serverMessage = "server-message" + case error = "error" } @Observable diff --git a/Hotline/macOS/FilesView.swift b/Hotline/macOS/FilesView.swift index 80d89f9..a4013ad 100644 --- a/Hotline/macOS/FilesView.swift +++ b/Hotline/macOS/FilesView.swift @@ -116,12 +116,10 @@ struct FolderView: View { } item.loadItem(forTypeIdentifier: identifier, options: nil) { (urlData, error) in - print("WHAT?", Thread.isMainThread) DispatchQueue.main.async { - print("WHAT 2?", Thread.isMainThread) if let urlData = urlData as? Data, let fileURL = URL(dataRepresentation: urlData, relativeTo: nil, isAbsolute: true) { - // uploadFile(file: fileURL) + uploadFile(file: fileURL) } } } -- cgit