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 {
|
enum Haptic {
|
||||||
case success
|
case success
|
||||||
|
case warning
|
||||||
case error
|
case error
|
||||||
case light
|
case light
|
||||||
case medium
|
case medium
|
||||||
@@ -22,7 +23,7 @@ enum Haptic {
|
|||||||
switch self {
|
switch self {
|
||||||
case .light, .medium, .heavy, .soft, .rigid:
|
case .light, .medium, .heavy, .soft, .rigid:
|
||||||
return true
|
return true
|
||||||
case .success, .error:
|
case .success, .warning, .error:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,8 @@ enum Haptic {
|
|||||||
switch self {
|
switch self {
|
||||||
case .success:
|
case .success:
|
||||||
UINotificationFeedbackGenerator().notificationOccurred(.success)
|
UINotificationFeedbackGenerator().notificationOccurred(.success)
|
||||||
|
case .warning:
|
||||||
|
UINotificationFeedbackGenerator().notificationOccurred(.warning)
|
||||||
case .error:
|
case .error:
|
||||||
UINotificationFeedbackGenerator().notificationOccurred(.error)
|
UINotificationFeedbackGenerator().notificationOccurred(.error)
|
||||||
default: print("idk atp")
|
default: print("idk atp")
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import AudioToolbox
|
||||||
|
|
||||||
struct ShellView: View {
|
struct ShellView: View {
|
||||||
@ObservedObject var handler: SSHHandler
|
@ObservedObject var handler: SSHHandler
|
||||||
@@ -26,10 +27,23 @@ struct ShellView: View {
|
|||||||
Color.gray.opacity(0.2)
|
Color.gray.opacity(0.2)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
Image(systemName: "bell.fill")
|
Image(systemName: "bell.fill")
|
||||||
|
.foregroundStyle(
|
||||||
|
hostsManager.selectedTheme.background.luminance > 0.5 ?
|
||||||
|
.black : .white
|
||||||
|
)
|
||||||
.font(.largeTitle)
|
.font(.largeTitle)
|
||||||
.shadow(color: .black, radius: 5)
|
.shadow(color: .black, radius: 5)
|
||||||
}
|
}
|
||||||
.opacity(handler.bell ? 1 : 0)
|
.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