From edbb024badc974bb383ab644d7ffb513906b629b Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Wed, 1 Dec 2021 12:34:24 +0100 Subject: [PATCH] Link privacy policy from the login splash screen Users might want to read the privacy policy *before* logging in. Change-Id: I30b0935e107494e015f2a911589420aae67d7614 --- .../app/features/login/LoginSplashFragment.kt | 7 +++++++ .../src/main/res/layout/fragment_login_splash.xml | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/vector/src/main/java/im/vector/app/features/login/LoginSplashFragment.kt b/vector/src/main/java/im/vector/app/features/login/LoginSplashFragment.kt index 527f9f99b3..02c92ddfe0 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginSplashFragment.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginSplashFragment.kt @@ -25,8 +25,10 @@ import androidx.core.view.isVisible import com.google.android.material.dialog.MaterialAlertDialogBuilder import im.vector.app.BuildConfig import im.vector.app.R +import im.vector.app.core.utils.openUrlInChromeCustomTab import im.vector.app.databinding.FragmentLoginSplashBinding import im.vector.app.features.settings.VectorPreferences +import im.vector.app.features.settings.VectorSettingsUrls import org.matrix.android.sdk.api.failure.Failure import java.net.UnknownHostException import javax.inject.Inject @@ -50,6 +52,7 @@ class LoginSplashFragment @Inject constructor( private fun setupViews() { views.loginSplashSubmit.debouncedClicks { getStarted() } + views.showPrivacyPolicyButton.debouncedClicks { showPrivacyPolicy() } if (BuildConfig.DEBUG || vectorPreferences.developerMode()) { views.loginSplashVersion.isVisible = true @@ -64,6 +67,10 @@ class LoginSplashFragment @Inject constructor( loginViewModel.handle(LoginAction.OnGetStarted(resetLoginConfig = false)) } + private fun showPrivacyPolicy() { + openUrlInChromeCustomTab(requireContext(), null, VectorSettingsUrls.PRIVACY_POLICY) + } + override fun resetViewModel() { // Nothing to do } diff --git a/vector/src/main/res/layout/fragment_login_splash.xml b/vector/src/main/res/layout/fragment_login_splash.xml index 889db114df..1512083d0d 100644 --- a/vector/src/main/res/layout/fragment_login_splash.xml +++ b/vector/src/main/res/layout/fragment_login_splash.xml @@ -198,6 +198,19 @@ app:layout_constraintTop_toBottomOf="@+id/loginSplashSubmit" app:layout_constraintVertical_weight="4" /> +