LockScreen : refact some code and add secureFlag
This commit is contained in:
parent
5777ed0a76
commit
f10231091d
15 changed files with 128 additions and 47 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue