Updates following PR feedback.

This commit is contained in:
Doug
2022-02-10 12:59:13 +00:00
parent 4d00cceb48
commit 56b70d254b
8 changed files with 44 additions and 32 deletions
@@ -63,7 +63,7 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
func showCustomServer() {
authenticationViewController.hideCustomServers(false)
authenticationViewController.setCustomServerFieldsVisible(true)
}
func update(externalRegistrationParameters: [AnyHashable: Any]) {
@@ -54,9 +54,9 @@
/// returns YES if the SSO login can be continued.
- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId;
/// Hides/shows the custom homeserver field.
/// @param hidden YES to hide, NO to show.
- (void)hideCustomServers:(BOOL)hidden;
/// Show or hide the custom server textfields.
/// @param isVisible YES to show, NO to hide.
- (void)setCustomServerFieldsVisible:(BOOL)isVisible;
@end
@@ -160,7 +160,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
}
self.serverOptionsContainer.hidden = !BuildSettings.authScreenShowCustomServerOptions;
[self hideCustomServers:YES];
[self setCustomServerFieldsVisible:NO];
// Soft logout section
self.softLogoutClearDataButton.layer.cornerRadius = 5;
@@ -888,7 +888,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
{
if (sender == self.customServersTickButton)
{
[self hideCustomServers:!self.customServersContainer.hidden];
[self setCustomServerFieldsVisible:self.customServersContainer.hidden];
}
else if (sender == self.forgotPasswordButton)
{
@@ -1236,14 +1236,14 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
[self.view layoutIfNeeded];
}
- (void)hideCustomServers:(BOOL)hidden
- (void)setCustomServerFieldsVisible:(BOOL)isVisible
{
if (self.customServersContainer.isHidden == hidden)
if (self.customServersContainer.isHidden != isVisible)
{
return;
}
if (hidden)
if (!isVisible)
{
[self.homeServerTextField resignFirstResponder];
[self.identityServerTextField resignFirstResponder];
@@ -1361,7 +1361,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
[self.authenticationActivityIndicator startAnimating];
// Hide the custom server details in order to save customized inputs
[self hideCustomServers:YES];
[self setCustomServerFieldsVisible:NO];
MXKAccount *account = [[MXKAccountManager sharedManager] accountForUserId:userId];
MXSession *session = account.mxSession;
@@ -1586,7 +1586,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
{
// wellKnown matches with application default servers
// Hide custom servers
[self hideCustomServers:YES];
[self setCustomServerFieldsVisible:NO];
}
else
{
@@ -1618,7 +1618,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
}
// And show custom servers
[self hideCustomServers:NO];
[self setCustomServerFieldsVisible:YES];
}
#pragma mark - KeyVerificationCoordinatorBridgePresenterDelegate
@@ -138,7 +138,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
switch result {
case .register:
showUseCase()
showUseCaseSelectionScreen()
case .login:
showAuthenticationScreen()
}
@@ -146,7 +146,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
@available(iOS 14.0, *)
/// Show the use case screen for new users.
private func showUseCase() {
private func showUseCaseSelectionScreen() {
let coordinator = OnboardingUseCaseCoordinator()
coordinator.completion = { [weak self, weak coordinator] result in
guard let self = self, let coordinator = coordinator else { return }
@@ -227,7 +227,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
let useCaseResult = useCaseResult,
let userSession = UserSessionsService.shared.mainUserSession {
// Store the value in the user's session
userSession.properties.useCase = useCaseResult.userSessionPropertyValue
userSession.userProperties.useCase = useCaseResult.userSessionPropertyValue
}
}
}