-
Notifications
You must be signed in to change notification settings - Fork 269
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
Port the Sliding Sync view logic from iOS into the SDK. #1644
Comments
The code we have is a bit intermingled between the UI layer and the data layer but I would imagine an API that looked something like this would be nice to create the 2 views. let easySlidingSync = EasySlidingSyncListBuilder()
.initialRange(from: 0, to: 20) // To customise for different window sizes
.requiredState(requiredState: slidingSyncRequiredState)
.filters(filters: slidingSyncFilters)
.build(client: client) // Would need to manage the call to `client.slidingSync()` and add the views internally.
easySlidingSync.setObserver(observer: SomeObserver())
…
let (visibleRange, isScrolling) = homeScreenListState()
easySlidingSync.updateVisibleRange(start: visibleRange.lowerBound, end: visibleRange.upperBound, isScrolling: isScrolling) |
Closed
3 tasks
This was referenced Mar 14, 2023
FYI we started using a new SS for invites on EX-iOS. Swift let invitesView = try SlidingSyncListBuilder()
.noTimelineLimit()
.requiredState(requiredState: slidingSyncInvitesRequiredState)
.filters(filters: slidingSyncInviteFilters)
.name(name: "Invites")
.syncMode(mode: .growing)
.batchSize(batchSize: 100)
.build() Request "Invites": {
"ranges": [
[
0,
99
]
],
"sort": [
"by_recency",
"by_name"
],
"required_state": [
[
"m.room.avatar",
""
],
[
"m.room.encryption",
""
],
[
"m.room.member",
"$ME"
],
[
"m.room.canonical_alias",
""
]
],
"filters": {
"is_invite": true,
"is_tombstoned": false,
"not_room_types": [
"m.space"
]
}
} |
Closed by #1911. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Whilst implementing sliding sync in Element X iOS we have landed on a solution that uses 2 views and combines them into a single list for the app to display. We should move this code into the SDK so that it doesn't need to be re-implemented in Android and for other clients to benefit from this solution. Drawing from element-hq/element-x-android#143 an overview of how this works is as follows:
AllRooms
and runs using thegrowingFullSync
sync mode. It has a fixedlimit = 0
and grows in batches of100
.VisibleRooms
and runs using theselective
sync mode. The first sync is run withlimit = 0
and a range of[0, 20]
to get the rooms at the top of the list as quickly as possible. Once this first sync is completed, the limit is increased to1
to load the last message for each room. This is also the point in time thatAllRooms
will be started, as went want the first sync ofVisibleRooms
to have priority during app launch.VisibleRooms
is driven by the home screen based on the range of visible cells and whether or not the list is scrolling. These 2 values are passed as a tuple which is run through a 0.5 second throttle followed by a de-dupe before being used to update the view. The view's range is set to[firstVisibleIndex - 5, lastVisibleIndex + 5]
and the limit is set to1
when scrolling and20
when stationary.VisibleRooms
and applying the following logic:VisibleRooms
if it isfilled
.AllRooms
get that room andfilled
show a room that is loading.invalidated
show an invalidated room that is loading.empty
show a placeholder room.AllRooms
to catch up continue with the room fromVisibleRooms
invalidated
show an invalidated room that is not loading.empty
show a placeholder room.Future details
VisibleRooms
withlimit = 0
wouldn't be necessary ifAllRooms
handled this by starting at[0,20]
and then growing to[0,100]
,[0,200]
, etc.Additional Views
Its also worth considering how this will interact with the need for different options for example filtering the list for:
In the case of say invites, some apps might like to be able to get the count of invites without showing the list e.g. to show a button with
4 Invites
that will show just the invites when tapped.The text was updated successfully, but these errors were encountered: