Updated on 2026-08-14

This commit is contained in:
Tangem 2024-08-06 13:43:21 +03:00
parent b350717cd0
commit 25abb8e2fc
2 changed files with 9 additions and 4 deletions

View file

@ -161,6 +161,8 @@ internal class CardSettingsViewModel @Inject constructor(
if (scanResponse.cardTypesResolver.isTangemTwins()) {
store.dispatch(TwinCardsAction.SetMode(CreateTwinWalletMode.RecreateWallet(scanResponse)))
cardSettingsInteractor.clear()
store.dispatchNavigationAction { push(AppRoute.OnboardingTwins) }
} else {
val card = scanResponse.card

View file

@ -65,9 +65,9 @@ private fun handle(action: Action, dispatch: DispatchFunction) {
val userWalletsListManager = store.inject(DaggerGraphState::generalUserWalletsListManager)
fun getScanResponse(): ScanResponse {
return when (val mode = twinCardsState.mode) {
return when (twinCardsState.mode) {
is CreateTwinWalletMode.CreateWallet -> onboardingManager?.scanResponse
is CreateTwinWalletMode.RecreateWallet -> mode.scanResponse
is CreateTwinWalletMode.RecreateWallet -> globalState.scanResponse
} ?: throw NullPointerException("ScanResponse can't be NULL")
}
@ -105,6 +105,10 @@ private fun handle(action: Action, dispatch: DispatchFunction) {
mainScope.launch {
if (twinCardsState.currentStep is TwinCardsStep.WelcomeOnly) return@launch
if (twinCardsState.mode is CreateTwinWalletMode.RecreateWallet) {
store.dispatch(GlobalAction.SaveScanResponse(twinCardsState.mode.scanResponse))
}
val scanResponse = getScanResponse()
onboardingManager?.apply {
if (!isActivationStarted(scanResponse.card.cardId)) {
@ -368,8 +372,7 @@ private fun getPopBackScreen(): KClass<out AppRoute> {
val userWalletsListManager = store.inject(DaggerGraphState::generalUserWalletsListManager)
return if (userWalletsListManager.hasUserWallets) {
val isLocked = runCatching { userWalletsListManager.asLockable()?.isLockedSync }
.fold(onSuccess = { true }, onFailure = { false })
val isLocked = runCatching { userWalletsListManager.asLockable()?.isLockedSync!! }.getOrElse { false }
if (isLocked) {
AppRoute.Welcome::class