Updated on 2026-08-14
This commit is contained in:
parent
64c7c64b3a
commit
713cad5fd7
26 changed files with 100 additions and 359 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package com.tangem.tap.features.welcome.component
|
||||
|
||||
import com.tangem.common.routing.entity.InitScreenLaunchMode
|
||||
import com.tangem.common.routing.entity.SerializableIntent
|
||||
import com.tangem.core.decompose.factory.ComponentFactory
|
||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||
|
||||
|
|
@ -9,7 +8,6 @@ interface WelcomeComponent : ComposableContentComponent {
|
|||
|
||||
data class Params(
|
||||
val launchMode: InitScreenLaunchMode,
|
||||
val intent: SerializableIntent?,
|
||||
)
|
||||
|
||||
interface Factory : ComponentFactory<Params, WelcomeComponent>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ internal class WelcomeModel @Inject constructor(
|
|||
|
||||
val welcomeAction = when (params.launchMode) {
|
||||
is InitScreenLaunchMode.WithCardScan -> WelcomeAction.ProceedWithCard
|
||||
is InitScreenLaunchMode.Standard -> WelcomeAction.ProceedWithBiometrics(params.intent?.toIntent())
|
||||
is InitScreenLaunchMode.Standard -> WelcomeAction.ProceedWithBiometrics
|
||||
}
|
||||
|
||||
store.dispatch(welcomeAction)
|
||||
|
|
@ -55,7 +55,7 @@ internal class WelcomeModel @Inject constructor(
|
|||
|
||||
private fun unlockWallets() {
|
||||
Analytics.send(SignIn.ButtonBiometricSignIn())
|
||||
store.dispatch(WelcomeAction.ProceedWithBiometrics())
|
||||
store.dispatch(WelcomeAction.ProceedWithBiometrics)
|
||||
}
|
||||
|
||||
private fun scanCard() {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package com.tangem.tap.features.welcome.redux
|
||||
|
||||
import android.content.Intent
|
||||
import com.tangem.common.core.TangemError
|
||||
import org.rekotlin.Action
|
||||
|
||||
internal sealed interface WelcomeAction : Action {
|
||||
|
||||
data class ProceedWithBiometrics(val afterUnlockIntent: Intent? = null) : WelcomeAction {
|
||||
data object ProceedWithBiometrics : WelcomeAction {
|
||||
object Success : WelcomeAction
|
||||
data class Error(val error: TangemError) : WelcomeAction
|
||||
}
|
||||
|
|
@ -17,8 +16,6 @@ internal sealed interface WelcomeAction : Action {
|
|||
data class ChangeProgress(val showProgress: Boolean) : WelcomeAction
|
||||
}
|
||||
|
||||
data class ProceedWithIntent(val intent: Intent) : WelcomeAction
|
||||
|
||||
object CloseError : WelcomeAction
|
||||
|
||||
object ClearUserWallets : WelcomeAction
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.tangem.tap.features.welcome.redux
|
||||
|
||||
import android.content.Intent
|
||||
import com.tangem.common.core.TangemSdkError
|
||||
import com.tangem.common.doOnFailure
|
||||
import com.tangem.common.doOnResult
|
||||
|
|
@ -41,7 +40,6 @@ internal class WelcomeMiddleware {
|
|||
private fun handleAction(action: WelcomeAction) {
|
||||
mainScope.launch {
|
||||
when (action) {
|
||||
is WelcomeAction.ProceedWithIntent -> proceedWithIntent(action.intent)
|
||||
is WelcomeAction.ProceedWithBiometrics -> proceedWithBiometrics()
|
||||
is WelcomeAction.ProceedWithCard -> proceedWithCard()
|
||||
is WelcomeAction.ClearUserWallets -> disableUserWalletsSaving()
|
||||
|
|
@ -50,26 +48,7 @@ internal class WelcomeMiddleware {
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun proceedWithIntent(initialIntent: Intent) {
|
||||
Timber.d(
|
||||
"""
|
||||
Proceeding with intent
|
||||
|- Intent: $initialIntent
|
||||
""".trimIndent(),
|
||||
)
|
||||
|
||||
val hasUncompletedBackup = backupService.hasIncompletedBackup
|
||||
|
||||
if (!hasUncompletedBackup) {
|
||||
store.dispatchWithMain(WelcomeAction.ProceedWithBiometrics(initialIntent))
|
||||
} else {
|
||||
store.dispatchWithMain(WelcomeAction.ProceedWithCard)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun proceedWithBiometrics() {
|
||||
Timber.d("Proceeding with biometry")
|
||||
|
||||
val userWalletsListManager = store.inject(DaggerGraphState::generalUserWalletsListManager)
|
||||
userWalletsListManager.unlockIfLockable(type = UnlockType.ANY)
|
||||
.doOnFailure { error ->
|
||||
|
|
@ -89,8 +68,6 @@ internal class WelcomeMiddleware {
|
|||
}
|
||||
|
||||
private suspend fun proceedWithCard() {
|
||||
Timber.d("Proceeding with card")
|
||||
|
||||
scanCardInternal { scanResponse ->
|
||||
val userWalletBuilder = store.inject(DaggerGraphState::coldUserWalletBuilderFactory).create(scanResponse)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ internal object WelcomeReducer {
|
|||
|
||||
private fun internalReduce(action: WelcomeAction, state: WelcomeState): WelcomeState {
|
||||
return when (action) {
|
||||
is WelcomeAction.ProceedWithIntent -> state.copy(intent = action.intent)
|
||||
is WelcomeAction.ProceedWithBiometrics -> state.copy(isUnlockWithBiometricsInProgress = true)
|
||||
is WelcomeAction.ProceedWithCard -> state.copy(isUnlockWithCardInProgress = true)
|
||||
is WelcomeAction.ProceedWithBiometrics.Error -> state.copy(
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package com.tangem.tap.features.welcome.redux
|
||||
|
||||
import android.content.Intent
|
||||
import com.tangem.common.core.TangemError
|
||||
import org.rekotlin.StateType
|
||||
|
||||
data class WelcomeState(
|
||||
val isUnlockWithBiometricsInProgress: Boolean = false,
|
||||
val isUnlockWithCardInProgress: Boolean = false,
|
||||
val intent: Intent? = null,
|
||||
val error: TangemError? = null,
|
||||
) : StateType
|
||||
Loading…
Add table
Add a link
Reference in a new issue