Updated on 2026-08-14
This commit is contained in:
commit
e0eafb4df9
4 changed files with 5 additions and 15 deletions
|
|
@ -54,7 +54,6 @@ private fun Content(screen: SeedPhraseScreen, uiState: OnboardingSeedPhraseState
|
|||
state = uiState.introState,
|
||||
)
|
||||
}
|
||||
|
||||
SeedPhraseScreen.AboutSeedPhrase -> {
|
||||
AboutSeedPhraseScreen(
|
||||
state = uiState.aboutState,
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ internal class DefaultSeedPhraseInteractor constructor(
|
|||
}
|
||||
|
||||
private fun MnemonicErrorResult.mapToError(): SeedPhraseError = when (this) {
|
||||
MnemonicErrorResult.InvalidWordCount -> SeedPhraseError.InvalidEntropyLength
|
||||
MnemonicErrorResult.InvalidWordCount -> SeedPhraseError.InvalidWordCount
|
||||
MnemonicErrorResult.InvalidEntropyLength -> SeedPhraseError.InvalidEntropyLength
|
||||
MnemonicErrorResult.InvalidWordsFile -> SeedPhraseError.InvalidWordsFile
|
||||
MnemonicErrorResult.InvalidChecksum -> SeedPhraseError.InvalidChecksum
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class SeedPhraseErrorConverter : ModuleMessageConverter<Pair<Context, SeedPhrase
|
|||
val (context, message) = source
|
||||
|
||||
val convertedMessage = when (message) {
|
||||
SeedPhraseError.InvalidEntropyLength -> {
|
||||
SeedPhraseError.InvalidChecksum -> {
|
||||
context.getString(R.string.onboarding_seed_mnemonic_invalid_checksum)
|
||||
}
|
||||
is SeedPhraseError.InvalidWords -> {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
|
|
@ -67,7 +66,6 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
)
|
||||
|
||||
private val textFieldsDebouncers = mutableMapOf<String, Debouncer>()
|
||||
private var suggestionWordInserted: AtomicBoolean = AtomicBoolean(false)
|
||||
|
||||
private var generatedMnemonicComponents: List<String>? = null
|
||||
private var importedMnemonicComponents: List<String>? = null
|
||||
|
|
@ -197,19 +195,14 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
|
||||
val debouncer = createOrGetDebouncer(MNEMONIC_DEBOUNCER)
|
||||
when {
|
||||
suggestionWordInserted.getAndSet(false) -> {
|
||||
debouncer.debounce(viewModelScope, MNEMONIC_DEBOUNCE_DELAY, dispatchers.single) {
|
||||
validateMnemonic(inputMnemonic)
|
||||
}
|
||||
}
|
||||
isSameText && !isCursorMoved -> {
|
||||
// do nothing
|
||||
}
|
||||
isSameText && isCursorMoved -> {
|
||||
debouncer.debounce(viewModelScope, MNEMONIC_DEBOUNCE_DELAY, dispatchers.single) {
|
||||
updateSuggestions(fieldState)
|
||||
}
|
||||
}
|
||||
isSameText && !isCursorMoved -> {
|
||||
// do nothing
|
||||
}
|
||||
else -> {
|
||||
debouncer.debounce(viewModelScope, MNEMONIC_DEBOUNCE_DELAY, dispatchers.single) {
|
||||
updateSuggestions(fieldState)
|
||||
|
|
@ -243,7 +236,6 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
is SeedPhraseError.InvalidWords -> {
|
||||
uiBuilder.importSeedPhrase.updateInvalidWords(uiState, error.words)
|
||||
}
|
||||
|
||||
else -> uiState
|
||||
}
|
||||
updateUi { uiBuilder.importSeedPhrase.updateError(mediateState, error) }
|
||||
|
|
@ -366,7 +358,6 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
|
||||
private fun buttonSuggestedPhraseClick(suggestionIndex: Int) {
|
||||
viewModelScope.launchSingle {
|
||||
suggestionWordInserted.set(true)
|
||||
val textFieldValue = uiState.importSeedPhraseState.tvSeedPhrase.textFieldValue
|
||||
val word = uiState.importSeedPhraseState.suggestionsList[suggestionIndex]
|
||||
val cursorPosition = textFieldValue.selection.end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue