-
Notifications
You must be signed in to change notification settings - Fork 731
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
Feature/fga/timeline chunks rework #4405
Conversation
…hod on the timeline)
…akes some time uselessly)
} | ||
} | ||
} | ||
|
||
/* | ||
private fun cleanUp(realm: Realm, threshold: Long) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this cleanup not needed anymore? if so we could probably delete the class as it's only logging the number of rooms (or make it debug~ only)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted!
private val mode: Mode, | ||
private val dependencies: Dependencies) { | ||
|
||
sealed class Mode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could be a sealed interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
fun buildSendingEvents(): List<TimelineEvent> | ||
} | ||
|
||
internal class RealmSendingEventsDataSource( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 for extracting this to its own smaller class
LoadMoreResult.FAILURE | ||
} | ||
return if (loadMoreResult == LoadMoreResult.SUCCESS) { | ||
latch?.await() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be safer to use await
with a timeout or does this logic cancel when exiting the timeline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scope is closed so this should cancel when exiting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 no blockers from my side although I'm very new to this area and don't know a lot of the history/context
didn't notice any issues with a local smoke test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work!
Thanks @ouchadam for the smoke test, happy to merge this PR fast to develop once the changelog files are added.
/** | ||
* Called when the pagination state has changed in one direction | ||
*/ | ||
fun onStateUpdated(direction: Direction, state: PaginationState) = Unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you advertise the API break using a changelog file 4405.removal
please? Another 4405.feature
can simply tell that the timeline management has been reworked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because according to https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog:
.removal: Signifying a deprecation or removal of public API. Can be used to notifying about API change in the Matrix SDK
and https://github.com/vector-im/element-android/blob/develop/towncrier.toml#L25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -28,3 +28,13 @@ internal fun TimelineEventEntity.Companion.nextId(realm: Realm): Long { | |||
currentIdNum.toLong() + 1 | |||
} | |||
} | |||
|
|||
internal fun TimelineEventEntity.isMoreRecentThan(eventToCheck: TimelineEventEntity): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename eventToCheck
to other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
var stateEvents: RealmList<EventEntity> = RealmList(), | ||
var timelineEvents: RealmList<TimelineEventEntity> = RealmList(), | ||
var numberOfTimelineEvents: Long = 0, | ||
// var numberOfTimelineEvents: Long = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just delete the commented out code? Or will it be uncommented in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will delete, thanks
@@ -46,7 +46,5 @@ internal fun TimelineEventEntity.deleteOnCascade(canDeleteRoot: Boolean) { | |||
if (canDeleteRoot) { | |||
root?.deleteFromRealm() | |||
} | |||
annotations?.deleteOnCascade() | |||
readReceipts?.deleteOnCascade() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed anymore? Can you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annotations and read receipts persistence is supposed to be independent
from timeline. This is what caused reactions to be lost during gap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the table for annotations will grow up indefinitely, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes until cache is cleared
TimelineInput.Listener, | ||
UIEchoManager.Listener { | ||
|
||
internal class DefaultTimeline internal constructor(private val roomId: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove internal constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* ======================================================================================================== | ||
* </pre> | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RIP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
This PR is a first step in the refactoring of the timeline.
It should also fix #4280 (not reproduced)
The main changes are:
This is still not ideal, but it will be easier to evolve from there after hopefully.