-
Notifications
You must be signed in to change notification settings - Fork 17
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
refactor: Update status storage, fragments #1249
Merged
Merged
Conversation
This file contains 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
…uses TimelineDao contained operations on timelines and statuses which made it large and confusing. Factor out the status-specific operations in to the new StatusDao class to make things more understandable.
- Removing the restore-position-on-swipe-refresh code worked - Document the new database stuff - Modified some bits with row fetching
# Conflicts: # app/src/main/java/app/pachli/components/timeline/viewmodel/CachedTimelineRemoteMediator.kt # core/data/src/main/kotlin/app/pachli/core/data/repository/notifications/NotificationsRemoteMediator.kt # core/database/src/main/kotlin/app/pachli/core/database/AppDatabase.kt # core/database/src/main/kotlin/app/pachli/core/database/dao/TimelineDao.kt
# Conflicts: # app/src/main/java/app/pachli/components/timeline/viewmodel/CachedTimelineRemoteMediator.kt # core/database/src/main/kotlin/app/pachli/core/database/dao/TimelineDao.kt
ac5d9db
to
bbb949c
Compare
# Conflicts: # app/src/main/java/app/pachli/components/notifications/NotificationsFragment.kt # app/src/main/java/app/pachli/components/timeline/TimelineFragment.kt
# Conflicts: # app/src/main/java/app/pachli/components/timeline/viewmodel/CachedTimelineRemoteMediator.kt
The local test was returning unsorted results for the PagingSource
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.
Status storage
Re-work how statuses are stored and managed to separate the cached home
timeline from the cached notification timeline.
Previously, the home timeline pulled all statuses in
StatusEntity
.Since that table also includes statuses that are referenced from
NotificationEntity
this could show the wrong data. It also makes itdifficult to cache other timelines in the future.
To fix this:
Introduce
TimelineStatus
which associates a given timeline with thestatuses on that timeline.
Use the the
StatusEntity
table as a general cache of statuses.wherever they're used.
Create the home timeline by joining
TimelineStatus
(where thetimeline's kind is
Home
) with the statuses inStatusEntity
.This has a number of knock-on effects.
Deleting from the home timeline now deletes the association from
TimelineStatus
. The cached status is unaffected, so if it isreferenced from another cached timeline (currently, notifications)
there is no change.
Modifying a status on one timeline (translating, expanding,
collapsing, etc) modifies it on all timelines that reference that
status.
cleanup()
and related functions no longer need to takelimit
orkeep
parameter, as it's known whether a status is referenced from atimeline.
Rewriting one of the queries exposed an issue where
TimelineDaoTest
run locally could return different (incorrect) results to the same test
run on a device (https://issuetracker.google.com/issues/393685887).
So re-implement
TimelineDaoTest
as anandroidTest
, and update the CIworkflow to include a step to run these tests on an API 31 emulator.
Repositories
null
as an initial key.Fragments
refreshAdapterAndScrollToVisibleId
.