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, pt1 - queries [WPB-9433] #3055

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Oct 9, 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?

In order to make conversation lists paginated, new queries and sql views are needed.
In this PR, getting ConversationDetails and unread events with last message or draft is moved to the sql view with all required tables joined, so that it can be paginated. New queries are created to be able to fetch paginated results on different screens - currently we have two different types:

  • on home we show list of all conversations with connections and different interaction types, where new activities are on top (calls, unread messages, etc.)
  • on import media screen, without connections and conversations with non-enabled interactions (deleted user, blocked, etc.)
    and to handle both, two additional parameters are added to queries and functions.
    Also, two other sql views are created which are just queries that we were already using, to make it reusable (LastMessagePreview to return only preview of last message for the conversation and UnreadEventCountsGrouped to count different unread events).

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

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.

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

sonarcloud bot commented Oct 9, 2024

Copy link
Contributor

github-actions bot commented Oct 9, 2024

Test Results

3 235 tests  +16   3 129 ✅ +16   4m 22s ⏱️ +40s
  552 suites ± 0     106 💤 ± 0 
  552 files   ± 0       0 ❌ ± 0 

Results for commit a257504. ± Comparison against base commit fc3f3e3.

This pull request removes 1 and adds 17 tests. Note that renamed tests count towards both.
com.wire.kalium.logic.data.conversation.ConversationRepositoryTest ‑ givenAGroupConversationHasNewMessages_whenObservingConversationListDetails_ThenCorrectlyGetUnreadMessageCount[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenArchivedConversationWithDraftAndLastMessage_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenConversationWithDraftAndLastMessage_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenConversationWithLastMessage_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenConversationWithNoLastMessageAndDraft_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationRepositoryTest ‑ givenAConversationHasLastMessageAndDraft_whenObservingConversationListDetails_ThenCorrectlyGetLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationRepositoryTest ‑ givenAOneToOneConversationHasNewMessages_whenObservingConversationListDetails_ThenCorrectlyGetUnreadMessageCount[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenAGroupConvWhichSelfUserLeft_whenGettingAllConversationsWithEventsAndOnlyEnabledInteractions_thenDoNotReturnIt[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenAOneOneConvWithDeletedUser_whenGettingAllConversationsWithEventsAndOnlyEnabledInteractions_thenDoNotReturnIt[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenArchiveConversationWithUnreadMessageAndDraft_whenGettingAllConversationsWithEvents_thenShouldReturnCorrectValues[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenConnectionRequest_whenGettingAllConversationsWithEventsAndOnlyEnabledInteractions_thenDoNotReturnIt[jvm]
…

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Oct 9, 2024

🐰 Bencher Report

Branchfeat/conversation-list-pagination-pt1-queries
Testbedubuntu-latest

⚠️ WARNING: The following Measure does not have a Threshold. Without a Threshold, no Alerts will ever be generated!

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds CLI flag.

Click to view all benchmark results
BenchmarkLatencynanoseconds (ns)
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInFiles📈 view plot
⚠️ NO THRESHOLD
680,704.91
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemory📈 view plot
⚠️ NO THRESHOLD
340,488,818.84
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmark📈 view plot
⚠️ NO THRESHOLD
918,046,435.96
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmark📈 view plot
⚠️ NO THRESHOLD
21,823,984.03
🐰 View full continuous benchmarking report in Bencher

@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 85.62092% with 22 lines in your changes missing coverage. Please review.

Project coverage is 52.24%. Comparing base (8e0f4a6) to head (a257504).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
...ire/kalium/logic/data/conversation/Conversation.kt 0.00% 6 Missing ⚠️
...onversation/ConversationDetailsWithEventsMapper.kt 93.68% 0 Missing and 6 partials ⚠️
...lium/logic/data/conversation/ConversationMapper.kt 70.58% 4 Missing and 1 partial ⚠️
.../logic/data/conversation/ConversationRepository.kt 60.00% 3 Missing and 1 partial ⚠️
...ersistence/dao/message/draft/MessageDraftMapper.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3055      +/-   ##
===========================================
- Coverage    52.50%   52.24%   -0.27%     
===========================================
  Files         1304     1314      +10     
  Lines        50182    50951     +769     
  Branches      4679     4724      +45     
===========================================
+ Hits         26348    26618     +270     
- Misses       21947    22438     +491     
- Partials      1887     1895       +8     
Files with missing lines Coverage Δ
.../kotlin/com/wire/kalium/logic/di/MapperProvider.kt 93.44% <100.00%> (+0.10%) ⬆️
...um/persistence/dao/conversation/ConversationDAO.kt 100.00% <100.00%> (ø)
...ersistence/dao/conversation/ConversationDAOImpl.kt 72.95% <100.00%> (+0.89%) ⬆️
...onversation/ConversationDetailsWithEventsEntity.kt 100.00% <100.00%> (ø)
...persistence/dao/conversation/ConversationMapper.kt 97.87% <ø> (-0.03%) ⬇️
...e/kalium/persistence/dao/message/MessageDAOImpl.kt 69.84% <100.00%> (ø)
...rsistence/dao/message/draft/MessageDraftDAOImpl.kt 70.00% <ø> (-4.08%) ⬇️
...ersistence/dao/message/draft/MessageDraftMapper.kt 0.00% <0.00%> (ø)
.../logic/data/conversation/ConversationRepository.kt 62.08% <60.00%> (-0.12%) ⬇️
...lium/logic/data/conversation/ConversationMapper.kt 58.84% <70.58%> (+0.44%) ⬆️
... and 2 more

... and 43 files 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 8e0f4a6...a257504. Read the comment docs.

@datadog-wireapp
Copy link

Datadog Report

Branch report: feat/conversation-list-pagination-pt1-queries
Commit report: 2cefb0b
Test service: kalium-jvm

✅ 0 Failed, 3129 Passed, 106 Skipped, 15.61s Total Time

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.

Looks nice, I would just test it with some data in db when android part will be ready 😄

@saleniuk saleniuk added this pull request to the merge queue Oct 14, 2024
Merged via the queue into develop with commit cf44646 Oct 14, 2024
22 checks passed
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 🚨 Potential breaking changes 👕 size: XXL type: feature ✨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants