Skip to content

Fix/clear retry error state#6257

Open
SeniorZhai wants to merge 8 commits intomasterfrom
fix/clear-retry-error-state
Open

Fix/clear retry error state#6257
SeniorZhai wants to merge 8 commits intomasterfrom
fix/clear-retry-error-state

Conversation

@SeniorZhai
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to clear stale error state when users retry sensitive flows (PIN entry / captcha / resend), and also adjusts Web3 limit-order “floating actions” UI behavior.

Changes:

  • Clear transfer-related error state before showing the PIN bottom sheet across multiple transfer bottom sheets.
  • Reset errorInfo / state back to “Creating” when re-attempting mnemonic phrase flows and captcha flows.
  • Refactor Web3 floating action buttons (InputAction params + PRICE actions layout/labels) and adjust LimitOrderContent call sites.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
app/src/main/java/one/mixin/android/ui/wallet/transfer/TransferInvoiceBottomSheetDialogFragment.kt Clear transferViewModel.errorMessage before PIN retry.
app/src/main/java/one/mixin/android/ui/wallet/transfer/TransferBottomSheetDialogFragment.kt Clear transferViewModel.errorMessage before PIN retry.
app/src/main/java/one/mixin/android/ui/wallet/SwapTransferBottomSheetDialogFragment.kt Clear errorInfo before PIN retry.
app/src/main/java/one/mixin/android/ui/wallet/LimitTransferBottomSheetDialogFragment.kt Clear errorInfo before PIN retry.
app/src/main/java/one/mixin/android/ui/landing/MnemonicPhraseFragment.kt Clear errorInfo and reset UI state during retry / captcha flows.
app/src/main/java/one/mixin/android/ui/home/web3/trade/LimitOrderContent.kt Update FloatingActions call due to signature changes.
app/src/main/java/one/mixin/android/ui/home/web3/components/InputAction.kt Add modifier/padding/font-size customization and min-height.
app/src/main/java/one/mixin/android/ui/home/web3/components/FloatingActions.kt Rework PRICE actions row (scrolling layout, button sizing, label changes) and remove token-based logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
.padding(6.dp, 6.dp)
.defaultMinSize(minHeight = 32.dp)
.padding(verticalPadding, verticalPadding)
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the showBorder = false branch, padding is applied as .padding(verticalPadding, verticalPadding), which ignores the horizontalPadding parameter and also makes the horizontal padding equal to the vertical padding. This looks accidental given the bordered branch uses (horizontalPadding, verticalPadding); consider using the same horizontal/vertical parameters (or add a separate horizontalPaddingNoBorder) so call sites can control spacing consistently.

Suggested change
.padding(verticalPadding, verticalPadding)
.padding(horizontalPadding, verticalPadding)

Copilot uses AI. Check for mistakes.
fontSize = 13.sp,
) {
onSetPriceMultiplier(displayPriceMultiplier(1.2f, isPriceInverted))
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FocusedField.PRICE no longer renders the "Done" action, so onDone() is never callable from this footer when editing the price (it’s still available for amount fields). In LimitOrderContent the onDone callback hides the keyboard and clears focus; without a Done button here, users may have no in-UI way to dismiss the footer/keyboard. Consider re-adding a Done action (e.g., as the last item in the scroll row or as a fixed trailing button) and invoking onDone() from it.

Suggested change
}
}
Spacer(modifier = Modifier.width(buttonSpacing))
InputAction(
text = "Done",
modifier = Modifier.widthIn(min = buttonWidth),
showBorder = true,
horizontalPadding = 14.dp,
verticalPadding = 6.dp,
fontSize = 13.sp,
) {
onDone()
}

Copilot uses AI. Check for mistakes.
Comment on lines +112 to +122
InputAction(
text = "market",
modifier = Modifier.widthIn(min = buttonWidth),
showBorder = true,
horizontalPadding = 14.dp,
verticalPadding = 6.dp,
fontSize = 13.sp,
) {
onSetPriceMultiplier(1.0f)
onMarketPriceClick?.invoke()
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PRICE actions include a hard-coded label text = "market" instead of a localized string (previously stringResource(R.string.market_price) was used). This will bypass localization and also changes capitalization. Consider switching to stringResource(...) for this label (and any other user-facing strings here) to keep the UI translatable and consistent.

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +90
FocusedField.PRICE -> {
Row(
BoxWithConstraints(
modifier = Modifier
.fillMaxWidth()
.background(MixinAppTheme.colors.backgroundWindow)
.padding(horizontal = 12.dp, vertical = 8.dp),
horizontalArrangement = Arrangement.SpaceBetween,
) {
InputAction(stringResource(R.string.market_price), showBorder = true) {
onSetPriceMultiplier(1.0f)
onMarketPriceClick?.invoke()
}
val buttonSpacing = 3.dp
val minButtonWidth = 72.dp
val availableWidth = maxWidth - 16.dp
val calculatedButtonWidth = (availableWidth - buttonSpacing * 4) / 5
val buttonWidth = if (calculatedButtonWidth > minButtonWidth) calculatedButtonWidth else minButtonWidth

val isFromUsd = fromToken?.assetId?.let { id ->
Constants.AssetId.usdtAssets.containsKey(id) || Constants.AssetId.usdcAssets.containsKey(id)
} == true
val isToUsd = toToken?.assetId?.let { id ->
Constants.AssetId.usdtAssets.containsKey(id) || Constants.AssetId.usdcAssets.containsKey(id)
} == true

if (isToUsd && !isFromUsd) {
InputAction("+10%", showBorder = true) {
onSetPriceMultiplier(displayPriceMultiplier(1.1f, isPriceInverted))
}
InputAction("+20%", showBorder = true) {
onSetPriceMultiplier(displayPriceMultiplier(1.2f, isPriceInverted))
Row(
modifier = Modifier
.fillMaxWidth()
.horizontalScroll(rememberScrollState())
.padding(horizontal = 8.dp, vertical = 8.dp),
horizontalArrangement = Arrangement.Start,
) {
InputAction(
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title suggests this change is about clearing retry error state, but this file also includes a fairly substantial redesign of the PRICE floating action row (scrolling layout, new sizing logic, different labels, and removal of token-based behavior). Consider splitting the FloatingActions/InputAction UI refactor into a separate PR so the error-state fix can be reviewed and reverted independently if needed.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants