diff --git a/Btchap/Config/BuildSettings.swift b/Btchap/Config/BuildSettings.swift index d873f79d1..0fffd896e 100644 --- a/Btchap/Config/BuildSettings.swift +++ b/Btchap/Config/BuildSettings.swift @@ -124,6 +124,7 @@ final class BuildSettings: NSObject { static let applicationServicesStatusUrlString = "https://status.tchap.numerique.gouv.fr/" static let applicationAcceptableUsePolicyUrlString = "" static let proConnectInfoUrlString = "https://proconnect.gouv.fr/" + static let proConnectAvailabilityFaqArticleUrlString = "https://aide.tchap.beta.gouv.fr/fr/article/se-connecter-a-tchap-avec-proconnect-1dh1peg" // MARK: - Matrix permalinks // Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app. @@ -244,7 +245,7 @@ final class BuildSettings: NSObject { ] // Tchap: handle SSO feature flag. Presents SSO button on Onboarding screen and give priority to SSO on UIA. - static let tchapFeatureHandleSSO = false + static let tchapFeatureHandleSSO = true // MARK: - Side Menu static let enableSideMenu: Bool = true && !newAppLayoutEnabled diff --git a/DevTchap/Config/BuildSettings.swift b/DevTchap/Config/BuildSettings.swift index 3b0e39924..5e5881deb 100644 --- a/DevTchap/Config/BuildSettings.swift +++ b/DevTchap/Config/BuildSettings.swift @@ -124,7 +124,8 @@ final class BuildSettings: NSObject { static let applicationServicesStatusUrlString = "https://status.tchap.numerique.gouv.fr/" static let applicationAcceptableUsePolicyUrlString = "" static let proConnectInfoUrlString = "https://proconnect.gouv.fr/" - + static let proConnectAvailabilityFaqArticleUrlString = "https://aide.tchap.beta.gouv.fr/fr/article/se-connecter-a-tchap-avec-proconnect-1dh1peg" + // MARK: - Matrix permalinks // Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app. static let permalinkSupportedHosts: [String: [String]] = [ diff --git a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings index 6b9f02806..8ac288a11 100644 --- a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings +++ b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings @@ -42,6 +42,8 @@ "authentication_error_limit_exceeded" = "Vos trois dernières tentatives de connexion ont échoué. Veuillez réessayer dans 30 minutes"; "authentication_choose_password_signout_all_devices" = "Déconnecter mes appareils et verrouiller mes messages (en cas de piratage de votre compte ou de la perte d'un appareil)"; +"authentication_sso_warning" = "→ Est-ce que ProConnect est activé pour mon administration ?"; + //////////////////////////////////////////////////////////////////////////////// // MARK: Forgot password "forgot_password_title" = "Connexion Tchap"; diff --git a/Tchap/Config/BuildSettings.swift b/Tchap/Config/BuildSettings.swift index cba961d82..6f946c1dc 100644 --- a/Tchap/Config/BuildSettings.swift +++ b/Tchap/Config/BuildSettings.swift @@ -138,7 +138,8 @@ final class BuildSettings: NSObject { static let applicationServicesStatusUrlString = "https://status.tchap.numerique.gouv.fr/" static let applicationAcceptableUsePolicyUrlString = "" static let proConnectInfoUrlString = "https://proconnect.gouv.fr/" - + static let proConnectAvailabilityFaqArticleUrlString = "https://aide.tchap.beta.gouv.fr/fr/article/se-connecter-a-tchap-avec-proconnect-1dh1peg" + // MARK: - Matrix permalinks // Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app. static let permalinkSupportedHosts: [String: [String]] = [ diff --git a/Tchap/Extensions/WebLinks+Tchap.swift b/Tchap/Extensions/WebLinks+Tchap.swift index 38bc858ac..ce7cb4602 100644 --- a/Tchap/Extensions/WebLinks+Tchap.swift +++ b/Tchap/Extensions/WebLinks+Tchap.swift @@ -20,10 +20,6 @@ import Foundation // becasue UIApplication.shared is not available for extension. @available(iOSApplicationExtension, unavailable) struct TchapWebLinks { - static func openProConnectInfo() { - self.openWebsite(urlString: BuildSettings.proConnectInfoUrlString) - } - static private func openWebsite(urlString: String) { guard let websiteUrl = URL(string: urlString) else { return diff --git a/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift b/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift index e45c9347f..20f37d047 100644 --- a/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift +++ b/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift @@ -26,7 +26,9 @@ struct TchapAuthenticationLoginScreen: View { /// A boolean that can be toggled to give focus to the password text field. /// This must be manually set back to `false` when the text field finishes editing. @State private var isPasswordFocused = false - + @State private var presentProConnectInfo = false + @State private var presentProConnectAvailabilityFaqArticle = false + // MARK: Public @ObservedObject var viewModel: AuthenticationLoginViewModel.Context @@ -50,6 +52,12 @@ struct TchapAuthenticationLoginScreen: View { .background(theme.colors.background.ignoresSafeArea()) .alert(item: $viewModel.alertInfo) { $0.alert } .accentColor(theme.colors.accent) + .sheet(isPresented: $presentProConnectAvailabilityFaqArticle) { + WebSheetView(targetUrl: URL(string: BuildSettings.proConnectAvailabilityFaqArticleUrlString)!) + } + .sheet(isPresented: $presentProConnectInfo) { + WebSheetView(targetUrl: URL(string: BuildSettings.proConnectInfoUrlString)!) + } } /// The header containing a Welcome Back title. @@ -91,6 +99,8 @@ struct TchapAuthenticationLoginScreen: View { passwordLoginSection } else if case .sso = viewModel.viewState.tchapAuthenticationMode { ssoLoginSection + Spacer(minLength: 32.0) + ssoInformation } } } @@ -148,6 +158,13 @@ struct TchapAuthenticationLoginScreen: View { } } + var ssoInformation: some View { + Button(action: { openProConnectAvailabilityFaqArticle() }, label: { + Text(TchapL10n.authenticationSsoWarning) + }) + .padding(.horizontal, 16.0) + } + /// Parses the username for a homeserver. func usernameEditingChanged(isEditing: Bool) { guard !isEditing, !viewModel.username.isEmpty else { return } @@ -231,7 +248,11 @@ struct TchapAuthenticationLoginScreen: View { } func openProConnectWebsite() { - TchapWebLinks.openProConnectInfo() + presentProConnectInfo = true + } + + func openProConnectAvailabilityFaqArticle() { + presentProConnectAvailabilityFaqArticle = true } } diff --git a/Tchap/Modules/Onboarding/SplashScreen/View/TchapOnboardingSplashScreen.swift b/Tchap/Modules/Onboarding/SplashScreen/View/TchapOnboardingSplashScreen.swift index f936b0567..9778ece9a 100644 --- a/Tchap/Modules/Onboarding/SplashScreen/View/TchapOnboardingSplashScreen.swift +++ b/Tchap/Modules/Onboarding/SplashScreen/View/TchapOnboardingSplashScreen.swift @@ -30,6 +30,7 @@ struct TchapOnboardingSplashScreen: View { @ObservedObject var viewModel: OnboardingSplashScreenViewModel.Context @State var appTheme = ThemeService.shared() + @State var presentProConnectInfo = false var body: some View { GeometryReader { geometry in @@ -59,6 +60,10 @@ struct TchapOnboardingSplashScreen: View { .accentColor(theme.colors.accent) .navigationBarHidden(true) .track(screen: .welcome) + .sheet(isPresented: $presentProConnectInfo) { + WebSheetView(targetUrl: URL(string: BuildSettings.proConnectInfoUrlString)!) + } + } var header: some View { @@ -166,7 +171,7 @@ struct TchapOnboardingSplashScreen: View { } func openProConnectWebsite() { - TchapWebLinks.openProConnectInfo() + presentProConnectInfo = true } } diff --git a/Tchap/Modules/WebSheet/WebSheetViewController.swift b/Tchap/Modules/WebSheet/WebSheetViewController.swift index 347b522c1..857186fd5 100644 --- a/Tchap/Modules/WebSheet/WebSheetViewController.swift +++ b/Tchap/Modules/WebSheet/WebSheetViewController.swift @@ -195,3 +195,20 @@ extension WebSheetViewController: WKNavigationDelegate { // Called when the web view’s web content process is terminated. } } + +import SwiftUI + +struct WebSheetView: UIViewControllerRepresentable { + typealias UIViewControllerType = WebSheetViewController + let targetUrl: URL + + func makeUIViewController(context: Context) -> WebSheetViewController { + let vc = WebSheetViewController(targetUrl: targetUrl) + // Do some configurations here if needed. + return vc + } + + func updateUIViewController(_ uiViewController: WebSheetViewController, context: Context) { + // Updates the state of the specified view controller with new information from SwiftUI. + } +} diff --git a/changelog.d/1100.change b/changelog.d/1100.change new file mode 100644 index 000000000..46c61dc93 --- /dev/null +++ b/changelog.d/1100.change @@ -0,0 +1 @@ +ProConnect - Message d'avertissement et lien vers la FAQ à propos de la disponibilité du service ProConnect sur tous les HomeServers \ No newline at end of file