Skip to content

Commit

Permalink
Update Alamofire to v5 (#22707)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazytonyli authored Feb 28, 2024
2 parents 4cb9cef + ca871d8 commit 1393161
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 48 deletions.
10 changes: 5 additions & 5 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end

def wordpress_kit
# pod 'WordPressKit', '~> 13.1'
pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: 'f335202c98b972dd2a426dfe0e06780a38579ee7'
pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '40d6a9f4928b470d73a5ade7ff1842a29e80cef8'
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: ''
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: ''
# pod 'WordPressKit', path: '../WordPressKit-iOS'
Expand Down Expand Up @@ -117,8 +117,8 @@ abstract_target 'Apps' do
pod 'Starscream', '~> 4.0'
pod 'SVProgressHUD', '2.2.5'
pod 'ZendeskSupportSDK', '5.3.0'
pod 'AlamofireImage', '3.5.2'
pod 'AlamofireNetworkActivityIndicator', '~> 2.4'
pod 'AlamofireImage', '~> 4.0'
pod 'AlamofireNetworkActivityIndicator', '~> 3.0'
pod 'FSInteractiveMap', git: 'https://github.com/wordpress-mobile/FSInteractiveMap.git', tag: '0.2.0'
pod 'JTAppleCalendar', '~> 8.0.5'
pod 'CropViewController', '2.5.3'
Expand All @@ -140,8 +140,8 @@ abstract_target 'Apps' do

pod 'NSURL+IDN', '~> 0.4'

pod 'WordPressAuthenticator', '~> 9.0', '>= 9.0.1'
# pod 'WordPressAuthenticator', git: 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', commit: 'fa06fca7178b268d382d91861752b3be0729e8a8'
# pod 'WordPressAuthenticator', '~> 9.0', '>= 9.0.1'
pod 'WordPressAuthenticator', git: 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', commit: '000cbf2b3b1644b224eb46f14f1cfc609103f686'
# pod 'WordPressAuthenticator', git: 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', branch: ''
# pod 'WordPressAuthenticator', path: '../WordPressAuthenticator-iOS'

Expand Down
42 changes: 23 additions & 19 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Alamofire (4.8.2)
- AlamofireImage (3.5.2):
- Alamofire (~> 4.8)
- AlamofireNetworkActivityIndicator (2.4.0):
- Alamofire (~> 4.8)
- Alamofire (5.8.1)
- AlamofireImage (4.3.0):
- Alamofire (~> 5.8)
- AlamofireNetworkActivityIndicator (3.1.0):
- Alamofire (~> 5.1)
- AppCenter (5.0.3):
- AppCenter/Analytics (= 5.0.3)
- AppCenter/Crashes (= 5.0.3)
Expand Down Expand Up @@ -71,7 +71,6 @@ PODS:
- WordPressShared (~> 2.1-beta)
- WordPressUI (~> 1.7-beta)
- WordPressKit (13.1.0):
- Alamofire (~> 4.8.0)
- NSObject-SafeExpectations (~> 0.0.4)
- UIDeviceIdentifier (~> 2.0)
- WordPressShared (~> 2.0-beta)
Expand All @@ -95,8 +94,8 @@ PODS:
- ZIPFoundation (0.9.16)

DEPENDENCIES:
- AlamofireImage (= 3.5.2)
- AlamofireNetworkActivityIndicator (~> 2.4)
- AlamofireImage (~> 4.0)
- AlamofireNetworkActivityIndicator (~> 3.0)
- AppCenter (~> 5.0)
- AppCenter/Distribute (~> 5.0)
- Automattic-Tracks-iOS (~> 3.0)
Expand All @@ -119,16 +118,15 @@ DEPENDENCIES:
- SVProgressHUD (= 2.2.5)
- SwiftLint (= 0.54.0)
- WordPress-Editor-iOS (~> 1.19.9)
- WordPressAuthenticator (>= 9.0.1, ~> 9.0)
- WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `f335202c98b972dd2a426dfe0e06780a38579ee7`)
- WordPressAuthenticator (from `https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git`, commit `000cbf2b3b1644b224eb46f14f1cfc609103f686`)
- WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `40d6a9f4928b470d73a5ade7ff1842a29e80cef8`)
- WordPressShared (~> 2.3)
- WordPressUI (~> 1.15)
- ZendeskSupportSDK (= 5.3.0)
- ZIPFoundation (~> 0.9.8)

SPEC REPOS:
https://github.com/wordpress-mobile/cocoapods-specs.git:
- WordPressAuthenticator
- WordPressShared
trunk:
- Alamofire
Expand Down Expand Up @@ -175,22 +173,28 @@ EXTERNAL SOURCES:
:tag: 0.2.0
Gutenberg:
:podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.113.0-alpha1.podspec
WordPressAuthenticator:
:commit: 000cbf2b3b1644b224eb46f14f1cfc609103f686
:git: https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git
WordPressKit:
:commit: f335202c98b972dd2a426dfe0e06780a38579ee7
:commit: 40d6a9f4928b470d73a5ade7ff1842a29e80cef8
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git

CHECKOUT OPTIONS:
FSInteractiveMap:
:git: https://github.com/wordpress-mobile/FSInteractiveMap.git
:tag: 0.2.0
WordPressAuthenticator:
:commit: 000cbf2b3b1644b224eb46f14f1cfc609103f686
:git: https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git
WordPressKit:
:commit: f335202c98b972dd2a426dfe0e06780a38579ee7
:commit: 40d6a9f4928b470d73a5ade7ff1842a29e80cef8
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git

SPEC CHECKSUMS:
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
AlamofireImage: 63cfe3baf1370be6c498149687cf6db3e3b00999
AlamofireNetworkActivityIndicator: 9acc3de3ca6645bf0efed462396b0df13dd3e7b8
Alamofire: 3ca42e259043ee0dc5c0cdd76c4bc568b8e42af7
AlamofireImage: 843953fa97bee5f561cf05d83abd759e590b068d
AlamofireNetworkActivityIndicator: 6564782bd7b9e6c430ae67d9277af01907b01ca4
AppCenter: a4070ec3d4418b5539067a51f57155012e486ebd
Automattic-Tracks-iOS: baa126f98d2ce26fd54ee2534bef6e2d46480a5c
CocoaLumberjack: 78abfb691154e2a9df8ded4350d504ee19d90732
Expand All @@ -217,8 +221,8 @@ SPEC CHECKSUMS:
UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17
WordPress-Aztec-iOS: fbebd569c61baa252b3f5058c0a2a9a6ada686bb
WordPress-Editor-iOS: bda9f7f942212589b890329a0cb22547311749ef
WordPressAuthenticator: 0891ba77c788044d32fe67a4d0435fdd598cecbd
WordPressKit: c1ba7b4f531693a0914f676423808fdffd820d81
WordPressAuthenticator: ba69878bfa1368636e92d29fcfb5bd1e0a11a3ef
WordPressKit: f446e322a67949d760629ed430589975ca5b9d71
WordPressShared: cad7777b283d3ce2752f283df587342a581cd49b
WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06
wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd
Expand All @@ -231,6 +235,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced

PODFILE CHECKSUM: 4453062b0c973ec7e780bff098a5b1e78639736c
PODFILE CHECKSUM: a5f578243c785e0c38eb87f15a7c1063db575bee

COCOAPODS: 1.14.2
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-----
* [**] [Jetpack-only] Block editor: Introduce VideoPress v5 support, to fix issues using video block with dotcom and Jetpack sites [https://github.com/wordpress-mobile/gutenberg-mobile/pull/6634]
* [**] [internal] Refactored .org REST API calls. [#22612]
* [**] [internal] Update loading images in Reader posts list and Posts list. [#22707]

24.3
-----
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Classes/Extensions/UIImageView+SiteIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension UIImageView {
imageSize expectedSize: CGSize = SiteIconDefaults.imageSize,
placeholderImage: UIImage?
) {
af_setImage(withURLRequest: request, placeholderImage: placeholderImage, completion: { [weak self] dataResponse in
af.setImage(withURLRequest: request, placeholderImage: placeholderImage, completion: { [weak self] dataResponse in
switch dataResponse.result {
case .success(let image):
guard let self = self else {
Expand All @@ -87,7 +87,7 @@ extension UIImageView {

self.removePlaceholderBorder()
case .failure(let error):
if case .requestCancelled = (error as? AFIError) {
if case .requestCancelled = error {
// Do not log intentionally cancelled requests as errors.
} else {
DDLogError(error.localizedDescription)
Expand Down
8 changes: 0 additions & 8 deletions WordPress/Classes/System/WordPressAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class WordPressAppDelegate: UIResponder, UIApplicationDelegate {
DDLogInfo("didFinishLaunchingWithOptions state: \(application.applicationState)")

ABTest.start()
configureWordPressKit()

Media.removeTemporaryData()
NSItemProvider.removeTemporaryData()
Expand Down Expand Up @@ -521,13 +520,6 @@ extension WordPressAppDelegate {
AppEnvironment.replaceEnvironment(wordPressComApiBase: url)
}
}

private func configureWordPressKit() {
if FeatureFlag.useURLSession.enabled {
WordPressComRestApi.useURLSession = true
WordPressOrgXMLRPCApi.useURLSession = true
}
}
}

// MARK: - Deep Link Handling
Expand Down
5 changes: 0 additions & 5 deletions WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ enum FeatureFlag: Int, CaseIterable {
case compliancePopover
case googleDomainsCard
case newTabIcons
case useURLSession
case offlineMode

/// Returns a boolean indicating if the feature is enabled
Expand Down Expand Up @@ -39,8 +38,6 @@ enum FeatureFlag: Int, CaseIterable {
return false
case .newTabIcons:
return true
case .useURLSession:
return BuildConfiguration.current != .appStore
case .offlineMode:
return false
}
Expand Down Expand Up @@ -83,8 +80,6 @@ extension FeatureFlag {
return "Google Domains Promotional Card"
case .newTabIcons:
return "New Tab Icons"
case .useURLSession:
return "Use URLSession in WordPressKit (instead of Alamofire)"
case .offlineMode:
return "Offline Mode (Sync Issues)"
}
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Utility/Media/ImageLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ import AutomatticTracks
calculateImageDimensionsIfNeeded(from: request)

imageView.startLoadingAnimation()
imageView.af_setImage(withURLRequest: request, completion: { [weak self] dataResponse in
imageView.af.setImage(withURLRequest: request, completion: { [weak self] dataResponse in
guard let self = self else {
return
}
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Utility/Media/MemoryCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extension MemoryCache {
WordPressUI.ImageCache.shared = WordpressUICacheAdapter(cache: .shared)

// AlamofireImage
UIImageView.af_sharedImageDownloader = AlamofireImage.ImageDownloader(
UIImageView.af.sharedImageDownloader = AlamofireImage.ImageDownloader(
imageCache: AlamofireImageCacheAdapter(cache: .shared)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ extension MbarRoute: NavigationAction {

// If we're handling the link in the app, fire off a request to the
// original URL so that any necessary tracking takes places.
Alamofire.request(url)
AF.request(url)
.validate()
.responseData { response in
switch response.result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct TenorClient {
SearchParams.contentFilter: contentFilter.rawValue,
]

Alamofire.request(url, method: .get, parameters: params).responseData { response in
AF.request(url, method: .get, parameters: params).responseData { response in

switch response.result {
case .success:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private extension ReaderCrossPostCell {

let mediaAuthenticator = MediaRequestAuthenticator()
mediaAuthenticator.authenticatedRequest(for: url, from: host, onComplete: { [weak self] request in
self?.blavatarImageView.af_setImage(withURLRequest: request, placeholderImage: placeholder)
self?.blavatarImageView.af.setImage(withURLRequest: request, placeholderImage: placeholder)
}) { [weak self] error in
WordPressAppDelegate.crashLogging?.logError(error)
self?.blavatarImageView.image = placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AnnouncementCell: AnnouncementTableViewCell {
}

else if let url = URL(string: feature.iconUrl) {
announcementImageView.af_setImage(withURL: url)
announcementImageView.af.setImage(withURL: url)
}
headingLabel.text = feature.title
subHeadingLabel.text = feature.subtitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DashboardCustomAnnouncementCell: AnnouncementTableViewCell {
func configure(feature: WordPressKit.Feature) {

if let url = URL(string: feature.iconUrl) {
announcementImageView.af_setImage(withURL: url, completion: { [weak self] response in
announcementImageView.af.setImage(withURL: url, completion: { [weak self] response in

guard let self,
let width = response.value?.size.width,
Expand Down
4 changes: 2 additions & 2 deletions WordPress/WordPressTest/PeopleServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PeopleServiceTests: CoreDataTestCase {
done()
},
failure: { error in
XCTAssertTrue(error is WordPressComRestApiEndpointError)
XCTAssertTrue(error is WordPressAPIError<WordPressComRestApiEndpointError>)
done()
}
)
Expand Down Expand Up @@ -212,7 +212,7 @@ class PeopleServiceTests: CoreDataTestCase {
done()
},
failure: { error in
XCTAssertTrue(error is WordPressComRestApiEndpointError)
XCTAssertTrue(error is WordPressAPIError<WordPressComRestApiEndpointError>)
done()
}
)
Expand Down

0 comments on commit 1393161

Please sign in to comment.