From 2e8f7d3486940aa00470a727942fe2eacd991bef Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 3 Jun 2021 11:21:40 -0600 Subject: [PATCH 1/2] Allow host app to override login error UI in GetStartedViewController This reverts some of the changes in 3b46ba8. That commit removed the ability for the host app to override errors. I'm applying it a bit differently here though. There was a condition added in 5cadb62 which automatically added an error dialog if the `WordPressAuthenticator.shared.configuration.enableSignUp` is `false`. The `sendEmail` is no longer called so I'm adding the override directly in `handleLoginError()`. --- .../Get Started/GetStartedViewController.swift | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift b/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift index a37bf4a7e..385f1348d 100644 --- a/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift +++ b/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift @@ -408,7 +408,22 @@ private extension GetStartedViewController { // username instead. self.showSelfHostedWithError(error) } else { - self.displayError(error as NSError, sourceTag: self.sourceTag) + guard let authenticationDelegate = WordPressAuthenticator.shared.delegate, + authenticationDelegate.shouldHandleError(error) else { + self.displayError(error as NSError, sourceTag: self.sourceTag) + return + } + + /// Hand over control to the host app. + authenticationDelegate.handleError(error) { customUI in + // Setting the rightBarButtonItems of the custom UI before pushing the view controller + // and resetting the navigationController's navigationItem after the push seems to be the + // only combination that gets the Help button to show up. + customUI.navigationItem.rightBarButtonItems = self.navigationItem.rightBarButtonItems + self.navigationController?.navigationItem.rightBarButtonItems = self.navigationItem.rightBarButtonItems + + self.navigationController?.pushViewController(customUI, animated: true) + } } } From 968c1f2af497ac7a063c344d915a30bf7f3aecc1 Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 3 Jun 2021 12:26:23 -0600 Subject: [PATCH 2/2] Increment version to 1.38.0-beta.1 --- WordPressAuthenticator.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 74ef75a2b..7d434d64b 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.37.0" + s.version = "1.38.0-beta.1" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC