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

ProConnect - Message d'avertissement précisant que ProConnect n'est p… #1123

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion Btchap/Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should add the host part in a const.


// MARK: - Matrix permalinks
// Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app.
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion DevTchap/Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = [
Expand Down
2 changes: 2 additions & 0 deletions Tchap/Assets/Localizations/fr.lproj/Tchap.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion Tchap/Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = [
Expand Down
4 changes: 0 additions & 4 deletions Tchap/Extensions/WebLinks+Tchap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -91,6 +99,8 @@ struct TchapAuthenticationLoginScreen: View {
passwordLoginSection
} else if case .sso = viewModel.viewState.tchapAuthenticationMode {
ssoLoginSection
Spacer(minLength: 32.0)
ssoInformation
}
}
}
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -231,7 +248,11 @@ struct TchapAuthenticationLoginScreen: View {
}

func openProConnectWebsite() {
TchapWebLinks.openProConnectInfo()
presentProConnectInfo = true
}

func openProConnectAvailabilityFaqArticle() {
presentProConnectAvailabilityFaqArticle = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -166,7 +171,7 @@ struct TchapOnboardingSplashScreen: View {
}

func openProConnectWebsite() {
TchapWebLinks.openProConnectInfo()
presentProConnectInfo = true
}
}

Expand Down
17 changes: 17 additions & 0 deletions Tchap/Modules/WebSheet/WebSheetViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}
1 change: 1 addition & 0 deletions changelog.d/1100.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ProConnect - Message d'avertissement et lien vers la FAQ à propos de la disponibilité du service ProConnect sur tous les HomeServers
Loading