Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit b9db2bb

Browse files
authored
Adopt WordPressKit breaking changes (#829)
2 parents 51fa39d + 6312d0a commit b9db2bb

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ _None._
4646

4747
### Internal Changes
4848

49-
_None._
49+
- Depend on WordPressKit 12.0. [#829]
5050

5151
## 9.0.0
5252

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def wordpress_authenticator_pods
2828
## These should match the version requirement from the podspec.
2929
pod 'Gridicons', '~> 1.0'
3030
pod 'WordPressUI', '~> 1.7-beta'
31-
pod 'WordPressKit', '~> 11.0'
31+
pod 'WordPressKit', '~> 12.0'
3232
pod 'WordPressShared', '~> 2.1-beta'
3333

3434
third_party_pods

Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ PODS:
1313
- Gridicons (~> 1.0)
1414
- "NSURL+IDN (= 0.4)"
1515
- SVProgressHUD (~> 2.2.5)
16-
- WordPressKit (~> 11.0)
16+
- WordPressKit (~> 12.0)
1717
- WordPressShared (~> 2.1-beta)
1818
- WordPressUI (~> 1.7-beta)
19-
- WordPressKit (11.0.0):
19+
- WordPressKit (12.0.0):
2020
- Alamofire (~> 4.8.0)
2121
- NSObject-SafeExpectations (~> 0.0.4)
2222
- UIDeviceIdentifier (~> 2.0)
@@ -35,7 +35,7 @@ DEPENDENCIES:
3535
- SVProgressHUD (= 2.2.5)
3636
- SwiftLint (~> 0.49)
3737
- WordPressAuthenticator (from `.`)
38-
- WordPressKit (~> 11.0)
38+
- WordPressKit (~> 12.0)
3939
- WordPressShared (~> 2.1-beta)
4040
- WordPressUI (~> 1.7-beta)
4141

@@ -71,12 +71,12 @@ SPEC CHECKSUMS:
7171
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
7272
SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211
7373
UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17
74-
WordPressAuthenticator: 5a6c02f010a7c2c6a9ca17b15233b25f74b3ad33
75-
WordPressKit: c9ec8dd6ea731af5a2d7cadb9944b67be716d63e
74+
WordPressAuthenticator: ce9688b78d71e296ea54159c4eef3a1ea5cc1838
75+
WordPressKit: 25452ae322f6fcb605f816caec2ff8ac707c7d9d
7676
WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2
7777
WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06
7878
wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd
7979

80-
PODFILE CHECKSUM: 9dc67ad3b7985a633faef0b6b516c80f41513c7c
80+
PODFILE CHECKSUM: 133f1b432d72077ba5e993fac2fe6831d9d0ff1d
8181

8282
COCOAPODS: 1.14.3

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ Pod::Spec.new do |s|
4040
# Use a loose restriction that allows both production and beta versions, up to the next major version.
4141
# If you want to update which of these is used, specify it in the host app.
4242
s.dependency 'WordPressUI', '~> 1.7-beta'
43-
s.dependency 'WordPressKit', '~> 11.0'
43+
s.dependency 'WordPressKit', '~> 12.0'
4444
s.dependency 'WordPressShared', '~> 2.1-beta'
4545
end

WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,25 @@ public enum SignInError: Error {
1818
case invalidWPComPassword(source: SignInSource)
1919

2020
init?(error: Error, source: SignInSource?) {
21-
let error = error as NSError
21+
// `WordPressComRestApi` currently may return an WordPressComRestApiEndpointError, but it will later be changed
22+
// to return `WordPressAPIError<WordPressComRestApiEndpointError>`. We'll handle both cases for now.
23+
var restApiError = error as? WordPressComRestApiEndpointError
2224

23-
switch error.code {
24-
case WordPressComRestApiError.unknown.rawValue:
25-
let restAPIErrorCode = error.userInfo[WordPressComRestApi.ErrorKeyErrorCode] as? String
26-
if let source = source, restAPIErrorCode == "unknown_user" {
25+
if restApiError == nil,
26+
let apiError = error as? WordPressAPIError<WordPressComRestApiEndpointError>,
27+
case let .endpointError(endpointError) = apiError {
28+
restApiError = endpointError
29+
}
30+
31+
if let restApiError, restApiError.code == .unknown {
32+
if let source = source, restApiError.apiErrorCode == "unknown_user" {
2733
self = .invalidWPComEmail(source: source)
2834
} else {
2935
return nil
3036
}
31-
default:
32-
return nil
3337
}
38+
39+
return nil
3440
}
3541
}
3642

0 commit comments

Comments
 (0)