Skip to content

Commit

Permalink
Merge pull request #9750 from wordpress-mobile/issue/updating-authent…
Browse files Browse the repository at this point in the history
…icator-api

WordPressAuthenticator: Wiring the latest Delegate's API
  • Loading branch information
jleandroperez authored Jul 12, 2018
2 parents f79a1a5 + 458b694 commit b5f4a7f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ target 'WordPress' do
pod 'Gridicons', '0.16'
pod 'NSURL+IDN', '0.3'
pod 'WPMediaPicker', '1.1'
pod 'WordPressAuthenticator', '1.0.1'
pod 'WordPressAuthenticator', '1.0.2'
pod 'WordPress-Aztec-iOS', '1.0.0-beta.23'
pod 'WordPress-Editor-iOS', '1.0.0-beta.23'
pod 'WordPressUI', '1.0.6'
Expand Down
16 changes: 8 additions & 8 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PODS:
- CocoaLumberjack/Default
- Crashlytics (3.10.1):
- Fabric (~> 1.7.5)
- Fabric (1.7.8)
- Fabric (1.7.9)
- FormatterKit/Resources (1.8.2)
- FormatterKit/TimeIntervalFormatter (1.8.2):
- FormatterKit/Resources
Expand Down Expand Up @@ -79,7 +79,7 @@ PODS:
- MRProgress/ProgressBaseClass (0.8.3)
- MRProgress/Stopable (0.8.3):
- MRProgress/Helper
- Nimble (7.1.2)
- Nimble (7.1.3)
- NSObject-SafeExpectations (0.0.3)
- "NSURL+IDN (0.3)"
- OCMock (3.4.2)
Expand All @@ -105,7 +105,7 @@ PODS:
- WordPress-Aztec-iOS (1.0.0-beta.23)
- WordPress-Editor-iOS (1.0.0-beta.23):
- WordPress-Aztec-iOS (= 1.0.0-beta.23)
- WordPressAuthenticator (1.0.1):
- WordPressAuthenticator (1.0.2):
- 1PasswordExtension (= 1.8.5)
- Alamofire (= 4.7.2)
- CocoaLumberjack (= 3.4.2)
Expand Down Expand Up @@ -166,7 +166,7 @@ DEPENDENCIES:
- UIDeviceIdentifier (~> 0.4)
- WordPress-Aztec-iOS (= 1.0.0-beta.23)
- WordPress-Editor-iOS (= 1.0.0-beta.23)
- WordPressAuthenticator (= 1.0.1)
- WordPressAuthenticator (= 1.0.2)
- WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `c2ae16bbc3fb759e0684fc9e5642d52390d00285`)
- WordPressShared (= 1.0.8)
- WordPressUI (= 1.0.6)
Expand Down Expand Up @@ -234,7 +234,7 @@ SPEC CHECKSUMS:
BuddyBuildSDK: 8ae12ee721098b356a961ea7dce70ae55f93a7d2
CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd
Crashlytics: aee1a064cbbf99b32efa3f056a5f458d846bc8ff
Fabric: fba4684a95df789565b0b27fc5b6e68f1755af32
Fabric: a2917d3895e4c1569b9c3170de7320ea1b1e6661
FormatterKit: 4b8f29acc9b872d5d12a63efb560661e8f2e1b98
Gifu: fd1e9e3a15ac5d90bae0a510e4ed9f94b485ab03
GoogleSignInRepacked: d357702618c555f38923576924661325eb1ef22b
Expand All @@ -244,7 +244,7 @@ SPEC CHECKSUMS:
lottie-ios: d699fdee68d7b63e721d949388b015fef1aaa4ac
MGSwipeTableCell: fb20e983988bde2b8d0df29c2d9e1d8ffd10b74a
MRProgress: 16de7cc9f347e8846797a770db102a323fe7ef09
Nimble: 3835ba9f459daa6b347f8a8e110aaae8ca1920a8
Nimble: 2839b01d1b31f6a6a7777a221f0d91cf52e8e27b
NSObject-SafeExpectations: b989b68a8a9b7b9f2b264a8b52ba9d7aab8f3129
"NSURL+IDN": 82355a0afd532fe1de08f6417c134b49b1a1c4b3
OCMock: ebe9ee1dca7fbed0ff9193ac0b3e2d8862ea56f6
Expand All @@ -255,14 +255,14 @@ SPEC CHECKSUMS:
UIDeviceIdentifier: a959a6d4f51036b4180dd31fb26483a820f1cc46
WordPress-Aztec-iOS: f2cc5402915e6f62db9681a0872e308ba8c9850c
WordPress-Editor-iOS: 4f46c2fa98f3017e9e39ad30ba9f03dbd6612ce4
WordPressAuthenticator: 60c07bcfb6f1578afaf17621ae4393d688c2ede9
WordPressAuthenticator: 20e8eb9cb61bef82370658037bdf9ca24a54570a
WordPressKit: a24baaa783c3a221f2d9a51c19318cbb27333373
WordPressShared: 063e1e8b1a7aaf635abf17f091a2d235a068abdc
WordPressUI: af141587ec444f9af753a00605bd0d3f14d8d8a3
WPMediaPicker: 5cc9386a4720f906d8fb79c7c4090d216b9f2348
wpxmlrpc: bfc572f62ce7ee897f6f38b098d2ba08732ecef4
ZendeskSDK: 2cda4db2ba6b10ba89aeb8dddaa94e97c85946a0

PODFILE CHECKSUM: b11fa9885d16112f988d1bfa0f76b1205468e8e1
PODFILE CHECKSUM: 339d865b12a7ec85801b0246d83b31ae9ccc508c

COCOAPODS: 1.5.3
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ extension WordPressAuthenticationManager: WordPressAuthenticatorDelegate {

/// Synchronizes the specified WordPress Account.
///
func sync(credentials: WordPressCredentials, onCompletion: @escaping (Error?) -> Void) {
func sync(credentials: WordPressCredentials, onCompletion: @escaping () -> Void) {
switch credentials {
case .wpcom(let username, let authToken, let isJetpackLogin, _):
syncWPCom(username: username, authToken: authToken, isJetpackLogin: isJetpackLogin, onCompletion: onCompletion)
Expand Down Expand Up @@ -236,7 +236,7 @@ private extension WordPressAuthenticationManager {

/// Synchronizes a WordPress.com account with the specified credentials.
///
private func syncWPCom(username: String, authToken: String, isJetpackLogin: Bool, onCompletion: @escaping (Error?) -> ()) {
private func syncWPCom(username: String, authToken: String, isJetpackLogin: Bool, onCompletion: @escaping () -> ()) {
let service = WordPressComSyncService()

service.syncWPCom(username: username, authToken: authToken, isJetpackLogin: isJetpackLogin, onSuccess: { account in
Expand All @@ -247,21 +247,21 @@ private extension WordPressAuthenticationManager {
let notification = isJetpackLogin == true ? .wordpressLoginFinishedJetpackLogin : Foundation.Notification.Name(rawValue: WordPressAuthenticator.WPSigninDidFinishNotification)
NotificationCenter.default.post(name: notification, object: account)

onCompletion(nil)
onCompletion()

}, onFailure: { error in
onCompletion(error)
}, onFailure: { _ in
onCompletion()
})
}

/// Synchronizes a WordPress.org account with the specified credentials.
///
private func syncWPOrg(username: String, password: String, xmlrpc: String, options: [AnyHashable: Any], onCompletion: @escaping (Error?) -> ()) {
private func syncWPOrg(username: String, password: String, xmlrpc: String, options: [AnyHashable: Any], onCompletion: @escaping () -> ()) {
let service = BlogSyncFacade()

service.syncBlog(withUsername: username, password: password, xmlrpc: xmlrpc, options: options) { blog in
RecentSitesService().touch(blog: blog)
onCompletion(nil)
onCompletion()
}
}
}

0 comments on commit b5f4a7f

Please sign in to comment.