From f2d034b732ca31df08c369e8a8128738dfe10828 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Sun, 24 Aug 2025 21:44:35 +0100 Subject: [PATCH] added haptics and sounds for the bell its the warning haptic and the Tink.caf 1103 system sound added warning haptic --- ShhShell/Misc/Haptics.swift | 5 ++++- ShhShell/Views/Terminal/ShellView.swift | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ShhShell/Misc/Haptics.swift b/ShhShell/Misc/Haptics.swift index 5650028..df97351 100644 --- a/ShhShell/Misc/Haptics.swift +++ b/ShhShell/Misc/Haptics.swift @@ -11,6 +11,7 @@ import UIKit enum Haptic { case success + case warning case error case light case medium @@ -22,7 +23,7 @@ enum Haptic { switch self { case .light, .medium, .heavy, .soft, .rigid: return true - case .success, .error: + case .success, .warning, .error: return false } } @@ -57,6 +58,8 @@ enum Haptic { switch self { case .success: UINotificationFeedbackGenerator().notificationOccurred(.success) + case .warning: + UINotificationFeedbackGenerator().notificationOccurred(.warning) case .error: UINotificationFeedbackGenerator().notificationOccurred(.error) default: print("idk atp") diff --git a/ShhShell/Views/Terminal/ShellView.swift b/ShhShell/Views/Terminal/ShellView.swift index dd6a394..5304f62 100644 --- a/ShhShell/Views/Terminal/ShellView.swift +++ b/ShhShell/Views/Terminal/ShellView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import AudioToolbox struct ShellView: View { @ObservedObject var handler: SSHHandler @@ -26,10 +27,23 @@ struct ShellView: View { Color.gray.opacity(0.2) .transition(.opacity) Image(systemName: "bell.fill") + .foregroundStyle( + hostsManager.selectedTheme.background.luminance > 0.5 ? + .black : .white + ) .font(.largeTitle) .shadow(color: .black, radius: 5) } .opacity(handler.bell ? 1 : 0) + .onChange(of: handler.bell) { _ in + guard handler.bell else { return } + if hostsManager.settings.bellHaptic { + Haptic.warning.trigger() + } + if hostsManager.settings.bellSound { + AudioServicesPlaySystemSound(1103) + } + } } } }