feat: Add Jetpack Paging 3 support for messages and threads/contacts#3795
Merged
Conversation
jamesarich
approved these changes
Nov 23, 2025
Collaborator
|
looks good to go when cleaned up and rebased 👍 |
d654c31 to
f86ec72
Compare
Exactly matches upstream's logic: - Track remoteMessageCount to restart effect when remote messages arrive - Find oldest unread message (lastUnreadIndex) - Mark it when scrolled past, which batches all newer messages via SQL The SQL 'WHERE received_time <= timestamp' marks all messages with timestamp <= the oldest unread, effectively batching all newer unreads.
Fixes race condition while maintaining batch marking behavior. Changed logic to mark the first (newest) visible unread message instead of the last (oldest). Since newer messages have HIGHER timestamps, the SQL query `WHERE received_time <= :timestamp` will batch-mark all older unread messages when we pass the newest visible unread's timestamp. This combines both fixes: - Race condition: LaunchedEffect restarts when remoteMessageCount changes - Batch marking: Marks all visible unreads at once instead of one at a time 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Only mark messages as read after user has interacted with the list (scrolling or changing scroll position), preventing notifications from being cleared before the user has actually viewed the messages.
Handle case where all unread messages are visible on screen without needing to scroll. The debounce now triggers 3 seconds after the list settles (either after scroll stops OR after initial load), ensuring messages get marked as read in both scrolling and no-scroll scenarios.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3795 +/- ##
========================================
- Coverage 0.56% 0.55% -0.01%
========================================
Files 381 381
Lines 21738 21852 +114
Branches 2683 2704 +21
========================================
Hits 122 122
- Misses 21596 21710 +114
Partials 20 20 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Performance Benefits
Technical Details
getMessagesFromPaged()andgetContactsPaged()in database layerMessageListPaged.ktcomposable with full feature parity