diff --git a/Riot/Modules/Onboarding/AuthenticationCoordinator.swift b/Riot/Modules/Onboarding/AuthenticationCoordinator.swift index b78dad46c..91c016b90 100644 --- a/Riot/Modules/Onboarding/AuthenticationCoordinator.swift +++ b/Riot/Modules/Onboarding/AuthenticationCoordinator.swift @@ -17,6 +17,7 @@ */ import UIKit +import CommonKit struct AuthenticationCoordinatorParameters { let navigationRouter: NavigationRouterType @@ -59,6 +60,9 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc /// The listener object that informs the coordinator whether verification needs to be presented or not. private var verificationListener: SessionVerificationListener? + + private var indicatorPresenter: UserIndicatorTypePresenterProtocol + private var successIndicator: UserIndicator? /// The password entered, for use when setting up cross-signing. private var password: String? @@ -77,6 +81,8 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc self.navigationRouter = parameters.navigationRouter self.initialScreen = parameters.initialScreen self.canPresentAdditionalScreens = parameters.canPresentAdditionalScreens + + indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: parameters.navigationRouter.toPresentable()) super.init() } @@ -615,7 +621,12 @@ extension AuthenticationCoordinator: AuthenticationServiceDelegate { } func authenticationService(_ service: AuthenticationService, didUpdateStateWithLink link: UniversalLink) { - // updating current views according to the link doesn't seem easy. + if link.pathParams.first == "register" { + callback?(.cancel(.register)) + } else { + callback?(.cancel(.login)) + } + successIndicator = indicatorPresenter.present(.success(label: VectorL10n.done)) } } diff --git a/Riot/Utils/UniversalLink.m b/Riot/Utils/UniversalLink.m index cfdf08f59..32ce62dd4 100644 --- a/Riot/Utils/UniversalLink.m +++ b/Riot/Utils/UniversalLink.m @@ -109,7 +109,10 @@ queryParams[key] = [NSMutableArray array]; } - [queryParams[key] addObject:value]; + if (![queryParams[key] containsObject:value]) + { + [queryParams[key] addObject:value]; + } } else { diff --git a/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift b/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift index e78760796..9037f7680 100644 --- a/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift +++ b/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift @@ -97,6 +97,7 @@ class AuthenticationService: NSObject { let flow: AuthenticationFlow = isRegister ? .register : .login if needsAuthentication { + reset() // not logged in // update the state with given HS and IS addresses state = AuthenticationState(flow: flow,