Skip to content

Conversation

@SeniorZhai
Copy link
Member

No description provided.

Copy link
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 updates error messages for the trading/swap functionality to provide clearer and more user-friendly feedback. It refines existing error strings by splitting them into detailed and non-detailed variants, and removes the limit order suggestion text from base error messages while adding it to new detailed variants. The PR also cleans up several unused imports.

Changes:

  • Refined error messages for swap/quote errors with clearer language (e.g., "No quotes available" instead of "No quote available")
  • Added detailed error message variants that include limit order suggestions for specific error scenarios
  • Introduced parameter formatting for error_invalid_quote_amount_detailed to display maximum allowable amount dynamically
  • Removed unused imports from Kotlin files (RefreshOrdersJob, R, isWatch, OrderState, size)

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/src/main/res/values/strings.xml Updated error messages with clearer wording and added detailed variants with limit order suggestions
app/src/main/res/values-zh-rCN/strings.xml Chinese translations of the updated error messages
app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapContent.kt Enhanced error handling logic to use detailed error messages based on context, added quoteMax parameter for dynamic formatting
app/src/main/java/one/mixin/android/ui/home/web3/trade/TradeFragment.kt Removed unused RefreshOrdersJob import
app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapViewModel.kt Removed unused R and isWatch imports
app/src/main/java/one/mixin/android/ui/home/web3/trade/OrderDetailFragment.kt Removed unused OrderState import
app/src/main/java/one/mixin/android/ui/home/web3/trade/LimitOrderContent.kt Removed unused size import

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

Comment on lines +444 to +447
context.getString(R.string.error_no_quote_detailed)
}
ErrorHandler.INVALID_SWAP -> {
context.getString(R.string.error_trading_pair_not_supported_detailed)
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

Error code mapping is incorrect. ErrorHandler.NO_AVAILABLE_QUOTE (error code 10615) is being mapped to error_no_quote_detailed which has error code 10611, and ErrorHandler.INVALID_SWAP (error code 10611) is being mapped to error_trading_pair_not_supported_detailed which has error code 10615. The error codes in the displayed messages will not match the actual error codes, confusing users and support teams. The mappings should be swapped: NO_AVAILABLE_QUOTE should map to error_trading_pair_not_supported_detailed (both 10615) and INVALID_SWAP should map to error_no_quote_detailed (both 10611).

Suggested change
context.getString(R.string.error_no_quote_detailed)
}
ErrorHandler.INVALID_SWAP -> {
context.getString(R.string.error_trading_pair_not_supported_detailed)
context.getString(R.string.error_trading_pair_not_supported_detailed)
}
ErrorHandler.INVALID_SWAP -> {
context.getString(R.string.error_no_quote_detailed)

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.

2 participants