From 4cd74c2633f3e376cb120b51ec5be301ebaebb24 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:11:59 +0100 Subject: [PATCH] FINALLY FIXED iOS 17 AND BELOW --- ShhShell/Views/Hosts/ConnectionView.swift | 8 +++--- ShhShell/Views/Sessions/SessionView.swift | 7 +++++- ShhShell/Views/Terminal/ShellTabView.swift | 29 ++++------------------ 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/ShhShell/Views/Hosts/ConnectionView.swift b/ShhShell/Views/Hosts/ConnectionView.swift index 40ea7c5..364765e 100644 --- a/ShhShell/Views/Hosts/ConnectionView.swift +++ b/ShhShell/Views/Hosts/ConnectionView.swift @@ -143,10 +143,10 @@ Hostkey fingerprint is \(handler.getHostkey() ?? "nil") Button() { handler.go() showTerminal = checkShell(handler.state) - if showTerminal { - hostsManager.addToHistory(handler.host) - handler.writeToChannel(hostsManager.snippets.first(where: { $0.id == handler.host.startupSnippetID })?.content) - } +// if showTerminal { +// hostsManager.addToHistory(handler.host) +// handler.writeToChannel(hostsManager.snippets.first(where: { $0.id == handler.host.startupSnippetID })?.content) +// } } label: { Label("Connect", systemImage: "power") } diff --git a/ShhShell/Views/Sessions/SessionView.swift b/ShhShell/Views/Sessions/SessionView.swift index 68fab5a..0162e9e 100644 --- a/ShhShell/Views/Sessions/SessionView.swift +++ b/ShhShell/Views/Sessions/SessionView.swift @@ -34,7 +34,12 @@ struct SessionView: View { } } .fullScreenCover(isPresented: $shellPresented) { - ShellTabView(handler: nil, hostsManager: hostsManager, selectedID: key) + //instancing handler here cos its non optional + ShellTabView( + handler: SSHHandler(host: Host.blank, keyManager: keyManager), + hostsManager: hostsManager, + selectedID: key + ) } } } diff --git a/ShhShell/Views/Terminal/ShellTabView.swift b/ShhShell/Views/Terminal/ShellTabView.swift index 516de57..ee004ac 100644 --- a/ShhShell/Views/Terminal/ShellTabView.swift +++ b/ShhShell/Views/Terminal/ShellTabView.swift @@ -8,16 +8,13 @@ import SwiftUI struct ShellTabView: View { - @State var handler: SSHHandler? + @State var handler: SSHHandler @ObservedObject var hostsManager: HostsManager @ObservedObject var container = TerminalViewContainer.shared @State var selectedID: UUID? var selectedHandler: SSHHandler { guard let selectedID, let contained = container.sessions[selectedID] else { - guard let handler else { - fatalError("selectedHandler: selectedID and handler are nil") - } return handler } return contained.handler @@ -48,18 +45,6 @@ struct ShellTabView: View { } var background: Color { hostsManager.selectedTheme.background.suiColor } - init(handler: SSHHandler? = nil, hostsManager: HostsManager, selectedID: UUID? = nil) { - self.selectedID = selectedID - self.handler = handler - if selectedID == nil, let handler { - self.selectedID = handler.sessionID - } else { - fatalError() - } - self.hostsManager = hostsManager - self.container = TerminalViewContainer.shared - } - var body: some View { ZStack { background @@ -198,14 +183,10 @@ struct ShellTabView: View { .id(selectedID) .transition(.opacity) } else { - if let handler { - ShellView( - handler: handler, - hostsManager: hostsManager - ) - } else { - Text("No Session") - } + ShellView( + handler: handler, + hostsManager: hostsManager + ) } } }