From d52b9e1b768397e2d13a32f689e8da74914d9b56 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 20 Aug 2024 11:00:51 +0200 Subject: [PATCH 01/21] =?UTF-8?q?Ajout=20de=20l'application=20scheme=20=20?= =?UTF-8?q?pour=20retour=20dans=20l'app=20apr=C3=A8s=20SSO=20sur=20AgentCo?= =?UTF-8?q?nnect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Btchap/SupportingFiles/Btchap-App-Common.xcconfig | 1 + DevTchap/SupportingFiles/DevTchap-App-Common.xcconfig | 1 + Tchap/SupportingFiles/App-Common.xcconfig | 1 + 3 files changed, 3 insertions(+) diff --git a/Btchap/SupportingFiles/Btchap-App-Common.xcconfig b/Btchap/SupportingFiles/Btchap-App-Common.xcconfig index 36a5963707..0c9357856d 100644 --- a/Btchap/SupportingFiles/Btchap-App-Common.xcconfig +++ b/Btchap/SupportingFiles/Btchap-App-Common.xcconfig @@ -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 diff --git a/DevTchap/SupportingFiles/DevTchap-App-Common.xcconfig b/DevTchap/SupportingFiles/DevTchap-App-Common.xcconfig index 5fe20ec985..ae7b765ca3 100644 --- a/DevTchap/SupportingFiles/DevTchap-App-Common.xcconfig +++ b/DevTchap/SupportingFiles/DevTchap-App-Common.xcconfig @@ -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 diff --git a/Tchap/SupportingFiles/App-Common.xcconfig b/Tchap/SupportingFiles/App-Common.xcconfig index 61a5d51db5..a31699bd97 100644 --- a/Tchap/SupportingFiles/App-Common.xcconfig +++ b/Tchap/SupportingFiles/App-Common.xcconfig @@ -24,6 +24,7 @@ BUNDLE_DISPLAY_NAME = Tchap BASE_BUNDLE_IDENTIFIER = fr.gouv.tchap APPLICATION_GROUP_IDENTIFIER = group.$(BASE_BUNDLE_IDENTIFIER) PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_IDENTIFIER) +APPLICATION_SCHEME = tchap INFOPLIST_FILE = Tchap/SupportingFiles/Info.plist ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon From 43573288233f494ba5b082ec61b6ac86c014eee4 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 20 Aug 2024 11:01:45 +0200 Subject: [PATCH 02/21] =?UTF-8?q?R=C3=A9activation=20de=20l'Onboarding=20o?= =?UTF-8?q?riginal=20Element=20(qui=20supporte=20le=20SSO)=20plut=C3=B4t?= =?UTF-8?q?=20que=20l'onboarding=20custom=20Tchap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AllChats/AllChatsViewController.swift | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index 0efb816e23..688047ed4d 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -1117,36 +1117,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 } From f572f1f6a7576317dce95acebd4afc6b306b5215 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 20 Aug 2024 11:02:39 +0200 Subject: [PATCH 03/21] Ajout de l'URL scheme dans les fichiers plist --- Btchap/SupportingFiles/Info.plist | 13 +++++++++++++ DevTchap/SupportingFiles/Info.plist | 13 +++++++++++++ Tchap/SupportingFiles/Info.plist | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/Btchap/SupportingFiles/Info.plist b/Btchap/SupportingFiles/Info.plist index 5e06e305b9..262b052c3d 100644 --- a/Btchap/SupportingFiles/Info.plist +++ b/Btchap/SupportingFiles/Info.plist @@ -35,6 +35,19 @@ $(MARKETING_VERSION) CFBundleSignature ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + $(BASE_BUNDLE_IDENTIFIER) + CFBundleURLSchemes + + $(APPLICATION_SCHEME) + + + CFBundleVersion $(CURRENT_PROJECT_VERSION) ITSAppUsesNonExemptEncryption diff --git a/DevTchap/SupportingFiles/Info.plist b/DevTchap/SupportingFiles/Info.plist index 4303301c18..533722fc3c 100644 --- a/DevTchap/SupportingFiles/Info.plist +++ b/DevTchap/SupportingFiles/Info.plist @@ -35,6 +35,19 @@ $(MARKETING_VERSION) CFBundleSignature ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + $(BASE_BUNDLE_IDENTIFIER) + CFBundleURLSchemes + + $(APPLICATION_SCHEME) + + + CFBundleVersion $(CURRENT_PROJECT_VERSION) ITSAppUsesNonExemptEncryption diff --git a/Tchap/SupportingFiles/Info.plist b/Tchap/SupportingFiles/Info.plist index 666cd98359..1ef2ea6ab4 100644 --- a/Tchap/SupportingFiles/Info.plist +++ b/Tchap/SupportingFiles/Info.plist @@ -35,6 +35,19 @@ $(MARKETING_VERSION) CFBundleSignature ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + $(BASE_BUNDLE_IDENTIFIER) + CFBundleURLSchemes + + $(APPLICATION_SCHEME) + + + CFBundleVersion $(CURRENT_PROJECT_VERSION) ITSAppUsesNonExemptEncryption From 6467bd45eeec9b0e1e6bcb429e3d2e5e5dbc2e8f Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 20 Aug 2024 11:06:14 +0200 Subject: [PATCH 04/21] Skip Onboarding useCase selection --- Riot/Modules/Onboarding/OnboardingCoordinator.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Onboarding/OnboardingCoordinator.swift b/Riot/Modules/Onboarding/OnboardingCoordinator.swift index bce47443bb..3fb1d711a6 100644 --- a/Riot/Modules/Onboarding/OnboardingCoordinator.swift +++ b/Riot/Modules/Onboarding/OnboardingCoordinator.swift @@ -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 { From d512392646c65cc66d363b298d1f8a07842670c3 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 15:46:22 +0200 Subject: [PATCH 05/21] Reinclude Element Legacy code (for LegacyAuthentication for example) --- Tchap/target.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Tchap/target.yml b/Tchap/target.yml index 63080dfe35..6d44c6dd0b 100644 --- a/Tchap/target.yml +++ b/Tchap/target.yml @@ -177,8 +177,6 @@ targetTemplates: - path: ../Riot/Modules/Analytics - path: ../Riot/Modules/Application - path: ../Riot/Modules/Authentication - excludes: - - "Legacy" - path: ../Riot/Modules/BadgeLabel - path: ../Riot/Modules/BugReport/BugReportViewController.h - path: ../Riot/Modules/BugReport/BugReportViewController.m From 16547cc7614e66da14989dd0d6409fc3c2064c2d Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 15:47:20 +0200 Subject: [PATCH 06/21] Reimport "AuthenticationViewController.h" for LegacyAuthenticationCoordinator to know AuthenticationViewController class --- Riot/Modules/TabBar/MasterTabBarController.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index 51284144df..7b9a51a590 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -15,7 +15,7 @@ limitations under the License. */ -//#import "AuthenticationViewController.h" +#import "AuthenticationViewController.h" #import "RoomPreviewData.h" #import "FavouritesViewController.h" From 7276e74e66d4ec307d93eee05cef7dcfe840fa2f Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 15:48:19 +0200 Subject: [PATCH 07/21] Disable default home and identity server temporarily because they are not defined in Tchap --- .../Authentication/Legacy/AuthenticationViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m b/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m index c0605d8131..687a534e27 100644 --- a/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m +++ b/Riot/Modules/Authentication/Legacy/AuthenticationViewController.m @@ -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; From ad5724f8f70f79e4e47626d86af76072a43723f6 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 15:48:56 +0200 Subject: [PATCH 08/21] Temporarily disable custom servers for SSO tests --- .../Legacy/LegacyAuthenticationCoordinator.swift | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift b/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift index 4aea0b8b92..f77fd61095 100644 --- a/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift +++ b/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift @@ -72,13 +72,14 @@ final class LegacyAuthenticationCoordinator: NSObject, AuthenticationCoordinator // Set (or clear) any soft-logout credentials. authenticationViewController.softLogoutCredentials = authenticationService.softLogoutCredentials - // Configure custom servers if already customised by a deep link. - let homeserver = authenticationService.state.homeserver.address - let identityServer = authenticationService.state.identityServer - if homeserver != BuildSettings.serverConfigDefaultHomeserverUrlString - || (identityServer != nil && identityServer != BuildSettings.serverConfigDefaultIdentityServerUrlString) { - authenticationViewController.showCustomHomeserver(homeserver, andIdentityServer: identityServer) - } + // Tchap: Don't show custom servers during SSO tests. +// // Configure custom servers if already customised by a deep link. +// let homeserver = authenticationService.state.homeserver.address +// let identityServer = authenticationService.state.identityServer +// if homeserver != BuildSettings.serverConfigDefaultHomeserverUrlString +// || (identityServer != nil && identityServer != BuildSettings.serverConfigDefaultIdentityServerUrlString) { +// authenticationViewController.showCustomHomeserver(homeserver, andIdentityServer: identityServer) +// } // Listen for further changes from deep links. AuthenticationService.shared.delegate = self From 2c6f0b04e6a1fa4c37e06f02af79e5aa02c27f3a Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 15:50:20 +0200 Subject: [PATCH 09/21] Restore deep link Connect to Element way (not Tchap way) --- Riot/Modules/Application/AppCoordinator.swift | 4 ++- Riot/Modules/Application/LegacyAppDelegate.h | 2 +- Riot/Modules/Application/LegacyAppDelegate.m | 29 +++++++++---------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Riot/Modules/Application/AppCoordinator.swift b/Riot/Modules/Application/AppCoordinator.swift index e55874016c..577d62cced 100755 --- a/Riot/Modules/Application/AppCoordinator.swift +++ b/Riot/Modules/Application/AppCoordinator.swift @@ -281,7 +281,9 @@ final class AppCoordinator: NSObject, AppCoordinatorType { switch deepLinkOption { case .connect(let loginToken, let transactionID): - canOpenLink = self.legacyAppDelegate.continueSSOLogin(withToken: loginToken, txnId: transactionID) + // Tchap: return to Element way of handling deep link SSO connect +// canOpenLink = self.legacyAppDelegate.continueSSOLogin(withToken: loginToken, txnId: transactionID) + canOpenLink = AuthenticationService.shared.continueSSOLogin(with: loginToken, and: transactionID) } return canOpenLink diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index 2421e029b4..b1aa19ff32 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -294,7 +294,7 @@ UINavigationControllerDelegate /// @param loginToken The login token provided when SSO succeeded. /// @param txnId transaction id generated during SSO page presentation. /// returns YES if the SSO login can be continued. -- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId; +//- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId; @end diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index ae34bcb445..7838c9ca6b 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -4543,21 +4543,20 @@ - (void)callPresenter:(CallPresenter *)presenter exitPipForCallViewController:(U [self presentViewController:viewController animated:YES completion:completion]; } -#pragma mark - Authentication - -- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId -{ - OnboardingCoordinatorBridgePresenter *bridgePresenter = self.masterTabBarController.onboardingCoordinatorBridgePresenter; - - if (!bridgePresenter) - { - MXLogDebug(@"[AppDelegate] Fail to continue SSO login"); - return NO; - } - - // Tchap: - return NO;//[bridgePresenter continueSSOLoginWithToken:loginToken transactionID:txnId]; -} +//#pragma mark - Authentication +// +//- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId +//{ +// OnboardingCoordinatorBridgePresenter *bridgePresenter = self.masterTabBarController.onboardingCoordinatorBridgePresenter; +// +// if (!bridgePresenter) +// { +// MXLogDebug(@"[AppDelegate] Fail to continue SSO login"); +// return NO; +// } +// +// [bridgePresenter continueSSOLoginWithToken:loginToken transactionID:txnId]; +//} #pragma mark - Private From 53b993dfde538164337ab5918a0120a34be38dc9 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 16:47:10 +0200 Subject: [PATCH 10/21] Revert "Restore deep link Connect to Element way (not Tchap way)" This reverts commit 2c6f0b04e6a1fa4c37e06f02af79e5aa02c27f3a. --- Riot/Modules/Application/AppCoordinator.swift | 4 +-- Riot/Modules/Application/LegacyAppDelegate.h | 2 +- Riot/Modules/Application/LegacyAppDelegate.m | 29 ++++++++++--------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Riot/Modules/Application/AppCoordinator.swift b/Riot/Modules/Application/AppCoordinator.swift index 577d62cced..e55874016c 100755 --- a/Riot/Modules/Application/AppCoordinator.swift +++ b/Riot/Modules/Application/AppCoordinator.swift @@ -281,9 +281,7 @@ final class AppCoordinator: NSObject, AppCoordinatorType { switch deepLinkOption { case .connect(let loginToken, let transactionID): - // Tchap: return to Element way of handling deep link SSO connect -// canOpenLink = self.legacyAppDelegate.continueSSOLogin(withToken: loginToken, txnId: transactionID) - canOpenLink = AuthenticationService.shared.continueSSOLogin(with: loginToken, and: transactionID) + canOpenLink = self.legacyAppDelegate.continueSSOLogin(withToken: loginToken, txnId: transactionID) } return canOpenLink diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index b1aa19ff32..2421e029b4 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -294,7 +294,7 @@ UINavigationControllerDelegate /// @param loginToken The login token provided when SSO succeeded. /// @param txnId transaction id generated during SSO page presentation. /// returns YES if the SSO login can be continued. -//- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId; +- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId; @end diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 7838c9ca6b..ae34bcb445 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -4543,20 +4543,21 @@ - (void)callPresenter:(CallPresenter *)presenter exitPipForCallViewController:(U [self presentViewController:viewController animated:YES completion:completion]; } -//#pragma mark - Authentication -// -//- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId -//{ -// OnboardingCoordinatorBridgePresenter *bridgePresenter = self.masterTabBarController.onboardingCoordinatorBridgePresenter; -// -// if (!bridgePresenter) -// { -// MXLogDebug(@"[AppDelegate] Fail to continue SSO login"); -// return NO; -// } -// -// [bridgePresenter continueSSOLoginWithToken:loginToken transactionID:txnId]; -//} +#pragma mark - Authentication + +- (BOOL)continueSSOLoginWithToken:(NSString*)loginToken txnId:(NSString*)txnId +{ + OnboardingCoordinatorBridgePresenter *bridgePresenter = self.masterTabBarController.onboardingCoordinatorBridgePresenter; + + if (!bridgePresenter) + { + MXLogDebug(@"[AppDelegate] Fail to continue SSO login"); + return NO; + } + + // Tchap: + return NO;//[bridgePresenter continueSSOLoginWithToken:loginToken transactionID:txnId]; +} #pragma mark - Private From 03e1be124572604d405deda4e6a173d0e571fc51 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 16:47:24 +0200 Subject: [PATCH 11/21] Revert "Reimport "AuthenticationViewController.h" for LegacyAuthenticationCoordinator to know AuthenticationViewController class" This reverts commit 16547cc7614e66da14989dd0d6409fc3c2064c2d. --- Riot/Modules/TabBar/MasterTabBarController.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index 7b9a51a590..51284144df 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -15,7 +15,7 @@ limitations under the License. */ -#import "AuthenticationViewController.h" +//#import "AuthenticationViewController.h" #import "RoomPreviewData.h" #import "FavouritesViewController.h" From 75cb7be6fd4819fb9524504e3c54fa149a10485f Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 16:47:30 +0200 Subject: [PATCH 12/21] Revert "Reinclude Element Legacy code (for LegacyAuthentication for example)" This reverts commit d512392646c65cc66d363b298d1f8a07842670c3. --- Tchap/target.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tchap/target.yml b/Tchap/target.yml index 6d44c6dd0b..63080dfe35 100644 --- a/Tchap/target.yml +++ b/Tchap/target.yml @@ -177,6 +177,8 @@ targetTemplates: - path: ../Riot/Modules/Analytics - path: ../Riot/Modules/Application - path: ../Riot/Modules/Authentication + excludes: + - "Legacy" - path: ../Riot/Modules/BadgeLabel - path: ../Riot/Modules/BugReport/BugReportViewController.h - path: ../Riot/Modules/BugReport/BugReportViewController.m From f3c9e4f01115649a0e2db63de9061dfc73010a3d Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 21 Aug 2024 16:54:21 +0200 Subject: [PATCH 13/21] Revert "Temporarily disable custom servers for SSO tests" This reverts commit ad5724f8f70f79e4e47626d86af76072a43723f6. --- .../Legacy/LegacyAuthenticationCoordinator.swift | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift b/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift index f77fd61095..4aea0b8b92 100644 --- a/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift +++ b/Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift @@ -72,14 +72,13 @@ final class LegacyAuthenticationCoordinator: NSObject, AuthenticationCoordinator // Set (or clear) any soft-logout credentials. authenticationViewController.softLogoutCredentials = authenticationService.softLogoutCredentials - // Tchap: Don't show custom servers during SSO tests. -// // Configure custom servers if already customised by a deep link. -// let homeserver = authenticationService.state.homeserver.address -// let identityServer = authenticationService.state.identityServer -// if homeserver != BuildSettings.serverConfigDefaultHomeserverUrlString -// || (identityServer != nil && identityServer != BuildSettings.serverConfigDefaultIdentityServerUrlString) { -// authenticationViewController.showCustomHomeserver(homeserver, andIdentityServer: identityServer) -// } + // Configure custom servers if already customised by a deep link. + let homeserver = authenticationService.state.homeserver.address + let identityServer = authenticationService.state.identityServer + if homeserver != BuildSettings.serverConfigDefaultHomeserverUrlString + || (identityServer != nil && identityServer != BuildSettings.serverConfigDefaultIdentityServerUrlString) { + authenticationViewController.showCustomHomeserver(homeserver, andIdentityServer: identityServer) + } // Listen for further changes from deep links. AuthenticationService.shared.delegate = self From a3bbf202a283c81b2bae1d2cfc3c4335238ae806 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 3 Sep 2024 13:39:20 +0200 Subject: [PATCH 14/21] Call Element onboarding flow rather than Tchap which doesn't support SSO --- .../AuthenticationCoordinator.swift | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Riot/Modules/Authentication/AuthenticationCoordinator.swift b/Riot/Modules/Authentication/AuthenticationCoordinator.swift index 295a591f73..b47c20b3bc 100644 --- a/Riot/Modules/Authentication/AuthenticationCoordinator.swift +++ b/Riot/Modules/Authentication/AuthenticationCoordinator.swift @@ -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 { @@ -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) { From c26dfaf3917f79bba0b87fb181cb238a04325158 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Tue, 3 Sep 2024 13:39:59 +0200 Subject: [PATCH 15/21] Customize Element onboarding splash screen to mimic Tchap --- .../View/OnboardingSplashScreen.swift | 287 ++++++++++-------- 1 file changed, 167 insertions(+), 120 deletions(-) diff --git a/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift b/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift index b342398826..7bb7b80987 100644 --- a/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift +++ b/RiotSwiftUI/Modules/Onboarding/SplashScreen/View/OnboardingSplashScreen.swift @@ -25,13 +25,14 @@ struct OnboardingSplashScreen: View { @Environment(\.theme) private var theme @Environment(\.layoutDirection) private var layoutDirection - private var isLeftToRight: Bool { layoutDirection == .leftToRight } - private var pageCount: Int { viewModel.viewState.content.count } - - /// A timer to automatically animate the pages. - @State private var pageTimer: Timer? - /// The amount of offset to apply when a drag gesture is in progress. - @State private var dragOffset: CGFloat = .zero + // Tchap: remove carousel +// private var isLeftToRight: Bool { layoutDirection == .leftToRight } +// private var pageCount: Int { viewModel.viewState.content.count } +// +// /// A timer to automatically animate the pages. +// @State private var pageTimer: Timer? +// /// The amount of offset to apply when a drag gesture is in progress. +// @State private var dragOffset: CGFloat = .zero // MARK: Public @@ -43,28 +44,41 @@ struct OnboardingSplashScreen: View { Spacer() .frame(height: OnboardingMetrics.spacerHeight(in: geometry)) - // The main content of the carousel - HStack(alignment: .top, spacing: 0) { - // Add a hidden page at the start of the carousel duplicating the content of the last page - OnboardingSplashScreenPage(content: viewModel.viewState.content[pageCount - 1]) - .frame(width: geometry.size.width) - - ForEach(0..