From d67f86a1e0d23b4787bfe7203deaf40e0d40fd6b Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 3 Jun 2022 14:21:03 +0200 Subject: [PATCH 1/5] fix slow paged room list --- .../android/sdk/api/session/room/RoomService.kt | 11 ++++++++--- .../sdk/internal/session/room/DefaultRoomService.kt | 11 +++++++---- .../home/room/list/RoomListSectionBuilderGroup.kt | 2 +- .../home/room/list/RoomListSectionBuilderSpace.kt | 2 +- .../features/home/room/list/RoomSummaryItemFactory.kt | 4 +++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt index 01776ca66d..5d3b1f4c4a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt @@ -217,10 +217,15 @@ interface RoomService { /** * TODO Doc. + * @param getFlattenParents When true, the list of known parent and grand parent summaries will be resolved. + * This can have significant impact on performance, better be used only on manageable list (filtered by displayName, ..). */ - fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config = defaultPagedListConfig, - sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): UpdatableLivePageResult + fun getFilteredPagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config = defaultPagedListConfig, + sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY, + getFlattenParents: Boolean = false, + ): UpdatableLivePageResult /** * Return a LiveData on the number of rooms. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt index a7a5dbf4f3..e6c7d9c107 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt @@ -130,10 +130,13 @@ internal class DefaultRoomService @Inject constructor( return roomSummaryDataSource.getSortedPagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder) } - override fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config, - sortOrder: RoomSortOrder): UpdatableLivePageResult { - return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder, getFlattenedParents = true) + override fun getFilteredPagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config, + sortOrder: RoomSortOrder, + getFlattenedParents: Boolean + ): UpdatableLivePageResult { + return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder, getFlattenedParents) } override fun getRoomCountLive(queryParams: RoomSummaryQueryParams): LiveData { diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt index 87bbbd8757..2847bc12f0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt @@ -71,7 +71,7 @@ class RoomListSectionBuilderGroup( }, { qpm -> val name = stringProvider.getString(R.string.bottom_action_rooms) - val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(qpm) + val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(qpm, getFlattenParents = true) onUpdatable(updatableFilterLivePageResult) val itemCountFlow = updatableFilterLivePageResult.livePagedList.asFlow() diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt index e36d3da899..adc1206993 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt @@ -326,7 +326,7 @@ class RoomListSectionBuilderSpace( }, { queryParams -> val name = stringProvider.getString(R.string.bottom_action_rooms) - val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(queryParams) + val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(queryParams, getFlattenParents = true) onUpdatable(updatableFilterLivePageResult) val itemCountFlow = updatableFilterLivePageResult.livePagedList.asFlow() diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt index 3f29c1d14c..d87cb52ff4 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt @@ -199,7 +199,9 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor private fun getSearchResultSubtitle(roomSummary: RoomSummary): String { val userId = roomSummary.directUserId - val spaceName = roomSummary.spaceParents?.firstOrNull()?.roomSummary?.name + val spaceName = roomSummary.flattenParents + .takeIf { it.isNotEmpty() } + ?.joinToString(", ") { it.name } val canonicalAlias = roomSummary.canonicalAlias return (userId ?: spaceName ?: canonicalAlias).orEmpty() From 2fa25f8b5e658f8c9fe439b9809cfb4af9c53e60 Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 3 Jun 2022 14:46:29 +0200 Subject: [PATCH 2/5] Fix param name --- .../android/sdk/internal/session/room/DefaultRoomService.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt index e6c7d9c107..2edd8cc488 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt @@ -134,9 +134,9 @@ internal class DefaultRoomService @Inject constructor( queryParams: RoomSummaryQueryParams, pagedListConfig: PagedList.Config, sortOrder: RoomSortOrder, - getFlattenedParents: Boolean + getFlattenParents: Boolean ): UpdatableLivePageResult { - return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder, getFlattenedParents) + return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder, getFlattenParents) } override fun getRoomCountLive(queryParams: RoomSummaryQueryParams): LiveData { From a6113526d037e1494436cf0cdc6420101606eb8d Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 7 Jun 2022 09:39:32 +0200 Subject: [PATCH 3/5] code review --- changelog.d/6233.bugfix | 1 + .../matrix/android/sdk/api/session/room/RoomService.kt | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelog.d/6233.bugfix diff --git a/changelog.d/6233.bugfix b/changelog.d/6233.bugfix new file mode 100644 index 0000000000..0c415e1078 --- /dev/null +++ b/changelog.d/6233.bugfix @@ -0,0 +1 @@ +Fix | performance regression on roomlist + proper display of space parents in explore rooms. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt index 5d3b1f4c4a..1e022ef02a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt @@ -216,8 +216,12 @@ interface RoomService { sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData> /** - * TODO Doc. - * @param getFlattenParents When true, the list of known parent and grand parent summaries will be resolved. + * Get's a live paged list from a filter that can be dynamically updated. + * + * @param queryParams The filter to use + * @param pagedListConfig The paged list configuration (page size, initial load, prefetch distance...) + * @param sortOrder defines how to sort the results + * @param getFlattenParents When true, the list of known parents and grand parents summaries will be resolved. * This can have significant impact on performance, better be used only on manageable list (filtered by displayName, ..). */ fun getFilteredPagedRoomSummariesLive( From 65132109044f2d8bab051376c78ce83d8de3d83f Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Tue, 7 Jun 2022 10:10:22 +0200 Subject: [PATCH 4/5] Changes space subtitle in explore rooms from joined string to direct space parent --- .../app/features/home/room/list/RoomSummaryItemFactory.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt index d87cb52ff4..733addb6b0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt @@ -199,9 +199,7 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor private fun getSearchResultSubtitle(roomSummary: RoomSummary): String { val userId = roomSummary.directUserId - val spaceName = roomSummary.flattenParents - .takeIf { it.isNotEmpty() } - ?.joinToString(", ") { it.name } + val spaceName = roomSummary.flattenParents.lastOrNull()?.name val canonicalAlias = roomSummary.canonicalAlias return (userId ?: spaceName ?: canonicalAlias).orEmpty() From b2f67f971b1f063bcb00f26a7f96efe99212b76b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 7 Jun 2022 15:09:46 +0200 Subject: [PATCH 5/5] Prepare v1.4.19 --- CHANGES.md | 8 ++++++++ changelog.d/6233.bugfix | 1 - fastlane/metadata/android/en-US/changelogs/40104190.txt | 2 ++ matrix-sdk-android/build.gradle | 2 +- vector/build.gradle | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/6233.bugfix create mode 100644 fastlane/metadata/android/en-US/changelogs/40104190.txt diff --git a/CHANGES.md b/CHANGES.md index b0203c39e9..166453dfad 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,11 @@ +Changes in Element 1.4.19 (2022-06-07) +====================================== + +Bugfixes 🐛 +---------- + - Fix | performance regression on roomlist + proper display of space parents in explore rooms. ([#6233](https://github.com/vector-im/element-android/issues/6233)) + + Changes in Element v1.4.18 (2022-05-31) ======================================= diff --git a/changelog.d/6233.bugfix b/changelog.d/6233.bugfix deleted file mode 100644 index 0c415e1078..0000000000 --- a/changelog.d/6233.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix | performance regression on roomlist + proper display of space parents in explore rooms. diff --git a/fastlane/metadata/android/en-US/changelogs/40104190.txt b/fastlane/metadata/android/en-US/changelogs/40104190.txt new file mode 100644 index 0000000000..61db61727a --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/40104190.txt @@ -0,0 +1,2 @@ +Main changes in this version: Various bug fixes and stability improvements. +Full changelog: https://github.com/vector-im/element-android/releases diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index 52ee019e7b..276c5ac810 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -56,7 +56,7 @@ android { // that the app's state is completely cleared between tests. testInstrumentationRunnerArguments clearPackageData: 'true' - buildConfigField "String", "SDK_VERSION", "\"1.4.18\"" + buildConfigField "String", "SDK_VERSION", "\"1.4.19\"" buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\"" buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\"" diff --git a/vector/build.gradle b/vector/build.gradle index 0dd4ab297a..dbf8cfc33d 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -31,7 +31,7 @@ ext.versionMinor = 4 // Note: even values are reserved for regular release, odd values for hotfix release. // When creating a hotfix, you should decrease the value, since the current value // is the value for the next regular release. -ext.versionPatch = 18 +ext.versionPatch = 19 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct'