Skip to content

feat(trade): replace swap recommendations with categorized list - #6868

Open
SeniorZhai wants to merge 8 commits into
masterfrom
feat/swap-recommended-market-list
Open

SeniorZhai wants to merge 8 commits into
masterfrom
feat/swap-recommended-market-list

Conversation

@SeniorZhai

Copy link
Copy Markdown
Member

No description provided.

@gaotic

gaotic Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

AI review done for 05beafb in 2m 16s · 1 comment

Quality: Needs a fix before merge. A standalone Kotlin check reproduced the remaining regression, and the latest merge introduced no additional PR-specific defects.

Role Model Status
Reviewer Codex codex/gpt-6.2-sol · effort high ok

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review · Codex (Grok failed) · f91078f

Needs a fix before merge: autofocus is retriggered when the amount field scrolls back into view. git diff --check on the PR range passed. Unit tests were not run because the Gradle distribution is unavailable here.

text = inputText,
title = stringResource(id = R.string.swap_send),
readOnly = false,
autoFocus = autoFocus,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Scrolling away from the amount field and back reopens the keyboard and hides the recommendations.

TradeLayout is now the trade_layout lazy item, and each market row is its own item, so the amount field is disposed once it leaves the viewport. autoFocus stays true for the whole screen: TradeFragment.shouldAutoFocusAmount() sets it when Simple Trade opens with an input or output asset, and observeTradeMarketSelection() sets it again when a market is picked. Nothing clears it. On the next composition, InputContent's LaunchedEffect(autoFocus) in InputTextField.kt calls requestFocus() and keyboardController.show(). onFocusChanged then sets isSendFocused, and shouldShowSwapRecommendedMarketCards drops the list because the field is focused or the keyboard is visible.

Treat autofocus as one-shot in state that survives disposal of this item (SwapContent, or autoFocusAmount on TradeFragment). Clear it after the first focus request, and set it again only for an explicit action such as selecting a market.

…ed-market-list

# Conflicts:
#	app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapContent.kt

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review · GPT + Grok · 56cd75d

No confirmed regressions in the changes since the previous review. Whitespace checks passed for both diff ranges. Compilation and trade unit tests were blocked during Gradle setup by the unavailable wrapper distribution and an uncached Foojay plugin in the offline fallback.

…ed-market-list

# Conflicts:
#	app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapContent.kt
#	app/src/main/java/one/mixin/android/ui/home/web3/trade/SwapRecommendedMarketCards.kt

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review · Codex · d92145c

Whitespace checks passed for both diff ranges. Android compilation and the targeted unit tests were blocked during Gradle setup because the wrapper distribution was unavailable and the Foojay plugin was missing from the offline cache.


val spotTrending = MarketPageMapper
.spotMarkets(markets = trendingMarkets, fallbackMarkets = allMarkets)
.filter { market -> market.coinId !in stockCoinIds }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Swap drops stocks from Trending, Top Gainers, and Top Losers even when the shared category feed returns them. Market now preserves those entries after #6904, and the old Swap cards showed them too. A standalone Kotlin check reproduced a stock-only Trending feed disappearing entirely from Swap. Preserve the feed’s membership in these tabs while keeping the dedicated Stocks tab.

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review · Codex · 05beafb

The latest commit only merges the Perps guide from master, so the previous finding still applies. Both diff whitespace checks passed. Android compilation and the targeted unit tests were blocked because the Foojay Gradle plugin was unavailable offline.


val spotTrending = MarketPageMapper
.spotMarkets(markets = trendingMarkets, fallbackMarkets = allMarkets)
.filter { market -> market.coinId !in stockCoinIds }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This still removes stocks from Trending, Top Gainers, and Top Losers even when the shared feed includes them. A standalone Kotlin check against this head showed that stock-only feeds leave Swap with just the Stocks tab. Preserve the feed membership in those three tabs while keeping the dedicated Stocks tab.

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