LockScreen : refact some code and add secureFlag

This commit is contained in:
ganfra 2023-11-07 15:55:53 +01:00
parent 5777ed0a76
commit f10231091d
15 changed files with 128 additions and 47 deletions

View file

@ -18,21 +18,27 @@ package io.element.android.features.lockscreen.test
import io.element.android.features.lockscreen.api.LockScreenLockState
import io.element.android.features.lockscreen.api.LockScreenService
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map
class FakeLockScreenService : LockScreenService {
private var isSetupRequired: Boolean = false
private var isPinSetup = MutableStateFlow(false)
private val _lockState: MutableStateFlow<LockScreenLockState> = MutableStateFlow(LockScreenLockState.Locked)
override val lockState: StateFlow<LockScreenLockState> = _lockState
override suspend fun isSetupRequired(): Boolean {
return isSetupRequired
override fun isSetupRequired(): Flow<Boolean> {
return isPinSetup.map { !it }
}
fun setIsSetupRequired(isSetupRequired: Boolean) {
this.isSetupRequired = isSetupRequired
fun setIsPinSetup(isPinSetup: Boolean) {
this.isPinSetup.value = isPinSetup
}
override fun isPinSetup(): Flow<Boolean> {
return isPinSetup
}
fun setLockState(lockState: LockScreenLockState) {