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

feat: conversation list pagination [WPB-9433] #3509

Merged
merged 8 commits into from
Oct 16, 2024

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Oct 15, 2024

StoryWPB-9433 [Android] Implement Pagination for Conversation Screen Data Retrieval


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

The current implementation of the conversation screen retrieves all conversation data from the database at once. This approach leads to performance issues and increased startup times, especially as the volume of data grows. To improve performance and reduce startup time, we need to implement pagination for fetching conversation data.

Solutions

Integrated changes from these two kalium PRs related to conversation list pagination:
wireapp/kalium#3055
wireapp/kalium#3059
Created new use case GetConversationsFromSearchUseCase to fetch paginated conversations and map them properly.
Added loading state for conversation list before the list is initially fetched, to not show empty content.
In view models, combined both flows of collecting search query changes and fetching results into single one to not lose ItemSnapshotList when query changes which would make the list to become empty between each query changes. This required moving searchQuery parameter to the data of each list item instead.
Removed code responsible for searching by filtering result list from view models as now searching is executed in kalium so view models should just execute use case and handle results.
Updated keepOnTopWhenNotScrolled to also work when the list might be updated without recomposition (like with pagination).

Dependencies (Optional)

Needs releases with:

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Open the app and scroll and search for conversations on all conversations list screen, archive screen or import media screen.

Attachments (Optional)

paginated_conversation.mp4

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.

…conversation-list-pagination

# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt
#	app/src/test/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModelTest.kt
Copy link

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

@echoes-hq echoes-hq bot added the echoes: maintenance Maintenance activity - Refactoring , Preventive , Improvements to code , Performance improvements label Oct 15, 2024
Copy link

sonarcloud bot commented Oct 15, 2024

@codecov-commenter
Copy link

codecov-commenter commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 64.78873% with 75 lines in your changes missing coverage. Please review.

Project coverage is 45.31%. Comparing base (7c07702) to head (b8f56df).
Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
...tlin/com/wire/android/mapper/ConversationMapper.kt 67.36% 11 Missing and 20 partials ⚠️
...id/ui/sharing/ImportMediaAuthenticatedViewModel.kt 41.02% 23 Missing ⚠️
...ome/conversationslist/ConversationListViewModel.kt 60.71% 11 Missing ⚠️
...tions/usecase/GetConversationsFromSearchUseCase.kt 85.18% 4 Missing ⚠️
...main/kotlin/com/wire/android/util/ui/ScrollUtil.kt 0.00% 4 Missing ⚠️
...home/conversationslist/model/ConversationFolder.kt 0.00% 1 Missing ⚠️
...ndroid/ui/sharing/ImportMediaAuthenticatedState.kt 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3509      +/-   ##
===========================================
+ Coverage    44.85%   45.31%   +0.45%     
===========================================
  Files          467      470       +3     
  Lines        15776    15689      -87     
  Branches      2654     2625      -29     
===========================================
+ Hits          7077     7109      +32     
+ Misses        7942     7836     -106     
+ Partials       757      744      -13     
Files with missing lines Coverage Δ
...ui/home/conversationslist/ConversationListState.kt 100.00% <100.00%> (ø)
...i/home/conversationslist/model/ConversationItem.kt 76.71% <100.00%> (+5.07%) ⬆️
...home/conversationslist/model/ConversationFolder.kt 0.00% <0.00%> (-42.86%) ⬇️
...ndroid/ui/sharing/ImportMediaAuthenticatedState.kt 87.50% <87.50%> (ø)
...tions/usecase/GetConversationsFromSearchUseCase.kt 85.18% <85.18%> (ø)
...main/kotlin/com/wire/android/util/ui/ScrollUtil.kt 0.00% <0.00%> (ø)
...ome/conversationslist/ConversationListViewModel.kt 34.00% <60.71%> (-15.84%) ⬇️
...id/ui/sharing/ImportMediaAuthenticatedViewModel.kt 33.33% <41.02%> (+33.33%) ⬆️
...tlin/com/wire/android/mapper/ConversationMapper.kt 67.36% <67.36%> (ø)

... and 1 file with indirect coverage changes


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 7c07702...b8f56df. Read the comment docs.

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

@Garzas Garzas left a comment

Choose a reason for hiding this comment

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

👏 Just one cosmetic comment

@saleniuk saleniuk added this pull request to the merge queue Oct 16, 2024
Merged via the queue into develop with commit 9984c00 Oct 16, 2024
13 checks passed
@saleniuk saleniuk deleted the feat/conversation-list-pagination branch October 16, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: maintenance Maintenance activity - Refactoring , Preventive , Improvements to code , Performance improvements size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants