From b1a0a2434a15c90020a8de6596d8e5a35cd3ba41 Mon Sep 17 00:00:00 2001 From: "ingvar.skogen" Date: Wed, 28 Feb 2024 20:29:13 +0100 Subject: [PATCH] Fix the update in the background thread issue --- .../onboarding/localAuth/LocalAuthFragment.kt | 22 ++++++++++------- .../localAuth/LocalAuthViewModel.kt | 24 +++++++++++-------- .../onboarding/localAuth/SecureState.kt | 6 ++++- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/tari/android/wallet/ui/fragment/onboarding/localAuth/LocalAuthFragment.kt b/app/src/main/java/com/tari/android/wallet/ui/fragment/onboarding/localAuth/LocalAuthFragment.kt index a6387159e..2908d6446 100644 --- a/app/src/main/java/com/tari/android/wallet/ui/fragment/onboarding/localAuth/LocalAuthFragment.kt +++ b/app/src/main/java/com/tari/android/wallet/ui/fragment/onboarding/localAuth/LocalAuthFragment.kt @@ -40,6 +40,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.viewModels +import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import com.daasuu.ei.Ease import com.daasuu.ei.EasingInterpolator @@ -49,7 +50,7 @@ import com.tari.android.wallet.application.WalletState import com.tari.android.wallet.databinding.FragmentLocalAuthBinding import com.tari.android.wallet.event.EventBus import com.tari.android.wallet.extension.addTo -import com.tari.android.wallet.extension.observe +import com.tari.android.wallet.extension.launchAndRepeatOnLifecycle import com.tari.android.wallet.infrastructure.security.biometric.BiometricAuthenticationException import com.tari.android.wallet.ui.common.CommonFragment import com.tari.android.wallet.ui.extension.doOnGlobalLayout @@ -78,11 +79,15 @@ class LocalAuthFragment : CommonFragment + ui.continueBtn.setVisible(state.pinCodeSecured) + ui.authTypeBiometrics.setVisible(state.biometricsAvailable) + ui.secureWithPasscode.setVisible(!state.pinCodeSecured) + ui.secureWithBiometrics.setVisible(state.biometricsAvailable && !state.biometricsSecured) + } + } } } @@ -122,10 +127,11 @@ class LocalAuthFragment : CommonFragment