From ac8303bb990347c7cf246d8b409611c5f7060fc6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 19 Jul 2021 18:23:14 +0200 Subject: [PATCH] Add low priority section in DM tab #3463 --- changelog.d/3463.feature | 1 + .../room/list/GroupRoomListSectionBuilder.kt | 17 +++++++++++--- .../room/list/SpaceRoomListSectionBuilder.kt | 23 +++++++++++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 changelog.d/3463.feature diff --git a/changelog.d/3463.feature b/changelog.d/3463.feature new file mode 100644 index 0000000000..a0a5f85393 --- /dev/null +++ b/changelog.d/3463.feature @@ -0,0 +1 @@ +Add low priority section in DM tab \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/GroupRoomListSectionBuilder.kt b/vector/src/main/java/im/vector/app/features/home/room/list/GroupRoomListSectionBuilder.kt index 4e6fe3ccee..e4bcc8ff0c 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/GroupRoomListSectionBuilder.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/GroupRoomListSectionBuilder.kt @@ -52,7 +52,7 @@ class GroupRoomListSectionBuilder( when (mode) { RoomListDisplayMode.PEOPLE -> { - // 3 sections Invites / Fav / Dms + // 4 sections Invites / Fav / Dms / Low Priority buildPeopleSections(sections, activeGroupAwareQueries, actualGroupId) } RoomListDisplayMode.ROOMS -> { @@ -218,7 +218,19 @@ class GroupRoomListSectionBuilder( ) { it.memberships = listOf(Membership.JOIN) it.roomCategoryFilter = RoomCategoryFilter.ONLY_DM - it.roomTagQueryFilter = RoomTagQueryFilter(false, null, null) + it.roomTagQueryFilter = RoomTagQueryFilter(false, false, null) + it.activeGroupId = actualGroupId + } + + addSection( + sections, + activeSpaceAwareQueries, + R.string.low_priority_header, + false + ) { + it.memberships = listOf(Membership.JOIN) + it.roomCategoryFilter = RoomCategoryFilter.ONLY_DM + it.roomTagQueryFilter = RoomTagQueryFilter(false, true, null) it.activeGroupId = actualGroupId } } @@ -231,7 +243,6 @@ class GroupRoomListSectionBuilder( withQueryParams( { query.invoke(it) }, { roomQueryParams -> - val name = stringProvider.getString(nameRes) session.getFilteredPagedRoomSummariesLive(roomQueryParams) .also { diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/SpaceRoomListSectionBuilder.kt b/vector/src/main/java/im/vector/app/features/home/room/list/SpaceRoomListSectionBuilder.kt index a05e464ab1..725a62e7d5 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/SpaceRoomListSectionBuilder.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/SpaceRoomListSectionBuilder.kt @@ -261,7 +261,8 @@ class SpaceRoomListSectionBuilder( private fun buildDmSections(sections: MutableList, activeSpaceAwareQueries: MutableList) { if (autoAcceptInvites.showInvites()) { - addSection(sections = sections, + addSection( + sections = sections, activeSpaceUpdaters = activeSpaceAwareQueries, nameRes = R.string.invitations_header, notifyOfLocalEcho = true, @@ -273,7 +274,8 @@ class SpaceRoomListSectionBuilder( } } - addSection(sections, + addSection( + sections, activeSpaceAwareQueries, R.string.bottom_action_favourites, false, @@ -284,7 +286,8 @@ class SpaceRoomListSectionBuilder( it.roomTagQueryFilter = RoomTagQueryFilter(true, null, null) } - addSection(sections, + addSection( + sections, activeSpaceAwareQueries, R.string.bottom_action_people_x, false, @@ -292,7 +295,19 @@ class SpaceRoomListSectionBuilder( ) { it.memberships = listOf(Membership.JOIN) it.roomCategoryFilter = RoomCategoryFilter.ONLY_DM - it.roomTagQueryFilter = RoomTagQueryFilter(false, null, null) + it.roomTagQueryFilter = RoomTagQueryFilter(false, false, null) + } + + addSection( + sections, + activeSpaceAwareQueries, + R.string.low_priority_header, + false, + RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL + ) { + it.memberships = listOf(Membership.JOIN) + it.roomCategoryFilter = RoomCategoryFilter.ONLY_DM + it.roomTagQueryFilter = RoomTagQueryFilter(false, true, null) } }