From e61570ca0b0afcaac496a7d6497b5471f0bb6f43 Mon Sep 17 00:00:00 2001 From: Sharma Elanthiraiyan Date: Thu, 25 Aug 2022 10:26:34 +0530 Subject: [PATCH 1/4] Pass last step and flow in `presentSupport` delegate method. --- .../WordPressAuthenticatorDelegateProtocol.swift | 8 +++++++- .../Extensions/FancyAlertViewController+LoginError.swift | 3 ++- WordPressAuthenticator/NUX/NUXViewControllerBase.swift | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift index e9b4dbf0d..a494253b5 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift @@ -62,7 +62,13 @@ public protocol WordPressAuthenticatorDelegate: AnyObject { /// Presents the Support Interface from a given ViewController, with a specified SourceTag. /// - func presentSupport(from sourceViewController: UIViewController, sourceTag: WordPressSupportSourceTag) + /// - Parameters: + /// - from: ViewController from which to present the support interface from + /// - sourceTag: Support source tag of the view controller. + /// - lastStep: Last `Step` tracked in `AuthenticatorAnalyticsTracker` + /// - lastFlow: Last `Flow` tracked in `AuthenticatorAnalyticsTracker` + /// + func presentSupport(from sourceViewController: UIViewController, sourceTag: WordPressSupportSourceTag, lastStep: String, lastFlow: String) /// Indicates if the Login Epilogue should be displayed. /// diff --git a/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift b/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift index b80af63da..0b8bc9b59 100644 --- a/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift +++ b/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift @@ -121,7 +121,8 @@ extension FancyAlertViewController { return } - authDelegate.presentSupport(from: sourceViewController, sourceTag: sourceTag) + let state = AuthenticatorAnalyticsTracker.shared.state + authDelegate.presentSupport(from: sourceViewController, sourceTag: sourceTag, lastStep: state.lastStep.rawValue, lastFlow: state.lastFlow.rawValue) } } diff --git a/WordPressAuthenticator/NUX/NUXViewControllerBase.swift b/WordPressAuthenticator/NUX/NUXViewControllerBase.swift index 5583a7ed8..aa7728110 100644 --- a/WordPressAuthenticator/NUX/NUXViewControllerBase.swift +++ b/WordPressAuthenticator/NUX/NUXViewControllerBase.swift @@ -319,6 +319,7 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro fatalError() } - WordPressAuthenticator.shared.delegate?.presentSupport(from: navigationController, sourceTag: source) + let state = AuthenticatorAnalyticsTracker.shared.state + WordPressAuthenticator.shared.delegate?.presentSupport(from: navigationController, sourceTag: source, lastStep: state.lastStep.rawValue, lastFlow: state.lastFlow.rawValue) } } From 26c17366cf3b0649dc8ff3844a159017e568a8c7 Mon Sep 17 00:00:00 2001 From: Sharma Elanthiraiyan Date: Thu, 25 Aug 2022 10:26:51 +0530 Subject: [PATCH 2/4] Increment pods-spec version. --- WordPressAuthenticator.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index b2a425910..0bc8d948a 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'WordPressAuthenticator' - s.version = '2.3.0' + s.version = '2.4.0-beta.1' s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.' s.description = <<-DESC From bce1cffedfa49ae30acb3995c0c4e75cac2aa21c Mon Sep 17 00:00:00 2001 From: Sharma Elanthiraiyan Date: Thu, 25 Aug 2022 11:13:28 +0530 Subject: [PATCH 3/4] Update comment for clarity. --- .../Authenticator/WordPressAuthenticatorDelegateProtocol.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift index a494253b5..75f72b5ad 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift @@ -60,7 +60,7 @@ public protocol WordPressAuthenticatorDelegate: AnyObject { /// func presentSignupEpilogue(in navigationController: UINavigationController, for credentials: AuthenticatorCredentials, service: SocialService?) - /// Presents the Support Interface from a given ViewController, with a specified SourceTag. + /// Presents the Support Interface from a given ViewController. /// /// - Parameters: /// - from: ViewController from which to present the support interface from From 5ea0d99de046fcf56c5dd3ec6b1f40103cdb9418 Mon Sep 17 00:00:00 2001 From: Sharma Elanthiraiyan Date: Thu, 25 Aug 2022 12:19:26 +0530 Subject: [PATCH 4/4] Stop passing `Step` and `Flow` as strings and use the actual type. --- .../Authenticator/WordPressAuthenticatorDelegateProtocol.swift | 2 +- .../Extensions/FancyAlertViewController+LoginError.swift | 2 +- WordPressAuthenticator/NUX/NUXViewControllerBase.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift index 75f72b5ad..903625351 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDelegateProtocol.swift @@ -68,7 +68,7 @@ public protocol WordPressAuthenticatorDelegate: AnyObject { /// - lastStep: Last `Step` tracked in `AuthenticatorAnalyticsTracker` /// - lastFlow: Last `Flow` tracked in `AuthenticatorAnalyticsTracker` /// - func presentSupport(from sourceViewController: UIViewController, sourceTag: WordPressSupportSourceTag, lastStep: String, lastFlow: String) + func presentSupport(from sourceViewController: UIViewController, sourceTag: WordPressSupportSourceTag, lastStep: AuthenticatorAnalyticsTracker.Step, lastFlow: AuthenticatorAnalyticsTracker.Flow) /// Indicates if the Login Epilogue should be displayed. /// diff --git a/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift b/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift index 0b8bc9b59..9943351ba 100644 --- a/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift +++ b/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift @@ -122,7 +122,7 @@ extension FancyAlertViewController { } let state = AuthenticatorAnalyticsTracker.shared.state - authDelegate.presentSupport(from: sourceViewController, sourceTag: sourceTag, lastStep: state.lastStep.rawValue, lastFlow: state.lastFlow.rawValue) + authDelegate.presentSupport(from: sourceViewController, sourceTag: sourceTag, lastStep: state.lastStep, lastFlow: state.lastFlow) } } diff --git a/WordPressAuthenticator/NUX/NUXViewControllerBase.swift b/WordPressAuthenticator/NUX/NUXViewControllerBase.swift index aa7728110..7abed336e 100644 --- a/WordPressAuthenticator/NUX/NUXViewControllerBase.swift +++ b/WordPressAuthenticator/NUX/NUXViewControllerBase.swift @@ -320,6 +320,6 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro } let state = AuthenticatorAnalyticsTracker.shared.state - WordPressAuthenticator.shared.delegate?.presentSupport(from: navigationController, sourceTag: source, lastStep: state.lastStep.rawValue, lastFlow: state.lastFlow.rawValue) + WordPressAuthenticator.shared.delegate?.presentSupport(from: navigationController, sourceTag: source, lastStep: state.lastStep, lastFlow: state.lastFlow) } }