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

Commit 6a463a8

Browse files
authored
Merge pull request #595 from wordpress-mobile/issue/wc-3962-allow-login-override
Restore Allowing UI Overrides for Login Errors
2 parents 040768d + 968c1f2 commit 6a463a8

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressAuthenticator"
3-
s.version = "1.37.0"
3+
s.version = "1.38.0-beta.1"
44

55
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."
66
s.description = <<-DESC

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,22 @@ private extension GetStartedViewController {
408408
// username instead.
409409
self.showSelfHostedWithError(error)
410410
} else {
411-
self.displayError(error as NSError, sourceTag: self.sourceTag)
411+
guard let authenticationDelegate = WordPressAuthenticator.shared.delegate,
412+
authenticationDelegate.shouldHandleError(error) else {
413+
self.displayError(error as NSError, sourceTag: self.sourceTag)
414+
return
415+
}
416+
417+
/// Hand over control to the host app.
418+
authenticationDelegate.handleError(error) { customUI in
419+
// Setting the rightBarButtonItems of the custom UI before pushing the view controller
420+
// and resetting the navigationController's navigationItem after the push seems to be the
421+
// only combination that gets the Help button to show up.
422+
customUI.navigationItem.rightBarButtonItems = self.navigationItem.rightBarButtonItems
423+
self.navigationController?.navigationItem.rightBarButtonItems = self.navigationItem.rightBarButtonItems
424+
425+
self.navigationController?.pushViewController(customUI, animated: true)
426+
}
412427
}
413428
}
414429

0 commit comments

Comments
 (0)