mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 05:19:13 +00:00
added animated screen flash for bell
screen will flash with a semi transparent white overlay and a bell emoji for 250ms remove bell from nav bar, too distracting with the bell in the muiddle as well
This commit is contained in:
@@ -150,9 +150,10 @@ class SSHHandler: @unchecked Sendable, ObservableObject {
|
||||
}
|
||||
|
||||
func ring() {
|
||||
bell = true
|
||||
DispatchQueue.main.asyncAfter(deadline: .now()+0.2) {
|
||||
self.bell = false
|
||||
Task { @MainActor in
|
||||
withAnimation { self.bell = true }
|
||||
try? await Task.sleep(nanoseconds: 250_000_000) // 250ms
|
||||
withAnimation { self.bell = false }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,19 @@ struct ShellView: View {
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
terminalControllerRef
|
||||
|
||||
Group {
|
||||
Color.gray.opacity(0.2)
|
||||
.transition(.opacity)
|
||||
Text("🔔")
|
||||
.font(.title)
|
||||
}
|
||||
.opacity(handler.bell ? 1 : 0)
|
||||
|
||||
if !handler.connected {
|
||||
DialogView(handler: handler, showDialog: !handler.connected)
|
||||
}
|
||||
terminalControllerRef
|
||||
}
|
||||
.task {
|
||||
terminalControllerRef = TerminalController(handler: handler)
|
||||
@@ -45,7 +54,7 @@ struct ShellView: View {
|
||||
.onChange(of: handler.connected) { _ in
|
||||
if !handler.connected { dismiss() }
|
||||
}
|
||||
.navigationTitle(handler.bell ? "🔔" : handler.title)
|
||||
.navigationTitle(handler.title)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user