From 40fb2291baac2c969ce8336919c8ffcf926cfa76 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Thu, 14 Nov 2024 17:26:31 +0100 Subject: [PATCH 1/3] =?UTF-8?q?ProConnect=20-=20Message=20d'avertissement?= =?UTF-8?q?=20pr=C3=A9cisant=20que=20ProConnect=20n'est=20pas=20disponible?= =?UTF-8?q?=20sur=20toutes=20les=20instances=20actuellement.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tchap/Assets/Localizations/fr.lproj/Tchap.strings | 2 ++ .../Login/View/TchapAuthenticationLoginScreen.swift | 9 +++++++++ changelog.d/1100.change | 1 + 3 files changed, 12 insertions(+) create mode 100644 changelog.d/1100.change diff --git a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings index 6b9f02806..d855601ae 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" = "**Attention** : la connexion à Tchap avec **ProConnect** n'est actuellement disponible que sur les instances suivantes :\n     - DINUM\n     - Agents\n     - Éducation"; // Markdown string for SwiftUI Text() + //////////////////////////////////////////////////////////////////////////////// // MARK: Forgot password "forgot_password_title" = "Connexion Tchap"; diff --git a/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift b/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift index e45c9347f..50d90eb9d 100644 --- a/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift +++ b/Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift @@ -91,6 +91,8 @@ struct TchapAuthenticationLoginScreen: View { passwordLoginSection } else if case .sso = viewModel.viewState.tchapAuthenticationMode { ssoLoginSection + Spacer(minLength: 32.0) + ssoInformation } } } @@ -148,6 +150,13 @@ struct TchapAuthenticationLoginScreen: View { } } + var ssoInformation: some View { + Text(LocalizedStringKey(TchapL10n.authenticationSsoWarning)) + .padding(.horizontal, 16.0) + .font(.footnote) + .foregroundColor(Color(UIColor(rgb: 0x000091))) + } + /// Parses the username for a homeserver. func usernameEditingChanged(isEditing: Bool) { guard !isEditing, !viewModel.username.isEmpty else { return } diff --git a/changelog.d/1100.change b/changelog.d/1100.change new file mode 100644 index 000000000..88fa938e6 --- /dev/null +++ b/changelog.d/1100.change @@ -0,0 +1 @@ +ProConnect - Message d'avertissement précisant que ProConnect n'est pas disponible sur toutes les instances actuellement. \ No newline at end of file From 7e609c66ac19180f0c7e12f1c0c33323198ef513 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 8 Jan 2025 15:55:39 +0100 Subject: [PATCH 2/3] Link to ProConnect availabiity faq article on home screen and ProConnect screen --- Btchap/Config/BuildSettings.swift | 3 ++- DevTchap/Config/BuildSettings.swift | 3 ++- .../Localizations/fr.lproj/Tchap.strings | 2 +- Tchap/Config/BuildSettings.swift | 3 ++- Tchap/Extensions/WebLinks+Tchap.swift | 4 ---- .../View/TchapAuthenticationLoginScreen.swift | 22 ++++++++++++++----- .../View/TchapOnboardingSplashScreen.swift | 7 +++++- .../WebSheet/WebSheetViewController.swift | 17 ++++++++++++++ 8 files changed, 47 insertions(+), 14 deletions(-) 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 d855601ae..8ac288a11 100644 --- a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings +++ b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings @@ -42,7 +42,7 @@ "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" = "**Attention** : la connexion à Tchap avec **ProConnect** n'est actuellement disponible que sur les instances suivantes :\n     - DINUM\n     - Agents\n     - Éducation"; // Markdown string for SwiftUI Text() +"authentication_sso_warning" = "→ Est-ce que ProConnect est activé pour mon administration ?"; //////////////////////////////////////////////////////////////////////////////// // MARK: Forgot password 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 50d90eb9d..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. @@ -151,10 +159,10 @@ struct TchapAuthenticationLoginScreen: View { } var ssoInformation: some View { - Text(LocalizedStringKey(TchapL10n.authenticationSsoWarning)) + Button(action: { openProConnectAvailabilityFaqArticle() }, label: { + Text(TchapL10n.authenticationSsoWarning) + }) .padding(.horizontal, 16.0) - .font(.footnote) - .foregroundColor(Color(UIColor(rgb: 0x000091))) } /// Parses the username for a homeserver. @@ -240,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. + } +} From 566beadc23318d5a723be4e8350d006ba801608b Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 8 Jan 2025 16:01:09 +0100 Subject: [PATCH 3/3] Update changelog --- changelog.d/1100.change | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/1100.change b/changelog.d/1100.change index 88fa938e6..46c61dc93 100644 --- a/changelog.d/1100.change +++ b/changelog.d/1100.change @@ -1 +1 @@ -ProConnect - Message d'avertissement précisant que ProConnect n'est pas disponible sur toutes les instances actuellement. \ No newline at end of file +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