Skip to content
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

fix: Issue with blank conversations [WPB-14276] #3624

Closed
wants to merge 2 commits into from

Conversation

m-zagorski
Copy link
Contributor

@m-zagorski m-zagorski commented Nov 13, 2024

BugWPB-14276 [Android] Conversation screen is not visible when navigating between screens

https://wearezeta.atlassian.net/browse/WPB-14276

What's new in this PR?

Issues

When we navigated between screens sometimes the conversation list was empty until we manually scrolled, also sometimes there were those weird jumps.

Causes (Optional)

Turns out out current keepOnTopWhenNotScrolled is not working properly with animating lazy items.

Solutions

Right now we're still using Snapshot.withoutReadObservation but we only use it to get current state, to make sure we're on top - without this we would end up being on the second place and not scrolling the list.
The difference is that we create a tmp state which has the flag isAtTheTop with the number of items in the list, this state is out distinction of when we should try to animate to top.
The next big difference is that we're not relying on requestScrollToItem but rather on animateScrollToItem which is a suspending function, which seems to work together with the animateItem

Testing

How to Test

  • Open navigation drawer
  • Go into settings
  • Go into account details or any other screen
  • Get back to conversations - they should be visible
    Repeat it multiple times
    Also might be worth to checkout scrolling to top:
  • Have more conversations that can fit on the screen
  • Write new message
  • Make sure New activity is properly visible and not under the search or toolbar

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.

@@ -55,7 +59,7 @@ import com.wire.kalium.logic.data.user.UserId
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.flowOf

@Suppress("LongParameterList")
@Suppress("LongParameterList", "CyclomaticComplexMethod")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we supress it? I've seen we have it around the code, but Im not sure 🤔

@@ -71,6 +75,15 @@ fun ConversationList(
onAudioPermissionPermanentlyDenied: () -> Unit = {}
) {
val context = LocalContext.current
var listScrollState by remember { mutableStateOf(false to 0) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is your take on the Pair ? I'd say its enough for our intermediate state here, but we can always change it to a dedicated data class if we need some more context

Copy link
Contributor

Built wire-android-staging-compat-pr-3624.apk is available for download

Copy link
Contributor

Built wire-android-dev-debug-pr-3624.apk is available for download

@saleniuk
Copy link
Contributor

Now the whole list disappears when you move your finger down as if to scroll up and blinks when you actually start scrolling:

Screen_recording_20241113_125357.mp4

@m-zagorski
Copy link
Contributor Author

Now the whole list disappears when you move your finger down as if to scroll up and blinks when you actually start scrolling:

Screen_recording_20241113_125357.mp4

Interesting, it indeed happens for me too when I enter the screen through conversations 🤔 I will check it out, thanks!

@m-zagorski
Copy link
Contributor Author

I quicky checked and the issue is there even without any of my changes, it started to happen after latest changes to develop where we have the deprecated fun ConversationList( - I will investigate it a little bit further

@saleniuk
Copy link
Contributor

saleniuk commented Nov 13, 2024

I quicky checked and the issue is there even without any of my changes, it started to happen after latest changes to develop where we have the deprecated fun ConversationList( - I will investigate it a little bit further

Deprecated ConversationList is for non-paginated conversation list and in this PR there are only changes in ConversationList for paginated results so it shouldn't make any difference 🤔 You can enable/disable pagination with paginated_conversation_list_enabled feature flag, but I checked that and it happens also on version from before the whole pagination, so recent changes haven't brought this, it's been there for some time already.

It looks like there are three different scenarios:

  • the full list disappears for a moment when navigating back
  • the list blinks quickly and then again blinks quickly when scrolling
  • the list doesn't blink but then it disappears when scrolling

I managed to catch all three on this video and this is the version from before the pagination, from 6 weeks ago:

Screen_recording_20241113_151711.mp4

So it looks like fixing the first one makes it so that the other two happen more frequently.

There were some issues with transition animation and disappearing list and it was related to HomeStateHolder so maybe that's a good place to look for the source of these issues as well 🤔

@saleniuk
Copy link
Contributor

I investigated that, since I was the one making changes (and bugs 😅) to it recently, and found out that the issue is with the usage of LazyListState, I provided explanation and my version of fix here: #3627

@m-zagorski m-zagorski closed this Nov 14, 2024
@m-zagorski m-zagorski deleted the fix/blank-conversations-page branch November 14, 2024 06:23
@echoes-hq echoes-hq bot added the echoes: product-roadmap/bug Work contributing to resolve a bug not critical enough to have raised an incident. label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap/bug Work contributing to resolve a bug not critical enough to have raised an incident. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants