Conversation
…or-state # Conflicts: # app/src/main/java/one/mixin/android/ui/landing/MnemonicPhraseFragment.kt
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
| .padding(verticalPadding, verticalPadding) | |
| .padding(horizontalPadding, verticalPadding) |
| fontSize = 13.sp, | ||
| ) { | ||
| onSetPriceMultiplier(displayPriceMultiplier(1.2f, isPriceInverted)) | ||
| } |
There was a problem hiding this comment.
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.
| } | |
| } | |
| 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() | |
| } |
| InputAction( | ||
| text = "market", | ||
| modifier = Modifier.widthIn(min = buttonWidth), | ||
| showBorder = true, | ||
| horizontalPadding = 14.dp, | ||
| verticalPadding = 6.dp, | ||
| fontSize = 13.sp, | ||
| ) { | ||
| onSetPriceMultiplier(1.0f) | ||
| onMarketPriceClick?.invoke() | ||
| } |
There was a problem hiding this comment.
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.
| 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( |
There was a problem hiding this comment.
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.
No description provided.