Updated on 2026-08-14

This commit is contained in:
Tangem 2024-06-11 15:24:34 +04:00
parent 821be73571
commit ba4ceb2e8b
8 changed files with 101 additions and 14 deletions

View file

@ -10,6 +10,7 @@ import com.tangem.core.navigation.url.UrlOpener
import com.tangem.features.details.routing.DetailsRoute
import com.tangem.features.tester.api.TesterRouter
import javax.inject.Inject
import kotlin.reflect.KClass
// TODO: Remove after [REDACTED_JIRA]
internal class DetailsRouter @Inject constructor(
@ -46,13 +47,15 @@ internal class DetailsRouter @Inject constructor(
onComplete(true)
}
override fun popTo(routeClass: KClass<out Route>, onComplete: (isSuccess: Boolean) -> Unit) {
TODO("This class will be removed in future")
}
override fun popTo(route: Route, onComplete: (isSuccess: Boolean) -> Unit) {
if (route is DetailsRoute.Screen) {
reduxNavController.popBackStack(route.screen)
onComplete(true)
} else {
reduxNavController.getBackStack()
onComplete(false)
}
TODO("This class will be removed in future")
}
override fun clear(onComplete: (isSuccess: Boolean) -> Unit) {
TODO("This class will be removed in future")
}
}

View file

@ -2,6 +2,7 @@ package com.tangem.features.details.component.preview
import com.tangem.core.decompose.navigation.Route
import com.tangem.core.decompose.navigation.Router
import kotlin.reflect.KClass
internal class PreviewRouter : Router {
override fun push(route: Route, onComplete: (isSuccess: Boolean) -> Unit) {
@ -12,7 +13,15 @@ internal class PreviewRouter : Router {
/* no-op */
}
override fun popTo(routeClass: KClass<out Route>, onComplete: (isSuccess: Boolean) -> Unit) {
/* no-op */
}
override fun popTo(route: Route, onComplete: (isSuccess: Boolean) -> Unit) {
/* no-op */
}
override fun clear(onComplete: (isSuccess: Boolean) -> Unit) {
/* no-op */
}
}

View file

@ -6,7 +6,6 @@ import com.tangem.core.analytics.models.AnalyticsParam
import com.tangem.core.decompose.di.ComponentScoped
import com.tangem.core.decompose.navigation.Router
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.navigation.AppScreen
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.isNullOrEmpty
import com.tangem.core.ui.extensions.resourceReference
@ -22,7 +21,6 @@ import com.tangem.domain.wallets.usecase.GenerateWalletNameUseCase
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
import com.tangem.domain.wallets.usecase.SelectWalletUseCase
import com.tangem.features.details.impl.R
import com.tangem.features.details.routing.DetailsRoute
import javax.inject.Inject
@ComponentScoped
@ -44,7 +42,7 @@ internal class UserWalletSaver @Inject constructor(
saveWallet(userWallet)
router.popTo(DetailsRoute.Screen(AppScreen.Wallet))
// router.popTo(DetailsRoute.Screen(AppScreen.Wallet))
},
recover = { error ->
val message = error.message
@ -77,7 +75,7 @@ internal class UserWalletSaver @Inject constructor(
selectWalletUseCase(userWallet.walletId).bind()
}
router.popTo(DetailsRoute.Screen(AppScreen.Wallet))
// router.popTo(DetailsRoute.Screen(AppScreen.Wallet))
}
private suspend fun Raise<Error>.createUserWallet(response: ScanResponse): UserWallet {