added macOSMenuBar
This commit is contained in:
parent
efee4afc8d
commit
534e615919
9 changed files with 160 additions and 35 deletions
|
|
@ -1,35 +1,36 @@
|
|||
import SwiftUI
|
||||
|
||||
struct TunnelView: View {
|
||||
@ObservedObject var tunnel: Tunnel
|
||||
// @ObservedObject var tunnel: Tunnel
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text(verbatim: tunnel.status.description)
|
||||
switch tunnel.status {
|
||||
case .connected:
|
||||
Button("Disconnect", action: stop)
|
||||
case .permissionRequired:
|
||||
Button("Allow", action: configure)
|
||||
case .disconnected:
|
||||
Button("Start", action: start)
|
||||
default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
.task { await tunnel.update() }
|
||||
.padding()
|
||||
EmptyView()
|
||||
// VStack {
|
||||
// Text(verbatim: tunnel.status.description)
|
||||
// switch tunnel.status {
|
||||
// case .connected:
|
||||
// Button("Disconnect", action: stop)
|
||||
// case .permissionRequired:
|
||||
// Button("Allow", action: configure)
|
||||
// case .disconnected:
|
||||
// Button("Start", action: start)
|
||||
// default:
|
||||
// EmptyView()
|
||||
// }
|
||||
// }
|
||||
// .task { await tunnel.update() }
|
||||
// .padding()
|
||||
}
|
||||
|
||||
private func start() {
|
||||
try? tunnel.start()
|
||||
}
|
||||
|
||||
private func stop() {
|
||||
tunnel.stop()
|
||||
}
|
||||
|
||||
private func configure() {
|
||||
Task { try await tunnel.configure() }
|
||||
}
|
||||
// private func start() {
|
||||
// try? tunnel.start()
|
||||
// }
|
||||
//
|
||||
// private func stop() {
|
||||
// tunnel.stop()
|
||||
// }
|
||||
//
|
||||
// private func configure() {
|
||||
// Task { try await tunnel.configure() }
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue