Updated on 2026-08-14

This commit is contained in:
Tangem 2025-06-24 22:39:17 +05:00
parent 1cecd561dc
commit 64626bbcbc
8 changed files with 274 additions and 11 deletions

View file

@ -6,6 +6,7 @@ import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.features.createwalletselection.ui.CreateWalletSelectionContent
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject

View file

@ -1,4 +1,4 @@
package com.tangem.features.createwalletselection
package com.tangem.features.createwalletselection.ui
import android.content.res.Configuration
import androidx.compose.foundation.background
@ -52,7 +52,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
Text(
modifier = Modifier
.padding(16.dp),
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "What to choose?",
style = TangemTheme.typography.body1,
color = TangemTheme.colors.text.primary1,
@ -74,7 +74,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Choose how you want to create your wallet",
style = TangemTheme.typography.h2,
color = TangemTheme.colors.text.primary1,
@ -83,9 +83,9 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
WalletBlock(
modifier = Modifier
.padding(top = 24.dp),
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
title = "Mobile Wallet",
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
description = "A secure wallet is created on your phone in seconds.",
badge = {
Box(
@ -97,7 +97,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
.padding(horizontal = 8.dp, vertical = 4.dp),
) {
Text(
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Free",
style = TangemTheme.typography.caption1,
color = TangemTheme.colors.text.secondary,
@ -107,9 +107,9 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
onClick = state.onMobileWalletClick,
)
WalletBlock(
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
title = "Hardware Wallet",
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
description = "Buy Tangem Wallet — physical cards that securely store your crypto offline.",
badge = {
Box(
@ -121,7 +121,7 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi
.padding(horizontal = 8.dp, vertical = 4.dp),
) {
Text(
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "From $54.90",
style = TangemTheme.typography.caption1,
color = TangemTheme.colors.text.accent,
@ -201,7 +201,7 @@ private fun AlreadyHaveTangemWalletBlock(
modifier = Modifier
.weight(1f)
.padding(end = 16.dp),
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Do you already have Tangem Wallet?",
style = TangemTheme.typography.button,
color = TangemTheme.colors.text.primary1,
@ -209,7 +209,7 @@ private fun AlreadyHaveTangemWalletBlock(
TangemButton(
modifier = Modifier
.wrapContentWidth(),
// TODO update and extract this string
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Scan Now",
onClick = onScanClick,
icon = TangemButtonIconPosition.End(iconResId = R.drawable.ic_tangem_24),

View file

@ -0,0 +1,8 @@
package com.tangem.features.hotwallet
import com.tangem.core.decompose.factory.ComponentFactory
import com.tangem.core.ui.decompose.ComposableContentComponent
interface CreateMobileWalletComponent : ComposableContentComponent {
interface Factory : ComponentFactory<Unit, CreateMobileWalletComponent>
}

View file

@ -0,0 +1,27 @@
package com.tangem.features.hotwallet.createmobilewallet
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.model.Model
import com.tangem.features.hotwallet.createmobilewallet.entity.CreateMobileWalletUM
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import javax.inject.Inject
@ModelScoped
internal class CreateMobileWalletModel @Inject constructor(
override val dispatchers: CoroutineDispatcherProvider,
) : Model() {
internal val uiState: StateFlow<CreateMobileWalletUM>
field = MutableStateFlow(
CreateMobileWalletUM(
onBackClick = { /* [REDACTED_TODO_COMMENT] */ },
onCreateClick = ::onCreateClick,
),
)
private fun onCreateClick() {
// TODO create a wallet
}
}

View file

@ -0,0 +1,34 @@
package com.tangem.features.hotwallet.createmobilewallet
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.features.hotwallet.CreateMobileWalletComponent
import com.tangem.features.hotwallet.createmobilewallet.ui.CreateMobileWalletContent
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
internal class DefaultCreateMobileWalletComponent @AssistedInject constructor(
@Assisted private val context: AppComponentContext,
@Assisted private val params: Unit,
) : CreateMobileWalletComponent, AppComponentContext by context {
private val model: CreateMobileWalletModel = getOrCreateModel(params)
@Composable
override fun Content(modifier: Modifier) {
val state by model.uiState.collectAsStateWithLifecycle()
CreateMobileWalletContent(
state = state,
modifier = modifier,
)
}
@AssistedFactory
interface Factory : CreateMobileWalletComponent.Factory {
override fun create(context: AppComponentContext, params: Unit): DefaultCreateMobileWalletComponent
}
}

View file

@ -0,0 +1,6 @@
package com.tangem.features.hotwallet.createmobilewallet.entity
internal data class CreateMobileWalletUM(
val onBackClick: () -> Unit,
val onCreateClick: () -> Unit,
)

View file

@ -0,0 +1,144 @@
package com.tangem.features.hotwallet.createmobilewallet.ui
import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.R
import com.tangem.core.ui.components.PrimaryButton
import com.tangem.core.ui.components.appbar.TangemTopAppBar
import com.tangem.core.ui.components.appbar.models.TopAppBarButtonUM
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.features.hotwallet.createmobilewallet.entity.CreateMobileWalletUM
@Suppress("LongMethod")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun CreateMobileWalletContent(state: CreateMobileWalletUM, modifier: Modifier = Modifier) {
Column(
modifier = Modifier
.background(TangemTheme.colors.background.primary)
.fillMaxSize()
.systemBarsPadding(),
) {
TangemTopAppBar(
modifier = modifier
.statusBarsPadding(),
startButton = TopAppBarButtonUM.Back(state.onBackClick),
title = TextReference.EMPTY,
)
Column(
modifier = Modifier
.weight(1f)
.padding(
start = 16.dp,
top = 24.dp,
end = 16.dp,
),
) {
Icon(
modifier = Modifier
.fillMaxWidth(),
painter = painterResource(R.drawable.ic_create_mobile_wallet_56),
contentDescription = null,
tint = TangemTheme.colors.icon.informative,
)
Text(
modifier = Modifier
.fillMaxWidth()
.padding(
start = 16.dp,
top = 20.dp,
end = 16.dp,
),
// TODO [REDACTED_TASK_KEY] update and extract this string
text = "Create Mobile Wallet",
style = TangemTheme.typography.h2,
color = TangemTheme.colors.text.primary1,
textAlign = TextAlign.Center,
)
FeatureBlock(
modifier = Modifier
.padding(top = 32.dp),
// TODO [REDACTED_TASK_KEY] update and extract this string
title = "Keys are stored in the app",
// TODO [REDACTED_TASK_KEY] update and extract this string
description = "Get notified of incoming transactions",
iconRes = R.drawable.ic_lock_24,
)
FeatureBlock(
modifier = Modifier
.padding(top = 24.dp),
// TODO [REDACTED_TASK_KEY] update and extract this string
title = "Seed phrase backup",
// TODO [REDACTED_TASK_KEY] update and extract this string
description = "Stay up to date with the latest features and news",
iconRes = R.drawable.ic_settings_24,
)
}
PrimaryButton(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
text = "Create",
showProgress = false,
enabled = true,
onClick = state.onCreateClick,
)
}
}
@Composable
private fun FeatureBlock(title: String, description: String, iconRes: Int, modifier: Modifier = Modifier) {
Row(
modifier = modifier,
) {
Icon(
modifier = Modifier
.padding(horizontal = 12.dp),
painter = painterResource(iconRes),
contentDescription = null,
tint = TangemTheme.colors.icon.primary1,
)
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp),
) {
Text(
text = title,
style = TangemTheme.typography.subtitle1,
color = TangemTheme.colors.text.primary1,
)
Text(
modifier = Modifier
.padding(top = 4.dp),
text = description,
style = TangemTheme.typography.body2,
color = TangemTheme.colors.text.secondary,
)
}
}
}
@Preview(showBackground = true, widthDp = 360)
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun PreviewCreateWalletContent() {
TangemThemePreview {
CreateMobileWalletContent(
state = CreateMobileWalletUM(
onBackClick = {},
onCreateClick = {},
),
)
}
}