Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a1789fb authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make fallback button optional for Credential View" into main

parents 5e1fef2e 29a44744
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ object CredentialViewBinder {
        val errorView: TextView = view.requireViewById(R.id.error)
        val cancelButton: Button? = view.findViewById(R.id.cancel_button)
        val emergencyButtonView: Button = view.requireViewById(R.id.emergencyCallButton)
        val fallbackButton: Button = view.requireViewById(R.id.fallback_button)
        val fallbackButton: Button? = view.findViewById(R.id.fallback_button)

        var errorTimer: Job? = null

@@ -157,7 +157,7 @@ object CredentialViewBinder {
                launch {
                    viewModel.showFallbackButton.collect { showFallback ->
                        if (showFallback) {
                            fallbackButton.visibility = View.VISIBLE
                            fallbackButton?.visibility = View.VISIBLE
                        }
                    }
                }
@@ -165,15 +165,15 @@ object CredentialViewBinder {
                launch {
                    viewModel.fallbackOptions.collect { options ->
                        if (options.count() > 1) {
                            fallbackButton.text =
                            fallbackButton?.text =
                                view.context.getString(R.string.biometric_dialog_fallback_button)
                            fallbackButton.setOnClickListener {
                            fallbackButton?.setOnClickListener {
                                viewModel.onSwitchToFallbackScreen()
                            }
                        } else if (options.count() == 1) {
                            // If only one option, use it as the fallback button
                            fallbackButton.text = options[0].text
                            fallbackButton.setOnClickListener {
                            fallbackButton?.text = options[0].text
                            fallbackButton?.setOnClickListener {
                                legacyCallback.onFallbackOptionPressed(0)
                            }
                        }