Pin: rename feature pin to lockscreen
This commit is contained in:
parent
65bbe72ecc
commit
78621e4256
26 changed files with 62 additions and 62 deletions
|
|
@ -50,9 +50,9 @@ import io.element.android.features.ftue.api.state.FtueState
|
||||||
import io.element.android.features.invitelist.api.InviteListEntryPoint
|
import io.element.android.features.invitelist.api.InviteListEntryPoint
|
||||||
import io.element.android.features.networkmonitor.api.NetworkMonitor
|
import io.element.android.features.networkmonitor.api.NetworkMonitor
|
||||||
import io.element.android.features.networkmonitor.api.NetworkStatus
|
import io.element.android.features.networkmonitor.api.NetworkStatus
|
||||||
import io.element.android.features.pin.api.PinEntryPoint
|
import io.element.android.features.lockscreen.api.LockScreenEntryPoint
|
||||||
import io.element.android.features.pin.api.PinState
|
import io.element.android.features.lockscreen.api.LockScreenState
|
||||||
import io.element.android.features.pin.api.PinStateService
|
import io.element.android.features.lockscreen.api.LockScreenStateService
|
||||||
import io.element.android.features.preferences.api.PreferencesEntryPoint
|
import io.element.android.features.preferences.api.PreferencesEntryPoint
|
||||||
import io.element.android.features.roomlist.api.RoomListEntryPoint
|
import io.element.android.features.roomlist.api.RoomListEntryPoint
|
||||||
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
|
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
|
||||||
|
|
@ -93,8 +93,8 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
private val networkMonitor: NetworkMonitor,
|
private val networkMonitor: NetworkMonitor,
|
||||||
private val notificationDrawerManager: NotificationDrawerManager,
|
private val notificationDrawerManager: NotificationDrawerManager,
|
||||||
private val ftueState: FtueState,
|
private val ftueState: FtueState,
|
||||||
private val pinEntryPoint: PinEntryPoint,
|
private val lockScreenEntryPoint: LockScreenEntryPoint,
|
||||||
private val pinStateService: PinStateService,
|
private val lockScreenStateService: LockScreenStateService,
|
||||||
private val matrixClient: MatrixClient,
|
private val matrixClient: MatrixClient,
|
||||||
snackbarDispatcher: SnackbarDispatcher,
|
snackbarDispatcher: SnackbarDispatcher,
|
||||||
) : BackstackNode<LoggedInFlowNode.NavTarget>(
|
) : BackstackNode<LoggedInFlowNode.NavTarget>(
|
||||||
|
|
@ -136,12 +136,12 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
},
|
},
|
||||||
onResume = {
|
onResume = {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
pinStateService.entersForeground()
|
lockScreenStateService.entersForeground()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPause = {
|
onPause = {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
pinStateService.entersBackground()
|
lockScreenStateService.entersBackground()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onStop = {
|
onStop = {
|
||||||
|
|
@ -218,7 +218,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
createNode<LoggedInNode>(buildContext)
|
createNode<LoggedInNode>(buildContext)
|
||||||
}
|
}
|
||||||
NavTarget.LockPermanent -> {
|
NavTarget.LockPermanent -> {
|
||||||
pinEntryPoint.createNode(this, buildContext)
|
lockScreenEntryPoint.createNode(this, buildContext)
|
||||||
}
|
}
|
||||||
NavTarget.RoomList -> {
|
NavTarget.RoomList -> {
|
||||||
val callback = object : RoomListEntryPoint.Callback {
|
val callback = object : RoomListEntryPoint.Callback {
|
||||||
|
|
@ -345,9 +345,9 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
val pinState by pinStateService.pinState.collectAsState()
|
val lockScreenState by lockScreenStateService.state.collectAsState()
|
||||||
when (pinState) {
|
when (lockScreenState) {
|
||||||
PinState.Unlocked -> {
|
LockScreenState.Unlocked -> {
|
||||||
Children(
|
Children(
|
||||||
navModel = backstack,
|
navModel = backstack,
|
||||||
modifier = Modifier,
|
modifier = Modifier,
|
||||||
|
|
@ -359,7 +359,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LoggedInPermanent)
|
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LoggedInPermanent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PinState.Locked -> {
|
LockScreenState.Locked -> {
|
||||||
MoveActivityToBackgroundBackHandler()
|
MoveActivityToBackgroundBackHandler()
|
||||||
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LockPermanent)
|
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LockPermanent)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "io.element.android.features.pin.api"
|
namespace = "io.element.android.features.lockscreen.api"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.api
|
package io.element.android.features.lockscreen.api
|
||||||
|
|
||||||
import io.element.android.libraries.architecture.SimpleFeatureEntryPoint
|
import io.element.android.libraries.architecture.SimpleFeatureEntryPoint
|
||||||
|
|
||||||
interface PinEntryPoint : SimpleFeatureEntryPoint
|
interface LockScreenEntryPoint : SimpleFeatureEntryPoint
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.api
|
package io.element.android.features.lockscreen.api
|
||||||
|
|
||||||
sealed interface PinState {
|
sealed interface LockScreenState {
|
||||||
data object Unlocked : PinState
|
data object Unlocked : LockScreenState
|
||||||
data object Locked : PinState
|
data object Locked : LockScreenState
|
||||||
}
|
}
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.api
|
package io.element.android.features.lockscreen.api
|
||||||
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
|
||||||
interface PinStateService {
|
interface LockScreenStateService {
|
||||||
val pinState: StateFlow<PinState>
|
val state: StateFlow<LockScreenState>
|
||||||
|
|
||||||
suspend fun entersForeground()
|
suspend fun entersForeground()
|
||||||
suspend fun entersBackground()
|
suspend fun entersBackground()
|
||||||
|
|
@ -22,7 +22,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "io.element.android.features.pin.impl"
|
namespace = "io.element.android.features.lockscreen.impl"
|
||||||
}
|
}
|
||||||
|
|
||||||
anvil {
|
anvil {
|
||||||
|
|
@ -32,7 +32,7 @@ anvil {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.anvilannotations)
|
implementation(projects.anvilannotations)
|
||||||
anvil(projects.anvilcodegen)
|
anvil(projects.anvilcodegen)
|
||||||
api(projects.features.pin.api)
|
api(projects.features.lockscreen.api)
|
||||||
implementation(projects.libraries.core)
|
implementation(projects.libraries.core)
|
||||||
implementation(projects.libraries.architecture)
|
implementation(projects.libraries.architecture)
|
||||||
implementation(projects.libraries.matrix.api)
|
implementation(projects.libraries.matrix.api)
|
||||||
|
|
@ -14,20 +14,20 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation
|
package io.element.android.features.lockscreen.impl
|
||||||
|
|
||||||
import com.bumble.appyx.core.modality.BuildContext
|
import com.bumble.appyx.core.modality.BuildContext
|
||||||
import com.bumble.appyx.core.node.Node
|
import com.bumble.appyx.core.node.Node
|
||||||
import com.squareup.anvil.annotations.ContributesBinding
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
import io.element.android.features.pin.api.PinEntryPoint
|
import io.element.android.features.lockscreen.api.LockScreenEntryPoint
|
||||||
import io.element.android.libraries.architecture.createNode
|
import io.element.android.libraries.architecture.createNode
|
||||||
import io.element.android.libraries.di.AppScope
|
import io.element.android.libraries.di.AppScope
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultPinEntryPoint @Inject constructor() : PinEntryPoint {
|
class DefaultLockScreenEntryPoint @Inject constructor() : LockScreenEntryPoint {
|
||||||
|
|
||||||
override fun createNode(parentNode: Node, buildContext: BuildContext): Node {
|
override fun createNode(parentNode: Node, buildContext: BuildContext): Node {
|
||||||
return parentNode.createNode<PinFlowNode>(buildContext)
|
return parentNode.createNode<LockScreenFlowNode>(buildContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation
|
package io.element.android.features.lockscreen.impl
|
||||||
|
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -27,8 +27,8 @@ import com.bumble.appyx.navmodel.backstack.BackStack
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import io.element.android.anvilannotations.ContributesNode
|
import io.element.android.anvilannotations.ContributesNode
|
||||||
import io.element.android.features.pin.impl.presentation.auth.PinAuthenticationNode
|
import io.element.android.features.lockscreen.impl.auth.PinAuthenticationNode
|
||||||
import io.element.android.features.pin.impl.presentation.create.CreatePinNode
|
import io.element.android.features.lockscreen.impl.create.CreatePinNode
|
||||||
import io.element.android.libraries.architecture.BackstackNode
|
import io.element.android.libraries.architecture.BackstackNode
|
||||||
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
|
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
|
||||||
import io.element.android.libraries.architecture.createNode
|
import io.element.android.libraries.architecture.createNode
|
||||||
|
|
@ -36,10 +36,10 @@ import io.element.android.libraries.di.AppScope
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
|
|
||||||
@ContributesNode(AppScope::class)
|
@ContributesNode(AppScope::class)
|
||||||
class PinFlowNode @AssistedInject constructor(
|
class LockScreenFlowNode @AssistedInject constructor(
|
||||||
@Assisted buildContext: BuildContext,
|
@Assisted buildContext: BuildContext,
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
) : BackstackNode<PinFlowNode.NavTarget>(
|
) : BackstackNode<LockScreenFlowNode.NavTarget>(
|
||||||
backstack = BackStack(
|
backstack = BackStack(
|
||||||
initialElement = NavTarget.Auth,
|
initialElement = NavTarget.Auth,
|
||||||
savedStateMap = buildContext.savedStateMap,
|
savedStateMap = buildContext.savedStateMap,
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.auth
|
package io.element.android.features.lockscreen.impl.auth
|
||||||
|
|
||||||
sealed interface PinAuthenticationEvents {
|
sealed interface PinAuthenticationEvents {
|
||||||
data object Unlock : PinAuthenticationEvents
|
data object Unlock : PinAuthenticationEvents
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.auth
|
package io.element.android.features.lockscreen.impl.auth
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -14,17 +14,17 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.auth
|
package io.element.android.features.lockscreen.impl.auth
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import io.element.android.features.pin.api.PinStateService
|
import io.element.android.features.lockscreen.api.LockScreenStateService
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PinAuthenticationPresenter @Inject constructor(
|
class PinAuthenticationPresenter @Inject constructor(
|
||||||
private val pinStateService: PinStateService,
|
private val pinStateService: LockScreenStateService,
|
||||||
private val coroutineScope: CoroutineScope,
|
private val coroutineScope: CoroutineScope,
|
||||||
) : Presenter<PinAuthenticationState> {
|
) : Presenter<PinAuthenticationState> {
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.auth
|
package io.element.android.features.lockscreen.impl.auth
|
||||||
|
|
||||||
data class PinAuthenticationState(
|
data class PinAuthenticationState(
|
||||||
val eventSink: (PinAuthenticationEvents) -> Unit
|
val eventSink: (PinAuthenticationEvents) -> Unit
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.auth
|
package io.element.android.features.lockscreen.impl.auth
|
||||||
|
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.auth
|
package io.element.android.features.lockscreen.impl.auth
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.create
|
package io.element.android.features.lockscreen.impl.create
|
||||||
|
|
||||||
sealed interface CreatePinEvents {
|
sealed interface CreatePinEvents {
|
||||||
object MyEvent : CreatePinEvents
|
object MyEvent : CreatePinEvents
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.create
|
package io.element.android.features.lockscreen.impl.create
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.create
|
package io.element.android.features.lockscreen.impl.create
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.create
|
package io.element.android.features.lockscreen.impl.create
|
||||||
|
|
||||||
data class CreatePinState(
|
data class CreatePinState(
|
||||||
val eventSink: (CreatePinEvents) -> Unit
|
val eventSink: (CreatePinEvents) -> Unit
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.create
|
package io.element.android.features.lockscreen.impl.create
|
||||||
|
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.presentation.create
|
package io.element.android.features.lockscreen.impl.create
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.pin
|
package io.element.android.features.lockscreen.impl.pin
|
||||||
|
|
||||||
import com.squareup.anvil.annotations.ContributesBinding
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
import io.element.android.features.pin.impl.pin.storage.PinCodeStore
|
import io.element.android.features.lockscreen.impl.pin.storage.PinCodeStore
|
||||||
import io.element.android.libraries.cryptography.api.CryptoService
|
import io.element.android.libraries.cryptography.api.CryptoService
|
||||||
import io.element.android.libraries.cryptography.api.EncryptionResult
|
import io.element.android.libraries.cryptography.api.EncryptionResult
|
||||||
import io.element.android.libraries.di.AppScope
|
import io.element.android.libraries.di.AppScope
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.pin
|
package io.element.android.features.lockscreen.impl.pin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is the main interface to manage the pin code.
|
* This interface is the main interface to manage the pin code.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.pin.storage
|
package io.element.android.features.lockscreen.impl.pin.storage
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be implemented by any class that provides access to the encrypted PIN code.
|
* Should be implemented by any class that provides access to the encrypted PIN code.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.pin.storage
|
package io.element.android.features.lockscreen.impl.pin.storage
|
||||||
|
|
||||||
interface PinCodeStore : EncryptedPinCodeStorage {
|
interface PinCodeStore : EncryptedPinCodeStorage {
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.pin.storage
|
package io.element.android.features.lockscreen.impl.pin.storage
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.state
|
package io.element.android.features.lockscreen.impl.state
|
||||||
|
|
||||||
import com.squareup.anvil.annotations.ContributesBinding
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
import io.element.android.features.pin.api.PinState
|
import io.element.android.features.lockscreen.api.LockScreenState
|
||||||
import io.element.android.features.pin.api.PinStateService
|
import io.element.android.features.lockscreen.api.LockScreenStateService
|
||||||
import io.element.android.libraries.di.AppScope
|
import io.element.android.libraries.di.AppScope
|
||||||
import io.element.android.libraries.di.SingleIn
|
import io.element.android.libraries.di.SingleIn
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
||||||
|
|
@ -35,18 +35,18 @@ private const val GRACE_PERIOD_IN_MILLIS = 90 * 1000L
|
||||||
|
|
||||||
@SingleIn(AppScope::class)
|
@SingleIn(AppScope::class)
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultPinStateService @Inject constructor(
|
class DefaultLockScreenStateService @Inject constructor(
|
||||||
private val featureFlagService: FeatureFlagService,
|
private val featureFlagService: FeatureFlagService,
|
||||||
) : PinStateService {
|
) : LockScreenStateService {
|
||||||
|
|
||||||
private val _pinState = MutableStateFlow<PinState>(PinState.Unlocked)
|
private val _lockScreenState = MutableStateFlow<LockScreenState>(LockScreenState.Unlocked)
|
||||||
override val pinState: StateFlow<PinState> = _pinState
|
override val state: StateFlow<LockScreenState> = _lockScreenState
|
||||||
|
|
||||||
private var lockJob: Job? = null
|
private var lockJob: Job? = null
|
||||||
|
|
||||||
override suspend fun unlock() {
|
override suspend fun unlock() {
|
||||||
if (featureFlagService.isFeatureEnabled(FeatureFlags.PinUnlock)) {
|
if (featureFlagService.isFeatureEnabled(FeatureFlags.PinUnlock)) {
|
||||||
_pinState.value = PinState.Unlocked
|
_lockScreenState.value = LockScreenState.Unlocked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ class DefaultPinStateService @Inject constructor(
|
||||||
lockJob = launch {
|
lockJob = launch {
|
||||||
if (featureFlagService.isFeatureEnabled(FeatureFlags.PinUnlock)) {
|
if (featureFlagService.isFeatureEnabled(FeatureFlags.PinUnlock)) {
|
||||||
delay(GRACE_PERIOD_IN_MILLIS)
|
delay(GRACE_PERIOD_IN_MILLIS)
|
||||||
_pinState.value = PinState.Locked
|
_lockScreenState.value = LockScreenState.Locked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue