FINALLY FIXED iOS 17 AND BELOW

This commit is contained in:
neon443
2025-09-01 16:11:59 +01:00
parent 4846831140
commit 4cd74c2633
3 changed files with 15 additions and 29 deletions

View File

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

View File

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

View File

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