Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activer la connexion sso #1086

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d52b9e1
Ajout de l'application scheme pour retour dans l'app après SSO sur A…
Aug 20, 2024
4357328
Réactivation de l'Onboarding original Element (qui supporte le SSO) p…
Aug 20, 2024
f572f1f
Ajout de l'URL scheme dans les fichiers plist
Aug 20, 2024
6467bd4
Skip Onboarding useCase selection
Aug 20, 2024
d512392
Reinclude Element Legacy code (for LegacyAuthentication for example)
Aug 21, 2024
16547cc
Reimport "AuthenticationViewController.h" for LegacyAuthenticationCoo…
Aug 21, 2024
7276e74
Disable default home and identity server temporarily because they are…
Aug 21, 2024
ad5724f
Temporarily disable custom servers for SSO tests
Aug 21, 2024
2c6f0b0
Restore deep link Connect to Element way (not Tchap way)
Aug 21, 2024
53b993d
Revert "Restore deep link Connect to Element way (not Tchap way)"
Aug 21, 2024
03e1be1
Revert "Reimport "AuthenticationViewController.h" for LegacyAuthentic…
Aug 21, 2024
75cb7be
Revert "Reinclude Element Legacy code (for LegacyAuthentication for e…
Aug 21, 2024
f3c9e4f
Revert "Temporarily disable custom servers for SSO tests"
Aug 21, 2024
a3bbf20
Call Element onboarding flow rather than Tchap which doesn't support SSO
Sep 3, 2024
c26dfaf
Customize Element onboarding splash screen to mimic Tchap
Sep 3, 2024
df4a149
Remove Tchap welcome classes
Sep 3, 2024
87b6c68
Revert "Remove Tchap welcome classes"
Sep 3, 2024
057c970
Remove calls to Tchap welcome classes
Sep 3, 2024
ec4453e
Remove instantiation of TabBarCoordinator (no more used since newLayout)
Sep 3, 2024
0e93ffc
Remove Tchap Welcome files
Sep 3, 2024
c660860
Add Changelog
Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Btchap/SupportingFiles/Btchap-App-Common.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ BUNDLE_DISPLAY_NAME = Btchap
BASE_BUNDLE_IDENTIFIER = fr.gouv.btchap
APPLICATION_GROUP_IDENTIFIER = group.$(BASE_BUNDLE_IDENTIFIER)
PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_IDENTIFIER)
APPLICATION_SCHEME = tchap

INFOPLIST_FILE = Btchap/SupportingFiles/Info.plist
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
Expand Down
13 changes: 13 additions & 0 deletions Btchap/SupportingFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>$(BASE_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$(APPLICATION_SCHEME)</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key>
Expand Down
1 change: 1 addition & 0 deletions DevTchap/SupportingFiles/DevTchap-App-Common.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ BUNDLE_DISPLAY_NAME = DevTchap
BASE_BUNDLE_IDENTIFIER = fr.gouv.tchap.dev
APPLICATION_GROUP_IDENTIFIER = group.$(BASE_BUNDLE_IDENTIFIER)
PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_IDENTIFIER)
APPLICATION_SCHEME = tchap

INFOPLIST_FILE = DevTchap/SupportingFiles/Info.plist
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
Expand Down
13 changes: 13 additions & 0 deletions DevTchap/SupportingFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>$(BASE_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$(APPLICATION_SCHEME)</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key>
Expand Down
36 changes: 35 additions & 1 deletion Riot/Modules/Authentication/AuthenticationCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
if authenticationService.state.homeserver.needsRegistrationFallback {
showFallback(for: flow)
} else {
showRegistrationScreen()
// Tchap: force email registration mode
// showRegistrationScreen()
TchapShowVerifyEmailScreen()
}
case .login:
if authenticationService.state.homeserver.needsLoginFallback {
Expand Down Expand Up @@ -379,6 +381,38 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
}

// Tchap: start Registration with VerifyEmail screen
/// Shows the login screen.
@MainActor private func TchapShowVerifyEmailScreen() {
MXLog.debug("[AuthenticationCoordinator] TchapShowVerifyEmailScreen")

guard let registrationWizard = authenticationService.registrationWizard else {
MXLog.failure("[AuthenticationCoordinator] showStage: Missing the RegistrationWizard needed to complete the stage.")
displayError(message: VectorL10n.errorCommonMessage)
return
}
let homeserver = authenticationService.state.homeserver

let parameters = AuthenticationVerifyEmailCoordinatorParameters(registrationWizard: registrationWizard,
homeserver: authenticationService.state.homeserver)
let coordinator = AuthenticationVerifyEmailCoordinator(parameters: parameters)
coordinator.callback = { [weak self] result in
self?.registrationStageDidComplete(with: result)
}

coordinator.start()
add(childCoordinator: coordinator)

if navigationRouter.modules.isEmpty {
navigationRouter.setRootModule(coordinator, popCompletion: nil)
} else {
navigationRouter.push(coordinator, animated: true) { [weak self] in
self?.remove(childCoordinator: coordinator)
}
}
}


/// Displays the next view in the flow based on the result from the registration screen.
@MainActor private func registrationCoordinator(_ coordinator: AuthenticationRegistrationCoordinator,
didCallbackWith result: AuthenticationRegistrationCoordinatorResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ - (void)viewDidLoad
}
else
{
self.defaultHomeServerUrl = RiotSettings.shared.homeserverUrlString;
// self.defaultHomeServerUrl = RiotSettings.shared.homeserverUrlString;
}

self.defaultIdentityServerUrl = RiotSettings.shared.identityServerUrlString;
// self.defaultIdentityServerUrl = RiotSettings.shared.identityServerUrlString;

self.welcomeImageView.image = AssetSharedImages.horizontalLogo.image;

Expand Down
54 changes: 25 additions & 29 deletions Riot/Modules/Home/AllChats/AllChatsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ class AllChatsViewController: HomeViewController {

// Reference to the current onboarding flow. It is always nil unless the flow is being presented.
private(set) var onboardingCoordinatorBridgePresenter: OnboardingCoordinatorBridgePresenter?
// Tchap: Use welcomeCoordinator instead of onboardingCoordinator
private(set) var welcomeCoordinatorBridgePresenter: WelcomeCoordinatorBridgePresenter?

// Tell whether the onboarding screen is preparing.
private(set) var isOnboardingInProgress: Bool = false
Expand Down Expand Up @@ -921,8 +919,7 @@ extension AllChatsViewController: SplitViewMasterViewControllerProtocol {
// This method can be called after the user chooses to clear their data as the MXSession
// is opened to call logout from. So we only set the credentials when authentication isn't
// in progress to prevent a second soft logout screen being shown.
// Tchap: Use WelcomeCoordinatorBridgePresenter instead of OnboardingCoordinatorBridgePresenter
guard self.welcomeCoordinatorBridgePresenter == nil && !self.isOnboardingCoordinatorPreparing else {
guard self.self.onboardingCoordinatorBridgePresenter == nil && !self.isOnboardingCoordinatorPreparing else {
return
}

Expand Down Expand Up @@ -1092,8 +1089,7 @@ extension AllChatsViewController: SplitViewMasterViewControllerProtocol {

private func showOnboardingFlowAndResetSessionFlags(_ resetSessionFlags: Bool) {
// Check whether an authentication screen is not already shown or preparing
// Tchap: Use WelcomeCoordinatorBridgePresenter instead of OnboardingCoordinatorBridgePresenter
guard self.welcomeCoordinatorBridgePresenter == nil && !self.isOnboardingCoordinatorPreparing else {
guard self.self.onboardingCoordinatorBridgePresenter == nil && !self.isOnboardingCoordinatorPreparing else {
return
}

Expand All @@ -1117,36 +1113,36 @@ extension AllChatsViewController: SplitViewMasterViewControllerProtocol {
MXLog.debug("[AllChatsViewController] presentOnboardingFlow")

// Tchap: Use WelcomeCoordinatorBridgePresenter instead of OnboardingCoordinatorBridgePresenter
let welcomeCoordinatorBridgePresenter = WelcomeCoordinatorBridgePresenter()
welcomeCoordinatorBridgePresenter.completion = { [weak self] in
guard let self = self else { return }

self.welcomeCoordinatorBridgePresenter?.dismiss(animated: true, completion: {
self.welcomeCoordinatorBridgePresenter = nil
})

self.isOnboardingInProgress = false // Must be set before calling didCompleteAuthentication
self.allChatsDelegate?.allChatsViewControllerDidCompleteAuthentication(self)
}

welcomeCoordinatorBridgePresenter.present(from: self, animated: true)
self.welcomeCoordinatorBridgePresenter = welcomeCoordinatorBridgePresenter


// let onboardingCoordinatorBridgePresenter = OnboardingCoordinatorBridgePresenter()
// onboardingCoordinatorBridgePresenter.completion = { [weak self] in
// let welcomeCoordinatorBridgePresenter = WelcomeCoordinatorBridgePresenter()
// welcomeCoordinatorBridgePresenter.completion = { [weak self] in
// guard let self = self else { return }
//
// self.onboardingCoordinatorBridgePresenter?.dismiss(animated: true, completion: {
// self.onboardingCoordinatorBridgePresenter = nil
//
// self.welcomeCoordinatorBridgePresenter?.dismiss(animated: true, completion: {
// self.welcomeCoordinatorBridgePresenter = nil
// })
//
// self.isOnboardingInProgress = false // Must be set before calling didCompleteAuthentication
// self.allChatsDelegate?.allChatsViewControllerDidCompleteAuthentication(self)
// }
//
// onboardingCoordinatorBridgePresenter.present(from: self, animated: true)
// self.onboardingCoordinatorBridgePresenter = onboardingCoordinatorBridgePresenter
// welcomeCoordinatorBridgePresenter.present(from: self, animated: true)
// self.welcomeCoordinatorBridgePresenter = welcomeCoordinatorBridgePresenter


let onboardingCoordinatorBridgePresenter = OnboardingCoordinatorBridgePresenter()
onboardingCoordinatorBridgePresenter.completion = { [weak self] in
guard let self = self else { return }

self.onboardingCoordinatorBridgePresenter?.dismiss(animated: true, completion: {
self.onboardingCoordinatorBridgePresenter = nil
})

self.isOnboardingInProgress = false // Must be set before calling didCompleteAuthentication
self.allChatsDelegate?.allChatsViewControllerDidCompleteAuthentication(self)
}

onboardingCoordinatorBridgePresenter.present(from: self, animated: true)
self.onboardingCoordinatorBridgePresenter = onboardingCoordinatorBridgePresenter
self.isOnboardingCoordinatorPreparing = false
}

Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Onboarding/OnboardingCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
case .register:
// Tchap: Bypass usecase selection screen
// showUseCaseSelectionScreen()
MXLog.failure("[OnboardingCoordinator] splashScreenCoordinator register case should not happen !")
beginAuthentication(with: .registration, onStart: coordinator.stop)

case .login:
if BuildSettings.onboardingEnableNewAuthenticationFlow {
Expand Down
21 changes: 12 additions & 9 deletions Riot/Modules/SplitView/SplitViewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ final class SplitViewCoordinator: NSObject, SplitViewCoordinatorType {
self.splitViewController.delegate = self

// Create primary controller
let masterCoordinator: SplitViewMasterCoordinatorProtocol = BuildSettings.newAppLayoutEnabled ? self.createAllChatsCoordinator() : self.createTabBarCoordinator()
// Tchap: force using AllChatsCoordinator because newLayout is always TRUE
// let masterCoordinator: SplitViewMasterCoordinatorProtocol = BuildSettings.newAppLayoutEnabled ? self.createAllChatsCoordinator() : self.createTabBarCoordinator()
let masterCoordinator: SplitViewMasterCoordinatorProtocol = self.createAllChatsCoordinator()
masterCoordinator.splitViewMasterPresentableDelegate = self
masterCoordinator.start(with: spaceId)

Expand Down Expand Up @@ -182,14 +184,15 @@ final class SplitViewCoordinator: NSObject, SplitViewCoordinatorType {
return coordinator
}

private func createTabBarCoordinator() -> TabBarCoordinator {

let coordinatorParameters = TabBarCoordinatorParameters(userSessionsService: self.parameters.userSessionsService, appNavigator: self.parameters.appNavigator)

let tabBarCoordinator = TabBarCoordinator(parameters: coordinatorParameters)
tabBarCoordinator.delegate = self
return tabBarCoordinator
}
// Tchap: don't use TabBarCoordinator anymore now that newLayout is always TRUE
// private func createTabBarCoordinator() -> TabBarCoordinator {
//
// let coordinatorParameters = TabBarCoordinatorParameters(userSessionsService: self.parameters.userSessionsService, appNavigator: self.parameters.appNavigator)
//
// let tabBarCoordinator = TabBarCoordinator(parameters: coordinatorParameters)
// tabBarCoordinator.delegate = self
// return tabBarCoordinator
// }

private func resetDetailNavigationControllerWithPlaceholder(animated: Bool) {
guard let detailNavigationRouter = self.detailNavigationRouter else {
Expand Down
32 changes: 17 additions & 15 deletions Riot/Modules/TabBar/TabBarCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -639,13 +639,14 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol {
}

private func showWelcome(animated: Bool = false) {
let welcomeCoordinator = WelcomeCoordinator()
welcomeCoordinator.delegate = self
welcomeCoordinator.start()
self.add(childCoordinator: welcomeCoordinator)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5 , execute: { [weak self] in
self?.navigationRouter.present(welcomeCoordinator, animated: animated)
})
// Tchap: remove calls to Welcome classes
// let welcomeCoordinator = WelcomeCoordinator()
// welcomeCoordinator.delegate = self
// welcomeCoordinator.start()
// self.add(childCoordinator: welcomeCoordinator)
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5 , execute: { [weak self] in
// self?.navigationRouter.present(welcomeCoordinator, animated: animated)
// })
}

private func userDidLogin() -> Bool {
Expand Down Expand Up @@ -1163,14 +1164,15 @@ extension TabBarCoordinator: SecureBackupSetupCoordinatorBridgePresenterDelegate
}

// MARK: - WelcomeCoordinatorDelegate
extension TabBarCoordinator: WelcomeCoordinatorDelegate {
func welcomeCoordinatorUserDidAuthenticate(_ coordinator: WelcomeCoordinatorType) {
// Check that the new account actually exists before removing the current coordinator
if userDidLogin() {
self.remove(childCoordinator: coordinator)
}
}
}
// Tchap: remove calls to Tchap Welcome classes
//extension TabBarCoordinator: WelcomeCoordinatorDelegate {
// func welcomeCoordinatorUserDidAuthenticate(_ coordinator: WelcomeCoordinatorType) {
// // Check that the new account actually exists before removing the current coordinator
// if userDidLogin() {
// self.remove(childCoordinator: coordinator)
// }
// }
//}

// MARK: - RoomsViewControllerDelegate
extension TabBarCoordinator: RoomsViewControllerDelegate {
Expand Down
Loading
Loading