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:
neon443
2025-06-26 13:53:18 +01:00
parent a41edbb1aa
commit bb0ea0f9ee
2 changed files with 15 additions and 5 deletions

View File

@@ -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 }
} }
} }

View File

@@ -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)
} }
} }