Skip to content

fix(wallet): refresh perps positions on home#6468

Merged
crossle merged 2 commits into
masterfrom
fix/refresh-wallet-perps-positions
Jun 25, 2026
Merged

fix(wallet): refresh perps positions on home#6468
crossle merged 2 commits into
masterfrom
fix/refresh-wallet-perps-positions

Conversation

@SeniorZhai

@SeniorZhai SeniorZhai commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • refresh wallet home perps positions while the privacy wallet home is visible
  • stop the refresh loop when the wallet home is hidden or paused

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a periodic refresh loop for Perps positions while the Privacy wallet home is visible, and ensures the loop is stopped when the wallet UI is hidden or paused.

Changes:

  • Start a 3s refresh loop for Perps positions when WalletHomePrivacyFragment is resumed/visible.
  • Stop the refresh loop when the privacy wallet home is hidden, paused, or its view is destroyed.
  • Wire WalletFragment visibility changes to start/stop the privacy wallet refresh behavior.

Reviewed changes

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

File Description
app/src/main/java/one/mixin/android/ui/wallet/WalletHomePrivacyFragment.kt Adds coroutine-driven periodic enqueueing of RefreshPerpsPositionsJob with start/stop tied to fragment visibility/lifecycle.
app/src/main/java/one/mixin/android/ui/wallet/WalletFragment.kt Ensures the privacy wallet fragment’s refresh loop starts/stops appropriately when the parent wallet fragment is shown/hidden/resumed.

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

Comment on lines +712 to +725
private fun startPerpsPositionsRefresh() {
val walletId = Session.getAccountId().orEmpty()
if (walletId.isBlank() || !isResumed || isHidden) {
stopPerpsPositionsRefresh()
return
}
if (perpsPositionsRefreshJob?.isActive == true) return
perpsPositionsRefreshJob = lifecycleScope.launch {
while (isActive) {
jobManager.addJobInBackground(RefreshPerpsPositionsJob(walletId))
delay(PERPS_POSITION_REFRESH_INTERVAL_MS)
}
}
}
@crossle crossle merged commit 0b6e62c into master Jun 25, 2026
1 check passed
@crossle crossle deleted the fix/refresh-wallet-perps-positions branch June 25, 2026 08:33
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