mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
FINALLY FIXED iOS 17 AND BELOW
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user