From bb0ea0f9ee8f699129072832661d9eface38b7c6 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Thu, 26 Jun 2025 13:53:18 +0100 Subject: [PATCH] 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 --- ShhShell/SSH/SSHHandler.swift | 7 ++++--- ShhShell/Views/Terminal/ShellView.swift | 13 +++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ShhShell/SSH/SSHHandler.swift b/ShhShell/SSH/SSHHandler.swift index 295b9e2..0786285 100644 --- a/ShhShell/SSH/SSHHandler.swift +++ b/ShhShell/SSH/SSHHandler.swift @@ -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 } } } diff --git a/ShhShell/Views/Terminal/ShellView.swift b/ShhShell/Views/Terminal/ShellView.swift index d839fb6..dc7f792 100644 --- a/ShhShell/Views/Terminal/ShellView.swift +++ b/ShhShell/Views/Terminal/ShellView.swift @@ -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) } }