Merge pull request #5802 from vector-im/doug/5879_fix_sso_buttons

Fix social button visibility during registration
This commit is contained in:
Doug
2022-03-10 17:08:16 +00:00
committed by GitHub
5 changed files with 23 additions and 11 deletions
@@ -43,6 +43,13 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
var childCoordinators: [Coordinator] = []
var completion: ((AuthenticationCoordinatorResult) -> Void)?
var customServerFieldsVisible = false {
didSet {
guard customServerFieldsVisible != oldValue else { return }
authenticationViewController.setCustomServerFieldsVisible(customServerFieldsVisible)
}
}
// MARK: - Setup
init(parameters: AuthenticationCoordinatorParameters) {
@@ -74,10 +81,6 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
authenticationViewController.authType = authenticationType
}
func showCustomServer() {
authenticationViewController.setCustomServerFieldsVisible(true)
}
func update(externalRegistrationParameters: [AnyHashable: Any]) {
authenticationViewController.externalRegistrationParameters = externalRegistrationParameters
}
@@ -36,12 +36,12 @@ enum AuthenticationCoordinatorResult {
protocol AuthenticationCoordinatorProtocol: Coordinator, Presentable {
var completion: ((AuthenticationCoordinatorResult) -> Void)? { get set }
/// Whether the custom homeserver checkbox is enabled for the user to enter a homeserver URL.
var customServerFieldsVisible: Bool { get set }
/// Update the screen to display registration or login.
func update(authenticationType: MXKAuthenticationType)
/// Enable the custom server checkbox to allow the user to enter a homeserver URL.
func showCustomServer()
/// Force a registration process based on a predefined set of parameters from a server provisioning link.
/// For more information see `AuthenticationViewController.externalRegistrationParameters`.
func update(externalRegistrationParameters: [AnyHashable: Any])
@@ -504,6 +504,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
// Remove the potential back button.
self.navigationItem.leftBarButtonItem = nil;
[self.navigationItem setHidesBackButton:YES];
}
else
{
@@ -903,6 +904,12 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
authInputsview.thirdPartyIdentifiersHidden = YES;
[self updateRegistrationScreenWithThirdPartyIdentifiersHidden:YES];
// Show the social login buttons again if needed.
[self updateSocialLoginViewVisibility];
// Allow backward navigation in the flow again.
[self.navigationItem setHidesBackButton:NO];
}
}
else if (sender == self.submitButton)
@@ -947,7 +954,10 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
else
{
[self.authenticationActivityIndicator stopAnimating];
// Hide the social login buttons now that a different flow has started.
[self hideSocialLoginView];
// Show the supported 3rd party ids which may be added to the account
authInputsview.thirdPartyIdentifiersHidden = NO;
[self updateRegistrationScreenWithThirdPartyIdentifiersHidden:NO];
@@ -215,9 +215,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
coordinator.update(externalRegistrationParameters: externalRegistrationParameters)
}
if useCaseResult == .customServer {
coordinator.showCustomServer()
}
coordinator.customServerFieldsVisible = useCaseResult == .customServer
if let softLogoutCredentials = parameters.softLogoutCredentials {
coordinator.update(softLogoutCredentials: softLogoutCredentials)
+1
View File
@@ -0,0 +1 @@
Authentication: Fix social login buttons visibility during registration flow and other minor navigation tweaks.