From 93e1343413aea47f755817fcc76b2bd97fb7ffd6 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 21 Feb 2024 20:27:49 +1100 Subject: [PATCH 1/2] Update WordPressKit minimum dependency to 13.1.0 This is so we have access to the `useURLSession` property of the API classes. --- Podfile.lock | 11 +++++------ WordPressAuthenticator.podspec | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 1d8c7d80..953d0601 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -13,10 +13,10 @@ PODS: - Gridicons (~> 1.0) - "NSURL+IDN (= 0.4)" - SVProgressHUD (~> 2.2.5) - - WordPressKit (~> 13.0) + - WordPressKit (~> 13.1) - WordPressShared (~> 2.1-beta) - WordPressUI (~> 1.7-beta) - - WordPressKit (13.0.0): + - WordPressKit (13.1.0): - Alamofire (~> 4.8.0) - NSObject-SafeExpectations (~> 0.0.4) - UIDeviceIdentifier (~> 2.0) @@ -40,8 +40,6 @@ DEPENDENCIES: - WordPressUI (~> 1.7-beta) SPEC REPOS: - https://github.com/wordpress-mobile/cocoapods-specs.git: - - WordPressKit trunk: - Alamofire - Expecta @@ -53,6 +51,7 @@ SPEC REPOS: - SVProgressHUD - SwiftLint - UIDeviceIdentifier + - WordPressKit - WordPressShared - WordPressUI - wpxmlrpc @@ -72,8 +71,8 @@ SPEC CHECKSUMS: SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211 UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17 - WordPressAuthenticator: ba69878bfa1368636e92d29fcfb5bd1e0a11a3ef - WordPressKit: 5eb7d27d27f84e875266a72281d0a4b80c825b74 + WordPressAuthenticator: 415b7a0957826ebde01f944f540fd502913b8a35 + WordPressKit: c1ba7b4f531693a0914f676423808fdffd820d81 WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2 WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06 wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index fae755ea..0d6bb4ab 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -40,6 +40,6 @@ Pod::Spec.new do |s| # Use a loose restriction that allows both production and beta versions, up to the next major version. # If you want to update which of these is used, specify it in the host app. s.dependency 'WordPressUI', '~> 1.7-beta' - s.dependency 'WordPressKit', '~> 13.0' + s.dependency 'WordPressKit', '~> 13.1' s.dependency 'WordPressShared', '~> 2.1-beta' end From b516ec85375fe4e3fa0d4f5a2358697cf43cc6a8 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 21 Feb 2024 20:29:30 +1100 Subject: [PATCH 2/2] Add `useURLSession` configuration to pass to WordPressKit This will allow clients that do no need access to WordPressKit (i.e. WooCommerce) to explicitly depend only on WordPressAuthenticator and still configure whether to use `URLSession`. --- .../Authenticator/WordPressAuthenticator.swift | 3 +++ .../WordPressAuthenticatorConfiguration.swift | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift index f3b17d6d..74ad6be8 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift @@ -77,6 +77,9 @@ import WordPressKit self.unifiedStyle = unifiedStyle self.displayImages = displayImages self.displayStrings = displayStrings + + WordPressOrgXMLRPCApi.useURLSession = configuration.useURLSession + WordPressComRestApi.useURLSession = configuration.useURLSession } /// Initializes the WordPressAuthenticator with the specified Configuration. diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorConfiguration.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorConfiguration.swift index 2ef67b01..c81d7b5c 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorConfiguration.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorConfiguration.swift @@ -174,6 +174,11 @@ public struct WordPressAuthenticatorConfiguration { /// let enableSiteAddressLoginOnlyInPrologue: Bool + /// Whether to use `URLSession` or Alamofire for certain requests. + /// + /// Defaults to `false` but will soon become `true` as we are actively working to remove Alamofire. + let useURLSession: Bool + /// Designated Initializer /// public init (wpcomClientId: String, @@ -210,7 +215,8 @@ public struct WordPressAuthenticatorConfiguration { enableManualSiteCredentialLogin: Bool = false, enableManualErrorHandlingForSiteCredentialLogin: Bool = false, useEnterEmailAddressAsStepValueForGetStartedVC: Bool = false, - enableSiteAddressLoginOnlyInPrologue: Bool = false + enableSiteAddressLoginOnlyInPrologue: Bool = false, + useURLSession: Bool = false ) { self.wpcomClientId = wpcomClientId @@ -248,5 +254,6 @@ public struct WordPressAuthenticatorConfiguration { self.enableManualErrorHandlingForSiteCredentialLogin = enableManualErrorHandlingForSiteCredentialLogin self.useEnterEmailAddressAsStepValueForGetStartedVC = useEnterEmailAddressAsStepValueForGetStartedVC self.enableSiteAddressLoginOnlyInPrologue = enableSiteAddressLoginOnlyInPrologue + self.useURLSession = useURLSession } }