mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
added haptics and sounds for the bell
its the warning haptic and the Tink.caf 1103 system sound added warning haptic
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user