Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-01 14:35:52 +05:00
parent 45cf551d3f
commit 9ebfdb5b31
23 changed files with 379 additions and 89 deletions

View file

@ -1,7 +1,9 @@
package com.tangem.features.createwalletselection
import com.tangem.common.routing.AppRoute
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.model.Model
import com.tangem.core.decompose.navigation.Router
import com.tangem.features.createwalletselection.entity.CreateWalletSelectionUM
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.flow.MutableStateFlow
@ -11,12 +13,13 @@ import javax.inject.Inject
@ModelScoped
internal class CreateWalletSelectionModel @Inject constructor(
override val dispatchers: CoroutineDispatcherProvider,
private val router: Router,
) : Model() {
internal val uiState: StateFlow<CreateWalletSelectionUM>
field = MutableStateFlow(
CreateWalletSelectionUM(
onBackClick = { /* [REDACTED_TODO_COMMENT] */ },
onBackClick = { router.pop() },
onMobileWalletClick = ::onMobileWalletClick,
onHardwareWalletClick = ::onHardwareWalletClick,
onScanClick = ::onScanClick,
@ -24,7 +27,7 @@ internal class CreateWalletSelectionModel @Inject constructor(
)
private fun onMobileWalletClick() {
// TODO navigate to mobile wallet creation
router.push(AppRoute.CreateMobileWallet)
}
private fun onHardwareWalletClick() {

View file

@ -1,6 +1,9 @@
package com.tangem.features.createwalletselection
package com.tangem.features.createwalletselection.di
import com.tangem.core.decompose.model.Model
import com.tangem.features.createwalletselection.CreateWalletSelectionComponent
import com.tangem.features.createwalletselection.CreateWalletSelectionModel
import com.tangem.features.createwalletselection.DefaultCreateWalletSelectionComponent
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
@ -11,11 +14,11 @@ import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
internal object CreateWalletSelectionFeatureModule
internal object CreateWalletSelectionModule
@Module
@InstallIn(SingletonComponent::class)
internal interface CreateWalletSelectionFeatureModuleBinds {
internal interface CreateWalletSelectionModuleBinds {
@Binds
@Singleton

View file

@ -2,6 +2,7 @@ package com.tangem.features.createwalletselection.entity
internal data class CreateWalletSelectionUM(
val isScanInProgress: Boolean = false,
val hardwareWalletPrice: String = "$54.90",
val onBackClick: () -> Unit,
val onMobileWalletClick: () -> Unit,
val onHardwareWalletClick: () -> Unit,

View file

@ -8,6 +8,7 @@ import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@ -17,6 +18,7 @@ import com.tangem.core.ui.components.buttons.common.TangemButton
import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition
import com.tangem.core.ui.components.buttons.common.TangemButtonSize
import com.tangem.core.ui.components.buttons.common.TangemButtonsDefaults
import com.tangem.core.ui.extensions.stringResourceSafe
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.features.createwalletselection.entity.CreateWalletSelectionUM
@ -27,13 +29,13 @@ import com.tangem.features.createwalletselection.impl.R
@Composable
internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifier: Modifier = Modifier) {
Column(
modifier = Modifier
modifier = modifier
.background(TangemTheme.colors.background.primary)
.fillMaxSize()
.systemBarsPadding(),
) {
TopAppBar(
modifier = modifier
modifier = Modifier
.statusBarsPadding(),
colors = TopAppBarDefaults.topAppBarColors(
containerColor = TangemTheme.colors.background.primary,
@ -52,8 +54,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
Text(
modifier = Modifier
.padding(16.dp),
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "What to choose?",
text = stringResourceSafe(R.string.wallet_create_nav_info_title),
style = TangemTheme.typography.body1,
color = TangemTheme.colors.text.primary1,
maxLines = 1,
@ -74,8 +75,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Choose how you want to create your wallet",
text = stringResourceSafe(R.string.wallet_create_title),
style = TangemTheme.typography.h2,
color = TangemTheme.colors.text.primary1,
textAlign = TextAlign.Center,
@ -83,10 +83,8 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
WalletBlock(
modifier = Modifier
.padding(top = 24.dp),
// TODO [REDACTED_TASK_KEY] update and extract this string
title = "Mobile Wallet",
// TODO [REDACTED_TASK_KEY] update and extract this string
description = "A secure wallet is created on your phone in seconds.",
title = stringResourceSafe(R.string.wallet_create_mobile_title),
description = stringResourceSafe(R.string.wallet_create_mobile_description),
badge = {
Box(
modifier = Modifier
@ -97,8 +95,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
.padding(horizontal = 8.dp, vertical = 4.dp),
) {
Text(
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Free",
text = stringResourceSafe(R.string.common_free),
style = TangemTheme.typography.caption1,
color = TangemTheme.colors.text.secondary,
)
@ -107,10 +104,8 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
onClick = state.onMobileWalletClick,
)
WalletBlock(
// TODO [REDACTED_TASK_KEY] update and extract this string
title = "Hardware Wallet",
// TODO [REDACTED_TASK_KEY] update and extract this string
description = "Buy Tangem Wallet — physical cards that securely store your crypto offline.",
title = stringResourceSafe(R.string.wallet_create_hardware_title),
description = stringResourceSafe(R.string.wallet_create_hardware_description),
badge = {
Box(
modifier = Modifier
@ -121,8 +116,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
.padding(horizontal = 8.dp, vertical = 4.dp),
) {
Text(
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "From $54.90",
text = stringResourceSafe(R.string.wallet_create_hardware_badge, state.hardwareWalletPrice),
style = TangemTheme.typography.caption1,
color = TangemTheme.colors.text.accent,
)
@ -150,12 +144,13 @@ private fun WalletBlock(
modifier = modifier
.fillMaxWidth()
.padding(top = 8.dp)
.clip(TangemTheme.shapes.roundedCornersXMedium)
.background(
color = TangemTheme.colors.background.secondary,
shape = TangemTheme.shapes.roundedCornersXMedium,
)
.padding(16.dp)
.clickable(onClick = onClick),
.clickable(onClick = onClick)
.padding(16.dp),
) {
Row {
Text(
@ -202,16 +197,14 @@ private fun AlreadyHaveTangemWalletBlock(
modifier = Modifier
.weight(1f)
.padding(end = 16.dp),
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Do you already have Tangem Wallet?",
text = stringResourceSafe(R.string.wallet_create_scan_question),
style = TangemTheme.typography.button,
color = TangemTheme.colors.text.primary1,
)
TangemButton(
modifier = Modifier
.wrapContentWidth(),
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Scan Now",
text = stringResourceSafe(R.string.wallet_create_scan_title),
onClick = onScanClick,
icon = TangemButtonIconPosition.End(iconResId = R.drawable.ic_tangem_24),
size = TangemButtonSize.RoundedAction,