-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathContentView.swift
More file actions
42 lines (36 loc) · 1.22 KB
/
Copy pathContentView.swift
File metadata and controls
42 lines (36 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import SwiftUI
struct ContentView: View {
@StateObject private var vm = ConfigViewModel()
@StateObject private var vpn = VPNManager()
var body: some View {
NavigationStack {
VStack(spacing: 32) {
Text("NekoBox")
.font(.largeTitle.bold())
Button {
vpn.toggleVPN()
} label: {
Label(
vpn.status == .connected ? "Disconnect" : "Connect",
systemImage: vpn.status == .connected ? "stop.circle" : "play.circle"
)
.font(.title2)
.padding()
.frame(maxWidth: .infinity)
}
.buttonStyle(.borderedProminent)
.controlSize(.large)
Text("Status: \(vpn.status.description)")
.foregroundColor(.secondary)
NavigationLink("Logs") {
LogsView(logs: $vm.logs)
}
Spacer()
}
.padding()
.task {
vm.generateAndSaveConfig()
}
}
}
}