You've already forked element-android
mirror of
https://github.com/vector-im/element-android.git
synced 2025-07-29 19:41:14 +03:00
Merge remote-tracking branch 'origin/develop' into dependency-cleanup
# Conflicts: # build.gradle # dependencies.gradle
This commit is contained in:
@ -21,6 +21,8 @@ import kotlinx.coroutines.flow.Flow
|
||||
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
import org.matrix.android.sdk.api.session.room.Room
|
||||
import org.matrix.android.sdk.api.session.room.getStateEvent
|
||||
import org.matrix.android.sdk.api.session.room.getTimelineEvent
|
||||
import org.matrix.android.sdk.api.session.room.members.RoomMemberQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.model.EventAnnotationsSummary
|
||||
import org.matrix.android.sdk.api.session.room.model.ReadReceipt
|
||||
@ -45,79 +47,81 @@ class FlowRoom(private val room: Room) {
|
||||
}
|
||||
|
||||
fun liveRoomMembers(queryParams: RoomMemberQueryParams): Flow<List<RoomMemberSummary>> {
|
||||
return room.getRoomMembersLive(queryParams).asFlow()
|
||||
return room.membershipService().getRoomMembersLive(queryParams).asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getRoomMembers(queryParams)
|
||||
room.membershipService().getRoomMembers(queryParams)
|
||||
}
|
||||
}
|
||||
|
||||
fun liveAnnotationSummary(eventId: String): Flow<Optional<EventAnnotationsSummary>> {
|
||||
return room.getEventAnnotationsSummaryLive(eventId).asFlow()
|
||||
return room.relationService().getEventAnnotationsSummaryLive(eventId).asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getEventAnnotationsSummary(eventId).toOptional()
|
||||
room.relationService().getEventAnnotationsSummary(eventId).toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveTimelineEvent(eventId: String): Flow<Optional<TimelineEvent>> {
|
||||
return room.getTimelineEventLive(eventId).asFlow()
|
||||
return room.timelineService().getTimelineEventLive(eventId).asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getTimelineEvent(eventId).toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveStateEvent(eventType: String, stateKey: QueryStringValue): Flow<Optional<Event>> {
|
||||
return room.getStateEventLive(eventType, stateKey).asFlow()
|
||||
return room.stateService().getStateEventLive(eventType, stateKey).asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getStateEvent(eventType, stateKey).toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveStateEvents(eventTypes: Set<String>): Flow<List<Event>> {
|
||||
return room.getStateEventsLive(eventTypes).asFlow()
|
||||
return room.stateService().getStateEventsLive(eventTypes).asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getStateEvents(eventTypes)
|
||||
room.stateService().getStateEvents(eventTypes)
|
||||
}
|
||||
}
|
||||
|
||||
fun liveReadMarker(): Flow<Optional<String>> {
|
||||
return room.getReadMarkerLive().asFlow()
|
||||
return room.readService().getReadMarkerLive().asFlow()
|
||||
}
|
||||
|
||||
fun liveReadReceipt(): Flow<Optional<String>> {
|
||||
return room.getMyReadReceiptLive().asFlow()
|
||||
return room.readService().getMyReadReceiptLive().asFlow()
|
||||
}
|
||||
|
||||
fun liveEventReadReceipts(eventId: String): Flow<List<ReadReceipt>> {
|
||||
return room.getEventReadReceiptsLive(eventId).asFlow()
|
||||
return room.readService().getEventReadReceiptsLive(eventId).asFlow()
|
||||
}
|
||||
|
||||
fun liveDraft(): Flow<Optional<UserDraft>> {
|
||||
return room.getDraftLive().asFlow()
|
||||
return room.draftService().getDraftLive().asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getDraft().toOptional()
|
||||
room.draftService().getDraft().toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveNotificationState(): Flow<RoomNotificationState> {
|
||||
return room.getLiveRoomNotificationState().asFlow()
|
||||
return room.roomPushRuleService().getLiveRoomNotificationState().asFlow()
|
||||
}
|
||||
|
||||
fun liveThreadSummaries(): Flow<List<ThreadSummary>> {
|
||||
return room.getAllThreadSummariesLive().asFlow()
|
||||
return room.threadsService().getAllThreadSummariesLive().asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getAllThreadSummaries()
|
||||
room.threadsService().getAllThreadSummaries()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveThreadList(): Flow<List<ThreadRootEvent>> {
|
||||
return room.getAllThreadsLive().asFlow()
|
||||
return room.threadsLocalService().getAllThreadsLive().asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getAllThreads()
|
||||
room.threadsLocalService().getAllThreads()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveLocalUnreadThreadList(): Flow<List<ThreadRootEvent>> {
|
||||
return room.getMarkedThreadNotificationsLive().asFlow()
|
||||
return room.threadsLocalService().getMarkedThreadNotificationsLive().asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getMarkedThreadNotifications()
|
||||
room.threadsLocalService().getMarkedThreadNotifications()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,16 +46,16 @@ import org.matrix.android.sdk.api.util.toOptional
|
||||
class FlowSession(private val session: Session) {
|
||||
|
||||
fun liveRoomSummaries(queryParams: RoomSummaryQueryParams, sortOrder: RoomSortOrder = RoomSortOrder.NONE): Flow<List<RoomSummary>> {
|
||||
return session.getRoomSummariesLive(queryParams, sortOrder).asFlow()
|
||||
return session.roomService().getRoomSummariesLive(queryParams, sortOrder).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.getRoomSummaries(queryParams, sortOrder)
|
||||
session.roomService().getRoomSummaries(queryParams, sortOrder)
|
||||
}
|
||||
}
|
||||
|
||||
fun liveGroupSummaries(queryParams: GroupSummaryQueryParams): Flow<List<GroupSummary>> {
|
||||
return session.getGroupSummariesLive(queryParams).asFlow()
|
||||
return session.groupService().getGroupSummariesLive(queryParams).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.getGroupSummaries(queryParams)
|
||||
session.groupService().getGroupSummaries(queryParams)
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,9 +67,9 @@ class FlowSession(private val session: Session) {
|
||||
}
|
||||
|
||||
fun liveBreadcrumbs(queryParams: RoomSummaryQueryParams): Flow<List<RoomSummary>> {
|
||||
return session.getBreadcrumbsLive(queryParams).asFlow()
|
||||
return session.roomService().getBreadcrumbsLive(queryParams).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.getBreadcrumbs(queryParams)
|
||||
session.roomService().getBreadcrumbs(queryParams)
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,43 +85,47 @@ class FlowSession(private val session: Session) {
|
||||
}
|
||||
|
||||
fun livePushers(): Flow<List<Pusher>> {
|
||||
return session.getPushersLive().asFlow()
|
||||
return session.pushersService().getPushersLive().asFlow()
|
||||
}
|
||||
|
||||
fun liveUser(userId: String): Flow<Optional<User>> {
|
||||
return session.getUserLive(userId).asFlow()
|
||||
return session.userService().getUserLive(userId).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.getUser(userId).toOptional()
|
||||
session.userService().getUser(userId).toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveRoomMember(userId: String, roomId: String): Flow<Optional<RoomMemberSummary>> {
|
||||
return session.getRoomMemberLive(userId, roomId).asFlow()
|
||||
return session.roomService().getRoomMemberLive(userId, roomId).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.getRoomMember(userId, roomId).toOptional()
|
||||
session.roomService().getRoomMember(userId, roomId).toOptional()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveUsers(): Flow<List<User>> {
|
||||
return session.getUsersLive().asFlow()
|
||||
return session.userService().getUsersLive().asFlow()
|
||||
}
|
||||
|
||||
fun liveIgnoredUsers(): Flow<List<User>> {
|
||||
return session.getIgnoredUsersLive().asFlow()
|
||||
return session.userService().getIgnoredUsersLive().asFlow()
|
||||
}
|
||||
|
||||
fun livePagedUsers(filter: String? = null, excludedUserIds: Set<String>? = null): Flow<PagedList<User>> {
|
||||
return session.getPagedUsersLive(filter, excludedUserIds).asFlow()
|
||||
return session.userService().getPagedUsersLive(filter, excludedUserIds).asFlow()
|
||||
}
|
||||
|
||||
fun liveThreePIds(refreshData: Boolean): Flow<List<ThreePid>> {
|
||||
return session.getThreePidsLive(refreshData).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) { session.getThreePids() }
|
||||
return session.profileService().getThreePidsLive(refreshData).asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.profileService().getThreePids()
|
||||
}
|
||||
}
|
||||
|
||||
fun livePendingThreePIds(): Flow<List<ThreePid>> {
|
||||
return session.getPendingThreePidsLive().asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) { session.getPendingThreePids() }
|
||||
return session.profileService().getPendingThreePidsLive().asFlow()
|
||||
.startWith(session.coroutineDispatchers.io) {
|
||||
session.profileService().getPendingThreePids()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveUserCryptoDevices(userId: String): Flow<List<CryptoDeviceInfo>> {
|
||||
@ -179,7 +183,7 @@ class FlowSession(private val session: Session) {
|
||||
}
|
||||
|
||||
fun liveRoomChangeMembershipState(): Flow<Map<String, ChangeMembershipState>> {
|
||||
return session.getChangeMembershipsLive().asFlow()
|
||||
return session.roomService().getChangeMembershipsLive().asFlow()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user