diff --git a/Passepartout/App/macOS/Menu/StatusMenu.swift b/Passepartout/App/macOS/Menu/StatusMenu.swift index 71229293..bfbdda05 100644 --- a/Passepartout/App/macOS/Menu/StatusMenu.swift +++ b/Passepartout/App/macOS/Menu/StatusMenu.swift @@ -430,7 +430,7 @@ class StatusMenu: NSObject { return } assert(!group.pools.isEmpty) - service.setPoolId(group.pools.randomElement()!.id, forProviderProfile: profile) + profile.poolId = group.pools.randomElement()!.id vpn.reconnect(completionHandler: nil) // update menu @@ -447,7 +447,7 @@ class StatusMenu: NSObject { guard let profile = service.activeProfile as? ProviderConnectionProfile else { return } - service.setPoolId(pool.id, forProviderProfile: profile) + profile.poolId = pool.id vpn.reconnect(completionHandler: nil) // update menu diff --git a/Passepartout/App/macOS/Scenes/Service/ServiceViewController.swift b/Passepartout/App/macOS/Scenes/Service/ServiceViewController.swift index 4e544b28..07417ec3 100644 --- a/Passepartout/App/macOS/Scenes/Service/ServiceViewController.swift +++ b/Passepartout/App/macOS/Scenes/Service/ServiceViewController.swift @@ -338,7 +338,7 @@ extension ServiceViewController: ProviderServiceViewDelegate { uncheckedProviderProfile.presetId = fallback } - service.setPoolId(pool.id, forProviderProfile: uncheckedProviderProfile) + uncheckedProviderProfile.poolId = pool.id // vpn.reinstallIfEnabled() } diff --git a/Passepartout/Core/Sources/Model/Profiles/ProviderConnectionProfile.swift b/Passepartout/Core/Sources/Model/Profiles/ProviderConnectionProfile.swift index 618e6324..8b1ec1b9 100644 --- a/Passepartout/Core/Sources/Model/Profiles/ProviderConnectionProfile.swift +++ b/Passepartout/Core/Sources/Model/Profiles/ProviderConnectionProfile.swift @@ -63,6 +63,7 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable { public var poolId: String { didSet { validateEndpoint() + serviceDelegate?.connectionService(didUpdate: self) } } @@ -73,6 +74,7 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable { public var presetId: String { didSet { validateEndpoint() + serviceDelegate?.connectionService(didUpdate: self) } } @@ -240,10 +242,3 @@ public extension ProviderConnectionProfile { return true } } - -public extension ConnectionService { - func setPoolId(_ poolId: String, forProviderProfile profile: ProviderConnectionProfile) { - profile.poolId = poolId - delegate?.connectionService(didUpdate: profile) - } -}