Skip to content

Commit 4ee36a4

Browse files
Merge pull request #1123 from tchapgouv/1100-pc-login-alors-que-le-serveur-synapse-nest-pas-configure-proconnect-1115
ProConnect - Message d'avertissement précisant que ProConnect n'est p…
2 parents cb0fa40 + 566bead commit 4ee36a4

File tree

9 files changed

+54
-9
lines changed

9 files changed

+54
-9
lines changed

Btchap/Config/BuildSettings.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ final class BuildSettings: NSObject {
124124
static let applicationServicesStatusUrlString = "https://status.tchap.numerique.gouv.fr/"
125125
static let applicationAcceptableUsePolicyUrlString = ""
126126
static let proConnectInfoUrlString = "https://proconnect.gouv.fr/"
127+
static let proConnectAvailabilityFaqArticleUrlString = "https://aide.tchap.beta.gouv.fr/fr/article/se-connecter-a-tchap-avec-proconnect-1dh1peg"
127128

128129
// MARK: - Matrix permalinks
129130
// Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app.

DevTchap/Config/BuildSettings.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ final class BuildSettings: NSObject {
124124
static let applicationServicesStatusUrlString = "https://status.tchap.numerique.gouv.fr/"
125125
static let applicationAcceptableUsePolicyUrlString = ""
126126
static let proConnectInfoUrlString = "https://proconnect.gouv.fr/"
127-
127+
static let proConnectAvailabilityFaqArticleUrlString = "https://aide.tchap.beta.gouv.fr/fr/article/se-connecter-a-tchap-avec-proconnect-1dh1peg"
128+
128129
// MARK: - Matrix permalinks
129130
// Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app.
130131
static let permalinkSupportedHosts: [String: [String]] = [

Tchap/Assets/Localizations/fr.lproj/Tchap.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"authentication_error_limit_exceeded" = "Vos trois dernières tentatives de connexion ont échoué. Veuillez réessayer dans 30 minutes";
4343
"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)";
4444

45+
"authentication_sso_warning" = "→ Est-ce que ProConnect est activé pour mon administration ?";
46+
4547
////////////////////////////////////////////////////////////////////////////////
4648
// MARK: Forgot password
4749
"forgot_password_title" = "Connexion Tchap";

Tchap/Config/BuildSettings.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ final class BuildSettings: NSObject {
138138
static let applicationServicesStatusUrlString = "https://status.tchap.numerique.gouv.fr/"
139139
static let applicationAcceptableUsePolicyUrlString = ""
140140
static let proConnectInfoUrlString = "https://proconnect.gouv.fr/"
141-
141+
static let proConnectAvailabilityFaqArticleUrlString = "https://aide.tchap.beta.gouv.fr/fr/article/se-connecter-a-tchap-avec-proconnect-1dh1peg"
142+
142143
// MARK: - Matrix permalinks
143144
// Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app.
144145
static let permalinkSupportedHosts: [String: [String]] = [

Tchap/Extensions/WebLinks+Tchap.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ import Foundation
2020
// becasue UIApplication.shared is not available for extension.
2121
@available(iOSApplicationExtension, unavailable)
2222
struct TchapWebLinks {
23-
static func openProConnectInfo() {
24-
self.openWebsite(urlString: BuildSettings.proConnectInfoUrlString)
25-
}
26-
2723
static private func openWebsite(urlString: String) {
2824
guard let websiteUrl = URL(string: urlString) else {
2925
return

Tchap/Modules/Authentication/Login/View/TchapAuthenticationLoginScreen.swift

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ struct TchapAuthenticationLoginScreen: View {
2626
/// A boolean that can be toggled to give focus to the password text field.
2727
/// This must be manually set back to `false` when the text field finishes editing.
2828
@State private var isPasswordFocused = false
29-
29+
@State private var presentProConnectInfo = false
30+
@State private var presentProConnectAvailabilityFaqArticle = false
31+
3032
// MARK: Public
3133

3234
@ObservedObject var viewModel: AuthenticationLoginViewModel.Context
@@ -50,6 +52,12 @@ struct TchapAuthenticationLoginScreen: View {
5052
.background(theme.colors.background.ignoresSafeArea())
5153
.alert(item: $viewModel.alertInfo) { $0.alert }
5254
.accentColor(theme.colors.accent)
55+
.sheet(isPresented: $presentProConnectAvailabilityFaqArticle) {
56+
WebSheetView(targetUrl: URL(string: BuildSettings.proConnectAvailabilityFaqArticleUrlString)!)
57+
}
58+
.sheet(isPresented: $presentProConnectInfo) {
59+
WebSheetView(targetUrl: URL(string: BuildSettings.proConnectInfoUrlString)!)
60+
}
5361
}
5462

5563
/// The header containing a Welcome Back title.
@@ -91,6 +99,8 @@ struct TchapAuthenticationLoginScreen: View {
9199
passwordLoginSection
92100
} else if case .sso = viewModel.viewState.tchapAuthenticationMode {
93101
ssoLoginSection
102+
Spacer(minLength: 32.0)
103+
ssoInformation
94104
}
95105
}
96106
}
@@ -148,6 +158,13 @@ struct TchapAuthenticationLoginScreen: View {
148158
}
149159
}
150160

161+
var ssoInformation: some View {
162+
Button(action: { openProConnectAvailabilityFaqArticle() }, label: {
163+
Text(TchapL10n.authenticationSsoWarning)
164+
})
165+
.padding(.horizontal, 16.0)
166+
}
167+
151168
/// Parses the username for a homeserver.
152169
func usernameEditingChanged(isEditing: Bool) {
153170
guard !isEditing, !viewModel.username.isEmpty else { return }
@@ -231,7 +248,11 @@ struct TchapAuthenticationLoginScreen: View {
231248
}
232249

233250
func openProConnectWebsite() {
234-
TchapWebLinks.openProConnectInfo()
251+
presentProConnectInfo = true
252+
}
253+
254+
func openProConnectAvailabilityFaqArticle() {
255+
presentProConnectAvailabilityFaqArticle = true
235256
}
236257
}
237258

Tchap/Modules/Onboarding/SplashScreen/View/TchapOnboardingSplashScreen.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct TchapOnboardingSplashScreen: View {
3030
@ObservedObject var viewModel: OnboardingSplashScreenViewModel.Context
3131

3232
@State var appTheme = ThemeService.shared()
33+
@State var presentProConnectInfo = false
3334

3435
var body: some View {
3536
GeometryReader { geometry in
@@ -59,6 +60,10 @@ struct TchapOnboardingSplashScreen: View {
5960
.accentColor(theme.colors.accent)
6061
.navigationBarHidden(true)
6162
.track(screen: .welcome)
63+
.sheet(isPresented: $presentProConnectInfo) {
64+
WebSheetView(targetUrl: URL(string: BuildSettings.proConnectInfoUrlString)!)
65+
}
66+
6267
}
6368

6469
var header: some View {
@@ -166,7 +171,7 @@ struct TchapOnboardingSplashScreen: View {
166171
}
167172

168173
func openProConnectWebsite() {
169-
TchapWebLinks.openProConnectInfo()
174+
presentProConnectInfo = true
170175
}
171176
}
172177

Tchap/Modules/WebSheet/WebSheetViewController.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,20 @@ extension WebSheetViewController: WKNavigationDelegate {
195195
// Called when the web view’s web content process is terminated.
196196
}
197197
}
198+
199+
import SwiftUI
200+
201+
struct WebSheetView: UIViewControllerRepresentable {
202+
typealias UIViewControllerType = WebSheetViewController
203+
let targetUrl: URL
204+
205+
func makeUIViewController(context: Context) -> WebSheetViewController {
206+
let vc = WebSheetViewController(targetUrl: targetUrl)
207+
// Do some configurations here if needed.
208+
return vc
209+
}
210+
211+
func updateUIViewController(_ uiViewController: WebSheetViewController, context: Context) {
212+
// Updates the state of the specified view controller with new information from SwiftUI.
213+
}
214+
}

changelog.d/1100.change

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ProConnect - Message d'avertissement et lien vers la FAQ à propos de la disponibilité du service ProConnect sur tous les HomeServers

0 commit comments

Comments
 (0)