Link privacy policy from the login splash screen

Users might want to read the privacy policy *before* logging in.

Change-Id: I30b0935e107494e015f2a911589420aae67d7614
This commit is contained in:
SpiritCroc 2021-12-01 12:34:24 +01:00
parent c8abe21ec0
commit edbb024bad
2 changed files with 20 additions and 0 deletions

View File

@ -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
}

View File

@ -198,6 +198,19 @@
app:layout_constraintTop_toBottomOf="@+id/loginSplashSubmit"
app:layout_constraintVertical_weight="4" />
<Button
android:id="@+id/showPrivacyPolicyButton"
style="@style/Widget.Vector.Button.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_vertical_margin"
android:minWidth="130dp"
android:text="@string/settings_privacy_policy"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/loginSplashVersion"
app:layout_constraintTop_toBottomOf="@id/loginSplashSubmit" />
<TextView
android:id="@+id/loginSplashVersion"
style="@style/Widget.Vector.TextView.Caption"