Updated on 2026-08-14
This commit is contained in:
parent
6631ad696c
commit
0c9200cf87
2 changed files with 42 additions and 8 deletions
|
|
@ -17,6 +17,7 @@ import androidx.compose.material.OutlinedTextField
|
|||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
|
|
@ -31,6 +32,7 @@ import com.tangem.feature.onboarding.presentation.wallet2.ui.components.Descript
|
|||
import com.tangem.feature.onboarding.presentation.wallet2.ui.components.OnboardingActionBlock
|
||||
import com.tangem.feature.onboarding.presentation.wallet2.ui.components.OnboardingDescriptionBlock
|
||||
import com.tangem.feature.onboarding.presentation.wallet2.viewmodel.InvalidWordsColorTransformation
|
||||
import com.tangem.feature.onboarding.presentation.wallet2.viewmodel.SeedPhraseErrorConverter
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -110,14 +112,16 @@ private fun PhraseBlock(
|
|||
.fillMaxWidth()
|
||||
.height(TangemTheme.dimens.size32),
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.fillMaxSize(),
|
||||
text = "TODO: implement error message",
|
||||
style = TangemTheme.typography.caption.copy(
|
||||
color = TangemTheme.colors.text.warning,
|
||||
),
|
||||
)
|
||||
val message = SeedPhraseErrorConverter(LocalContext.current).convert(state.error)
|
||||
if (message != null) {
|
||||
Text(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
text = message,
|
||||
style = TangemTheme.typography.caption.copy(
|
||||
color = TangemTheme.colors.text.warning,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.tangem.feature.onboarding.presentation.wallet2.viewmodel
|
||||
|
||||
import android.content.Context
|
||||
import com.tangem.common.module.ModuleMessageConverter
|
||||
import com.tangem.feature.onboarding.R
|
||||
import com.tangem.feature.onboarding.domain.SeedPhraseError
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class SeedPhraseErrorConverter(
|
||||
private val context: Context,
|
||||
) : ModuleMessageConverter<SeedPhraseError?, String?> {
|
||||
|
||||
override fun convert(message: SeedPhraseError?): String? {
|
||||
message ?: return null
|
||||
|
||||
val convertedMessage = when (message) {
|
||||
SeedPhraseError.InvalidEntropyLength -> {
|
||||
context.getString(R.string.onboarding_seed_mnemonic_invalid_checksum)
|
||||
}
|
||||
is SeedPhraseError.InvalidWords -> {
|
||||
context.getString(R.string.onboarding_seed_mnemonic_wrong_words)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
||||
return convertedMessage
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue