From 8aaa77390494df8db0d7922f3383b38c6d19093c Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Mon, 1 Nov 2021 21:43:53 -0300 Subject: [PATCH] Rename resumeAuth method --- Auth0/ASCallbackTransaction.swift | 2 +- Auth0/BaseTransaction.swift | 6 +++--- Auth0Tests/BaseTransactionSpec.swift | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Auth0/ASCallbackTransaction.swift b/Auth0/ASCallbackTransaction.swift index 75bb6d4d7..13b26d16b 100644 --- a/Auth0/ASCallbackTransaction.swift +++ b/Auth0/ASCallbackTransaction.swift @@ -23,7 +23,7 @@ #if WEB_AUTH_PLATFORM import AuthenticationServices -final class ASCallbackTransaction: BaseCallbackTransaction, ASWebAuthenticationPresentationContextProviding { +final class ASCallbackTransaction: BaseCallbackTransaction { init(url: URL, schemeURL: URL, callback: @escaping (Bool) -> Void) { super.init(callback: callback) diff --git a/Auth0/BaseTransaction.swift b/Auth0/BaseTransaction.swift index 11f0cefbc..5214a15f5 100644 --- a/Auth0/BaseTransaction.swift +++ b/Auth0/BaseTransaction.swift @@ -53,9 +53,9 @@ class BaseTransaction: NSObject, AuthTransaction { authSession = nil } - func handleUrl(_ url: URL) -> Bool { + func resume(_ url: URL) -> Bool { self.logger?.trace(url: url, source: "iOS Safari") - if self.resumeAuth(url) { + if self.handleURL(url) { authSession?.cancel() authSession = nil return true @@ -63,7 +63,7 @@ class BaseTransaction: NSObject, AuthTransaction { return false } - private func resumeAuth(_ url: URL) -> Bool { + private func handleURL(_ url: URL) -> Bool { guard url.absoluteString.lowercased().hasPrefix(self.redirectURL.absoluteString.lowercased()) else { return false } guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else { self.callback(.failure(AuthenticationError(string: url.absoluteString, statusCode: 200))) diff --git a/Auth0Tests/BaseTransactionSpec.swift b/Auth0Tests/BaseTransactionSpec.swift index b36971e99..d916faddd 100644 --- a/Auth0Tests/BaseTransactionSpec.swift +++ b/Auth0Tests/BaseTransactionSpec.swift @@ -78,19 +78,19 @@ class BaseTransactionSpec: QuickSpec { context("handle url") { it("should handle url") { let url = URL(string: "https://samples.auth0.com/callback?code=\(code)&state=state")! - expect(transaction.handleUrl(url)) == true + expect(transaction.resume(url)) == true expect(result).toEventually(haveCredentials()) } it("should handle url with error") { let url = URL(string: "https://samples.auth0.com/callback?error=error&error_description=description&state=state")! - expect(transaction.handleUrl(url)) == true + expect(transaction.resume(url)) == true expect(result).toEventually(haveAuthenticationError(code: "error", description: "description")) } it("should fail to handle url without state") { let url = URL(string: "https://samples.auth0.com/callback?code=\(code)")! - expect(transaction.handleUrl(url)) == false + expect(transaction.resume(url)) == false } }