Delegate profile updates internally
This commit is contained in:
parent
170d089a44
commit
8313cc9497
|
@ -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
|
||||
|
|
|
@ -338,7 +338,7 @@ extension ServiceViewController: ProviderServiceViewDelegate {
|
|||
uncheckedProviderProfile.presetId = fallback
|
||||
}
|
||||
|
||||
service.setPoolId(pool.id, forProviderProfile: uncheckedProviderProfile)
|
||||
uncheckedProviderProfile.poolId = pool.id
|
||||
// vpn.reinstallIfEnabled()
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue