diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 191c7e23acef0f25ce6a0a92936a9a8c72bfeee6..4daa704fdcf12717bf6b7beac7137215a50b4e03 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -132,6 +132,9 @@ + + . + */ + +package at.bitfire.davdroid.ui + +import android.os.Bundle +import android.webkit.WebView +import androidx.appcompat.app.AppCompatActivity +import at.bitfire.davdroid.R + +class ShowUrlActivity : AppCompatActivity() { + + companion object { + const val URL = "url" + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_show_url) + + val url = intent.getStringExtra(URL) + + if (url.isNullOrEmpty()) { + finish() + return + } + + val webView: WebView = findViewById(R.id.webview) + webView.loadUrl(url) + } +} \ No newline at end of file diff --git a/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt b/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt index cfd3cbeabdf73a08ace5e52e0ff51d20f83f0dce..3d73d760e2930d72048a33aaf327cfd14a88bcb2 100644 --- a/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt +++ b/app/src/main/java/at/bitfire/davdroid/ui/setup/EeloAuthenticatorFragment.kt @@ -18,7 +18,9 @@ package at.bitfire.davdroid.ui.setup import android.annotation.SuppressLint import android.content.Context +import android.content.Intent import android.net.ConnectivityManager +import android.net.Uri import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -33,6 +35,8 @@ import at.bitfire.davdroid.ECloudAccountHelper import at.bitfire.davdroid.R import at.bitfire.davdroid.databinding.FragmentEeloAuthenticatorBinding import at.bitfire.davdroid.db.Credentials +import at.bitfire.davdroid.ui.ShowUrlActivity +import com.google.android.material.dialog.MaterialAlertDialogBuilder import kotlinx.android.synthetic.main.fragment_eelo_authenticator.* import kotlinx.android.synthetic.main.fragment_eelo_authenticator.view.* import java.net.URI @@ -67,6 +71,8 @@ class EeloAuthenticatorFragment : Fragment() { v.root.sign_in.setOnClickListener { login() } + v.root.twofa_info_button.setOnClickListener { show2FAInfoDialog() } + v.root.urlpwd_user_name.doOnTextChanged { text, _, _, _ -> val domain = computeDomain(text) if (domain.isEmpty()) { @@ -242,4 +248,17 @@ class EeloAuthenticatorFragment : Fragment() { toggleButtonState = false } } + + private fun show2FAInfoDialog() { + MaterialAlertDialogBuilder(requireContext(), R.style.CustomAlertDialogStyle) + .setView(R.layout.dialog_2fa_info) + .setPositiveButton(R.string.view_more) { _, _ -> + val intent = Intent(requireContext(), ShowUrlActivity::class.java) + .putExtra(ShowUrlActivity.URL, getString(R.string.url_2fa_info)) + startActivity(intent) + } + .setNegativeButton(R.string.later, null) + .show() + + } } diff --git a/app/src/main/res/layout/activity_show_url.xml b/app/src/main/res/layout/activity_show_url.xml new file mode 100644 index 0000000000000000000000000000000000000000..d2ecec8c1e78c95150c9e6644694419bca327abe --- /dev/null +++ b/app/src/main/res/layout/activity_show_url.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_2fa_info.xml b/app/src/main/res/layout/dialog_2fa_info.xml new file mode 100644 index 0000000000000000000000000000000000000000..e60dd80667e0383a708e3fb8e0fa85f1176ea703 --- /dev/null +++ b/app/src/main/res/layout/dialog_2fa_info.xml @@ -0,0 +1,44 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_eelo_authenticator.xml b/app/src/main/res/layout/fragment_eelo_authenticator.xml index d55e69a6c21334f9852d762964bdd6418f4085e0..0321f345d07c5c0ffcf01c8e65edae8667a11b0a 100644 --- a/app/src/main/res/layout/fragment_eelo_authenticator.xml +++ b/app/src/main/res/layout/fragment_eelo_authenticator.xml @@ -151,6 +151,21 @@ android:textColor="@color/primaryTextColor" /> +