mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
LockScreen : refact some code and add secureFlag
This commit is contained in:
+11
-5
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user