-
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
Replaces subtitle in Search Rooms with room context rather than last event #5860
Changes from 21 commits
0250f61
a3367d4
9e53e6c
70cded2
87ad35d
3347560
b280358
4784717
962e9ab
7e415e8
7cc79fe
a355b62
f70a24d
47493fc
c9b32fe
b46794d
52c404a
21fe5a2
50839c2
7c1d1c3
83bd9bc
03acf45
d12ab17
a5dc8ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds space or user id as a subtitle under rooms in search |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ import org.matrix.android.sdk.api.session.room.UpdatableLivePageResult | |
import org.matrix.android.sdk.api.session.room.model.Membership | ||
import org.matrix.android.sdk.api.session.room.model.RoomSummary | ||
import org.matrix.android.sdk.api.session.room.model.RoomType | ||
import org.matrix.android.sdk.api.session.room.model.SpaceParentInfo | ||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams | ||
import org.matrix.android.sdk.api.session.room.spaceSummaryQueryParams | ||
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount | ||
|
@@ -193,7 +194,7 @@ internal class RoomSummaryDataSource @Inject constructor( | |
} | ||
val dataSourceFactory = realmDataSourceFactory.map { | ||
roomSummaryMapper.map(it) | ||
} | ||
}.map { it.getWithParents() } | ||
|
||
val boundaries = MutableLiveData(ResultBoundaries()) | ||
|
||
|
@@ -232,6 +233,20 @@ internal class RoomSummaryDataSource @Inject constructor( | |
} | ||
} | ||
|
||
private fun RoomSummary.getWithParents(): RoomSummary { | ||
val parents = flattenParentIds.mapNotNull { parentId -> | ||
getRoomSummary(parentId)?.let { parentSummary -> | ||
SpaceParentInfo( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just return the RoomSummaries here instead of fake parentInfo with fake/wrong canonical & viaservers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idk why I didn't do this to start with lmao There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
parentId = parentSummary.flattenParentIds.firstOrNull(), | ||
roomSummary = parentSummary, | ||
canonical = true, | ||
viaServers = emptyList() | ||
) | ||
} | ||
} | ||
return copy(flattenParents = parents) | ||
} | ||
|
||
fun getCountLive(queryParams: RoomSummaryQueryParams): LiveData<Int> { | ||
val liveRooms = monarchy.findAllManagedWithChanges { | ||
roomSummariesQuery(it, queryParams) | ||
|
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.
I think it would be cool to have an overload of
map
inRoomSummaryMapper
to have a param to request flattened parentThere 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.
I think it would be better also. Like that it won't impact perf for those who don't need to load additional things?
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.
Good shout!