Skip to content

fix: Flickering when opening conversation details (WPB-19187) #4167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

ohassine
Copy link
Member

@ohassine ohassine commented Aug 7, 2025

BugWPB-19187 [Android] Cells - Flickering when we open conversation details


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Screen is flickering when opening conversation details

Causes (Optional)

Fetching data from data source, which lead to show the UI the default value. and once the data is retrieved, UI gets updated again

Solutions

Add a skeleton UI to be shown while we fetch data

Before After
screen-20250807-162726.mp4
Screen_recording_20250807_145214.webm

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@ohassine ohassine requested review from sbakhtiarov and saleniuk and removed request for sbakhtiarov August 7, 2025 14:53
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.83%. Comparing base (fee8b7e) to head (8950947).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4167      +/-   ##
===========================================
+ Coverage    47.81%   47.83%   +0.01%     
===========================================
  Files          507      507              
  Lines        17336    17340       +4     
  Branches      2847     2847              
===========================================
+ Hits          8290     8294       +4     
  Misses        8190     8190              
  Partials       856      856              
Files with missing lines Coverage Δ
...tions/details/GroupConversationDetailsViewModel.kt 76.62% <100.00%> (+0.46%) ⬆️
...s/details/options/GroupConversationOptionsState.kt 94.28% <100.00%> (+0.16%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fee8b7e...8950947. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +383 to +402
AnimatedVisibility(
visible = isScreenLoading.collectAsState().value,
enter = fadeIn(),
exit = fadeOut()
) {
LoadingGroupConversationDetailsTopBarCollapsing(
modifier = Modifier.padding(bottom = MaterialTheme.wireDimensions.spacing16x)
)
}

AnimatedVisibility(
visible = !isScreenLoading.collectAsState().value,
enter = fadeIn(
animationSpec = tween(
durationMillis = 500,
delayMillis = 100
)
) + slideInVertically(initialOffsetY = { it / 2 }),
exit = fadeOut()
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having two AnimatedVisibility you can use AnimatedContent to animate changing different composables, like:

AnimatedContent(
    targetState = isScreenLoading.collectAsState().value,
    transitionSpec = {
        val enter = slideInVertically(initialOffsetY = { it })
        val exit = slideOutVertically(targetOffsetY = { it })
        enter.togetherWith(exit)
    },
) { isScreenLoading ->
     if (isScreenLoading) ...
}

You can even distinct animations for each state if it's needed:

transitionSpec = { 
        val isScreenLoading = this.targetState
        val enter = if (isScreenLoading) {
            slideInVertically(initialOffsetY = { it })
        } else {
            fadeIn(tween(durationMillis = 500, delayMillis = 100)) + slideInVertically(initialOffsetY = { it / 2 }),
        }
        val exit = fadeOut()
        enter.togetherWith(exit)
    },

@MohamadJaara
Copy link
Member

the question here why does it take some time to fetch data? is it waiting on an API call ?

@ohassine
Copy link
Member Author

the question here why does it take some time to fetch data? is it waiting on an API call ?

because we have a complex query with 11 joins, which takes at least 300ms

@ohassine ohassine requested a review from saleniuk August 11, 2025 12:08
Copy link

@MohamadJaara
Copy link
Member

the question here why does it take some time to fetch data? is it waiting on an API call ?

because we have a complex query with 11 joins, which takes at least 300ms

for getting one conversation details this is not great we can do better, lets also work on the query

Copy link
Contributor

@saleniuk saleniuk left a comment

Choose a reason for hiding this comment

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

I get your point of view about the loading shimmer composables, there's still one unresolved comment about AnimatedContent 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants