From 0f4279bddeb7be51b5647eaf315867a7e4098a9b Mon Sep 17 00:00:00 2001 From: Taras Smakula <tarassmakula@gmail.com> Date: Fri, 12 Jan 2024 17:46:58 +0200 Subject: [PATCH] Improve user page filter --- .../core/feature/room/invites/InvitesDataSource.kt | 1 - .../org/futo/circles/core/feature/user/UserDataSource.kt | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/futo/circles/core/feature/room/invites/InvitesDataSource.kt b/core/src/main/java/org/futo/circles/core/feature/room/invites/InvitesDataSource.kt index 0f03f224f..4ca34f680 100644 --- a/core/src/main/java/org/futo/circles/core/feature/room/invites/InvitesDataSource.kt +++ b/core/src/main/java/org/futo/circles/core/feature/room/invites/InvitesDataSource.kt @@ -35,7 +35,6 @@ import org.matrix.android.sdk.api.session.getUserOrDefault 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.roomSummaryQueryParams import javax.inject.Inject class InvitesDataSource @Inject constructor( diff --git a/core/src/main/java/org/futo/circles/core/feature/user/UserDataSource.kt b/core/src/main/java/org/futo/circles/core/feature/user/UserDataSource.kt index 59c3b835a..6505bf18f 100644 --- a/core/src/main/java/org/futo/circles/core/feature/user/UserDataSource.kt +++ b/core/src/main/java/org/futo/circles/core/feature/user/UserDataSource.kt @@ -12,16 +12,15 @@ import kotlinx.coroutines.flow.map import org.futo.circles.core.extensions.getOrThrow import org.futo.circles.core.extensions.getRoomOwner import org.futo.circles.core.feature.workspace.SharedCircleDataSource -import org.futo.circles.core.model.TIMELINE_TYPE import org.futo.circles.core.model.TimelineHeaderItem import org.futo.circles.core.model.TimelineListItem import org.futo.circles.core.model.TimelineRoomListItem import org.futo.circles.core.model.toTimelineRoomListItem import org.futo.circles.core.provider.MatrixSessionProvider +import org.futo.circles.core.utils.getTimelinesLiveData import org.matrix.android.sdk.api.session.getUserOrDefault 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.roomSummaryQueryParams import javax.inject.Inject @ViewModelScoped @@ -66,8 +65,7 @@ class UserDataSource @Inject constructor( } } - private fun getAllFollowingTimelinesFlow() = session.roomService() - .getRoomSummariesLive(roomSummaryQueryParams()) + private fun getAllFollowingTimelinesFlow() = getTimelinesLiveData(listOf(Membership.JOIN)) .map { list -> filterUsersTimelines(list) }.asFlow() private suspend fun getAllSharedTimelinesFlow() = session.roomService().getRoomSummaryLive( @@ -89,7 +87,6 @@ class UserDataSource @Inject constructor( } private fun isUsersCircleTimeline(summary: RoomSummary) = - summary.roomType == TIMELINE_TYPE && summary.membership == Membership.JOIN && - getRoomOwner(summary.roomId)?.userId == userId + getRoomOwner(summary.roomId)?.userId == userId } \ No newline at end of file -- GitLab