From d2c4298f2df0a053e8598890262c9e5deabd2aec Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 19 Apr 2022 14:36:44 +0200 Subject: [PATCH] Share same build number in API --- API | 1 + .../Managers/ProviderManager.swift | 6 +++--- .../DataModels/WSProviderInfrastructure.swift | 12 +----------- 3 files changed, 5 insertions(+), 14 deletions(-) create mode 120000 API diff --git a/API b/API new file mode 120000 index 00000000..6a393c30 --- /dev/null +++ b/API @@ -0,0 +1 @@ +PassepartoutCore/Sources/PassepartoutServices/API/ \ No newline at end of file diff --git a/PassepartoutCore/Sources/PassepartoutProviders/Managers/ProviderManager.swift b/PassepartoutCore/Sources/PassepartoutProviders/Managers/ProviderManager.swift index 9104ba04..ad2233c0 100644 --- a/PassepartoutCore/Sources/PassepartoutProviders/Managers/ProviderManager.swift +++ b/PassepartoutCore/Sources/PassepartoutProviders/Managers/ProviderManager.swift @@ -171,9 +171,9 @@ public class ProviderManager: ObservableObject, RateLimited { .eraseToAnyPublisher() } - guard self.appBuild >= infrastructure.buildNumber else { - pp_log.error("Infrastructure requires app build >= \(infrastructure.buildNumber) (app is \(self.appBuild))") - return Fail(error: ProviderManagerError.outdatedBuild(self.appBuild, infrastructure.buildNumber)) + guard self.appBuild >= infrastructure.build else { + pp_log.error("Infrastructure requires app build >= \(infrastructure.build) (app is \(self.appBuild))") + return Fail(error: ProviderManagerError.outdatedBuild(self.appBuild, infrastructure.build)) .eraseToAnyPublisher() } diff --git a/PassepartoutCore/Sources/PassepartoutServices/DataModels/WSProviderInfrastructure.swift b/PassepartoutCore/Sources/PassepartoutServices/DataModels/WSProviderInfrastructure.swift index c7dcd64d..ac3e097a 100644 --- a/PassepartoutCore/Sources/PassepartoutServices/DataModels/WSProviderInfrastructure.swift +++ b/PassepartoutCore/Sources/PassepartoutServices/DataModels/WSProviderInfrastructure.swift @@ -38,17 +38,7 @@ public struct WSProviderInfrastructure: Codable { public let countryCode: String } - public let build: [String: Int] - - public var buildNumber: Int { - var num: Int? - #if os(iOS) - num = build["ios"] - #else - num = build["macos"] - #endif - return num ?? 0 - } + public let build: Int public let name: WSProviderName