Rework. Keep io.element.android.appconfig.LockScreenConfig as simple as possible.
This commit is contained in:
parent
573cd5e298
commit
6d6de1ae3d
12 changed files with 77 additions and 52 deletions
|
|
@ -16,44 +16,28 @@
|
|||
|
||||
package io.element.android.appconfig
|
||||
|
||||
import com.squareup.anvil.annotations.ContributesTo
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
/**
|
||||
* Configuration for the lock screen feature.
|
||||
* @property isPinMandatory Whether the PIN is mandatory or not.
|
||||
* @property pinBlacklist Some PINs are forbidden.
|
||||
* @property pinSize The size of the PIN.
|
||||
* @property maxPinCodeAttemptsBeforeLogout Number of attempts before the user is logged out.
|
||||
* @property gracePeriod Time period before locking the app once backgrounded.
|
||||
* @property isStrongBiometricsEnabled Authentication with strong methods (fingerprint, some face/iris unlock implementations) is supported.
|
||||
* @property isWeakBiometricsEnabled Authentication with weak methods (most face/iris unlock implementations) is supported.
|
||||
*/
|
||||
data class LockScreenConfig(
|
||||
val isPinMandatory: Boolean,
|
||||
val pinBlacklist: Set<String>,
|
||||
val pinSize: Int,
|
||||
val maxPinCodeAttemptsBeforeLogout: Int,
|
||||
val gracePeriod: Duration,
|
||||
val isStrongBiometricsEnabled: Boolean,
|
||||
val isWeakBiometricsEnabled: Boolean,
|
||||
)
|
||||
object LockScreenConfig {
|
||||
/** Whether the PIN is mandatory or not. */
|
||||
const val IS_PIN_MANDATORY: Boolean = false
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@Module
|
||||
object LockScreenConfigModule {
|
||||
@Provides
|
||||
fun providesLockScreenConfig(): LockScreenConfig = LockScreenConfig(
|
||||
isPinMandatory = false,
|
||||
pinBlacklist = setOf("0000", "1234"),
|
||||
pinSize = 4,
|
||||
maxPinCodeAttemptsBeforeLogout = 3,
|
||||
gracePeriod = 0.seconds,
|
||||
isStrongBiometricsEnabled = true,
|
||||
isWeakBiometricsEnabled = true,
|
||||
)
|
||||
/** Set of forbidden PIN. */
|
||||
val PIN_BLACKLIST: Set<String> = setOf("0000", "1234")
|
||||
|
||||
/** The size of the PIN */
|
||||
const val PIN_SIZE: Int = 4
|
||||
|
||||
/** Number of attempts before the user is logged out. */
|
||||
const val MAX_PIN_CODE_ATTEMPTS_BEFORE_LOGOUT: Int = 3
|
||||
|
||||
/** Time period before locking the app once backgrounded. */
|
||||
val GRACE_PERIOD: Duration = 0.seconds
|
||||
|
||||
/** Authentication with strong methods (fingerprint, some face/iris unlock implementations) is supported. */
|
||||
const val IS_STRONG_BIOMETRICS_ENABLED: Boolean = true
|
||||
|
||||
/** Authentication with weak methods (most face/iris unlock implementations) is supported. */
|
||||
const val IS_WEAK_BIOMETRICS_ENABLED: Boolean = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue