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() {
|
Button() {
|
||||||
handler.go()
|
handler.go()
|
||||||
showTerminal = checkShell(handler.state)
|
showTerminal = checkShell(handler.state)
|
||||||
if showTerminal {
|
// if showTerminal {
|
||||||
hostsManager.addToHistory(handler.host)
|
// hostsManager.addToHistory(handler.host)
|
||||||
handler.writeToChannel(hostsManager.snippets.first(where: { $0.id == handler.host.startupSnippetID })?.content)
|
// handler.writeToChannel(hostsManager.snippets.first(where: { $0.id == handler.host.startupSnippetID })?.content)
|
||||||
}
|
// }
|
||||||
} label: {
|
} label: {
|
||||||
Label("Connect", systemImage: "power")
|
Label("Connect", systemImage: "power")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ struct SessionView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.fullScreenCover(isPresented: $shellPresented) {
|
.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
|
import SwiftUI
|
||||||
|
|
||||||
struct ShellTabView: View {
|
struct ShellTabView: View {
|
||||||
@State var handler: SSHHandler?
|
@State var handler: SSHHandler
|
||||||
@ObservedObject var hostsManager: HostsManager
|
@ObservedObject var hostsManager: HostsManager
|
||||||
|
|
||||||
@ObservedObject var container = TerminalViewContainer.shared
|
@ObservedObject var container = TerminalViewContainer.shared
|
||||||
@State var selectedID: UUID?
|
@State var selectedID: UUID?
|
||||||
var selectedHandler: SSHHandler {
|
var selectedHandler: SSHHandler {
|
||||||
guard let selectedID, let contained = container.sessions[selectedID] else {
|
guard let selectedID, let contained = container.sessions[selectedID] else {
|
||||||
guard let handler else {
|
|
||||||
fatalError("selectedHandler: selectedID and handler are nil")
|
|
||||||
}
|
|
||||||
return handler
|
return handler
|
||||||
}
|
}
|
||||||
return contained.handler
|
return contained.handler
|
||||||
@@ -48,18 +45,6 @@ struct ShellTabView: View {
|
|||||||
}
|
}
|
||||||
var background: Color { hostsManager.selectedTheme.background.suiColor }
|
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 {
|
var body: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
background
|
background
|
||||||
@@ -198,14 +183,10 @@ struct ShellTabView: View {
|
|||||||
.id(selectedID)
|
.id(selectedID)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
} else {
|
} else {
|
||||||
if let handler {
|
|
||||||
ShellView(
|
ShellView(
|
||||||
handler: handler,
|
handler: handler,
|
||||||
hostsManager: hostsManager
|
hostsManager: hostsManager
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
Text("No Session")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user