mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
fix(apple): Move status observer setup to init() (#7673)
This is a very minor regression caused by #7555. We didn't bind the status update observer until after the VPN profile was created. In practice this didn't cause an issue because the status never changes until a VPN profile is created, but still thought it's good to fix. The JSON encoder is now configured in the `init()` as well like any other instance variable should be.
This commit is contained in:
@@ -139,6 +139,13 @@ public class TunnelManager {
|
||||
public static let bundleIdentifier: String = "\(Bundle.main.bundleIdentifier!).network-extension"
|
||||
private let bundleDescription = "Firezone"
|
||||
|
||||
init() {
|
||||
encoder.outputFormat = .binary
|
||||
|
||||
// Hook up status updates
|
||||
setupTunnelObservers()
|
||||
}
|
||||
|
||||
// Initialize and save a new VPN profile in system Preferences
|
||||
func create() async throws {
|
||||
let protocolConfiguration = NETunnelProviderProtocol()
|
||||
@@ -150,7 +157,6 @@ public class TunnelManager {
|
||||
protocolConfiguration.serverAddress = settings.apiURL
|
||||
manager.localizedDescription = bundleDescription
|
||||
manager.protocolConfiguration = protocolConfiguration
|
||||
encoder.outputFormat = .binary
|
||||
|
||||
// Save the new VPN profile to System Preferences and reload it,
|
||||
// which should update our status from invalid -> disconnected.
|
||||
@@ -203,9 +209,6 @@ public class TunnelManager {
|
||||
}
|
||||
}
|
||||
|
||||
// Hook up status updates
|
||||
setupTunnelObservers()
|
||||
|
||||
// If no tunnel configuration was found, update state to
|
||||
// prompt user to create one.
|
||||
if manager == nil {
|
||||
|
||||
Reference in New Issue
Block a user