This commit is contained in:
Neil Alexander 2024-06-23 10:54:21 +01:00
parent 0bea3a1613
commit 1b9e84d056
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
9 changed files with 234 additions and 137 deletions

View file

@ -72,7 +72,7 @@ class CrossPlatformAppDelegate: PlatformAppDelegate, ObservableObject {
@Published var yggdrasilIP: String = "N/A"
@Published var yggdrasilSubnet: String = "N/A"
@Published var yggdrasilCoords: String = "[]"
@Published var yggdrasilPeers: [YggdrasilPeer] = []
func yggdrasilVersion() -> String {
@ -108,11 +108,12 @@ class CrossPlatformAppDelegate: PlatformAppDelegate, ObservableObject {
func becameBackground() {}
func updateStatus(conn: NEVPNConnection) {
if conn.status == .connected {
if conn.status == .connected || conn.status == .connecting {
self.yggdrasilEnabled = true
self.requestSummaryIPC()
} else if conn.status == .disconnecting || conn.status == .disconnected {
self.clearStatus()
self.yggdrasilEnabled = false
self.clearStatus()
}
}
@ -188,6 +189,8 @@ class CrossPlatformAppDelegate: PlatformAppDelegate, ObservableObject {
self.yggdrasilPublicKey = summary.publicKey
self.yggdrasilPeers = summary.peers
self.yggdrasilConnected = summary.peers.filter { $0.up }.count > 0
print("Response: \(String(data: js, encoding: .utf8))")
}
}
}