Fix old provider server query parameter
serverId was renamed to apiId.
This commit is contained in:
parent
4973a19fda
commit
259a7e18ca
|
@ -106,8 +106,8 @@ public class ProviderManager: ObservableObject, RateLimited {
|
|||
}
|
||||
|
||||
// @available(*, deprecated, message: "only use for migration, server is not cached")
|
||||
public func server(_ name: ProviderName, vpnProtocol: VPNProtocolType, serverId: String) -> ProviderServer? {
|
||||
serverRepository.server(forProviderWithName: name, vpnProtocol: vpnProtocol, serverId: serverId)
|
||||
public func server(_ name: ProviderName, vpnProtocol: VPNProtocolType, apiId: String) -> ProviderServer? {
|
||||
serverRepository.server(forProviderWithName: name, vpnProtocol: vpnProtocol, apiId: apiId)
|
||||
}
|
||||
|
||||
// public func anyServer(forProviderWithName providerName: ProviderName, vpnProtocol: VPNProtocolType, countryCode: String) -> ProviderServer? {
|
||||
|
|
|
@ -84,11 +84,11 @@ class ServerRepository: Repository {
|
|||
}
|
||||
}
|
||||
|
||||
func server(forProviderWithName providerName: ProviderName, vpnProtocol: VPNProtocolType, serverId: String) -> ProviderServer? {
|
||||
func server(forProviderWithName providerName: ProviderName, vpnProtocol: VPNProtocolType, apiId: String) -> ProviderServer? {
|
||||
let request = CDInfrastructureServer.fetchRequest()
|
||||
request.predicate = NSPredicate(
|
||||
format: "serverId == %@ AND category.infrastructure.provider.name == %@ AND category.infrastructure.vpnProtocol == %@",
|
||||
serverId,
|
||||
format: "apiId == %@ AND category.infrastructure.provider.name == %@ AND category.infrastructure.vpnProtocol == %@",
|
||||
apiId,
|
||||
providerName,
|
||||
vpnProtocol.rawValue
|
||||
)
|
||||
|
|
|
@ -144,7 +144,7 @@ class ProvidersTests: XCTestCase {
|
|||
|
||||
func testServerId() async {
|
||||
await fetchProvider(.nordvpn)
|
||||
guard let server = manager.server(.nordvpn, vpnProtocol: .openVPN, serverId: "es143") else {
|
||||
guard let server = manager.server(.nordvpn, vpnProtocol: .openVPN, apiId: "es143") else {
|
||||
return
|
||||
}
|
||||
pp_log.debug(server)
|
||||
|
|
Loading…
Reference in New Issue