mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +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() {
|
func ring() {
|
||||||
bell = true
|
Task { @MainActor in
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now()+0.2) {
|
withAnimation { self.bell = true }
|
||||||
self.bell = false
|
try? await Task.sleep(nanoseconds: 250_000_000) // 250ms
|
||||||
|
withAnimation { self.bell = false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,19 @@ struct ShellView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
terminalControllerRef
|
||||||
|
|
||||||
|
Group {
|
||||||
|
Color.gray.opacity(0.2)
|
||||||
|
.transition(.opacity)
|
||||||
|
Text("🔔")
|
||||||
|
.font(.title)
|
||||||
|
}
|
||||||
|
.opacity(handler.bell ? 1 : 0)
|
||||||
|
|
||||||
if !handler.connected {
|
if !handler.connected {
|
||||||
DialogView(handler: handler, showDialog: !handler.connected)
|
DialogView(handler: handler, showDialog: !handler.connected)
|
||||||
}
|
}
|
||||||
terminalControllerRef
|
|
||||||
}
|
}
|
||||||
.task {
|
.task {
|
||||||
terminalControllerRef = TerminalController(handler: handler)
|
terminalControllerRef = TerminalController(handler: handler)
|
||||||
@@ -45,7 +54,7 @@ struct ShellView: View {
|
|||||||
.onChange(of: handler.connected) { _ in
|
.onChange(of: handler.connected) { _ in
|
||||||
if !handler.connected { dismiss() }
|
if !handler.connected { dismiss() }
|
||||||
}
|
}
|
||||||
.navigationTitle(handler.bell ? "🔔" : handler.title)
|
.navigationTitle(handler.title)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user