Lock screen : fix code quality
This commit is contained in:
@@ -32,7 +32,6 @@ import com.bumble.appyx.navmodel.backstack.operation.push
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedInject
|
||||
import io.element.android.anvilannotations.ContributesNode
|
||||
import io.element.android.features.lockscreen.impl.biometric.BiometricUnlockManager
|
||||
import io.element.android.features.lockscreen.impl.pin.DefaultPinCodeManagerCallback
|
||||
import io.element.android.features.lockscreen.impl.pin.PinCodeManager
|
||||
import io.element.android.features.lockscreen.impl.setup.pin.SetupPinNode
|
||||
@@ -50,7 +49,6 @@ class LockScreenSettingsFlowNode @AssistedInject constructor(
|
||||
@Assisted buildContext: BuildContext,
|
||||
@Assisted plugins: List<Plugin>,
|
||||
private val pinCodeManager: PinCodeManager,
|
||||
private val biometricUnlockManager: BiometricUnlockManager,
|
||||
) : BackstackNode<LockScreenSettingsFlowNode.NavTarget>(
|
||||
backstack = BackStack(
|
||||
initialElement = NavTarget.Unknown,
|
||||
|
||||
@@ -39,7 +39,6 @@ import io.element.android.libraries.core.bool.orFalse
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class PinUnlockPresenter @Inject constructor(
|
||||
@@ -99,7 +98,11 @@ class PinUnlockPresenter @Inject constructor(
|
||||
showSignOutPrompt = true
|
||||
}
|
||||
}
|
||||
IsUnlockedEffect(isUnlocked)
|
||||
|
||||
OnUnlockEffect {
|
||||
isUnlocked.value = true
|
||||
}
|
||||
|
||||
fun handleEvents(event: PinUnlockEvents) {
|
||||
when (event) {
|
||||
is PinUnlockEvents.OnPinKeypadPressed -> {
|
||||
@@ -140,16 +143,16 @@ class PinUnlockPresenter @Inject constructor(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun IsUnlockedEffect(isUnlocked: MutableState<Boolean>) {
|
||||
private fun OnUnlockEffect(onUnlock: () -> Unit) {
|
||||
DisposableEffect(Unit) {
|
||||
val biometricUnlockCallback = object : DefaultBiometricUnlockCallback() {
|
||||
override fun onBiometricUnlockSuccess() {
|
||||
isUnlocked.value = true
|
||||
onUnlock()
|
||||
}
|
||||
}
|
||||
val pinCodeVerifiedCallback = object : DefaultPinCodeManagerCallback() {
|
||||
override fun onPinCodeVerified() {
|
||||
isUnlocked.value = true
|
||||
onUnlock()
|
||||
}
|
||||
}
|
||||
biometricUnlockManager.addCallback(biometricUnlockCallback)
|
||||
|
||||
Reference in New Issue
Block a user