RoomServiceImpl

class RoomServiceImpl(api: MatrixClientServerApiClient, roomStore: RoomStore, roomStateStore: RoomStateStore, roomAccountDataStore: RoomAccountDataStore, roomTimelineStore: RoomTimelineStore, roomOutboxMessageStore: RoomOutboxMessageStore, roomEventEncryptionServices: List<RoomEventEncryptionService>, mediaService: MediaService, forgetRoomService: ForgetRoomService, userInfo: UserInfo, timelineEventHandler: TimelineEventHandler, clock: Clock, config: MatrixClientConfiguration, typingEventHandler: TypingEventHandler, currentSyncState: CurrentSyncState, scope: CoroutineScope) : RoomService

Constructors

Link copied to clipboard
constructor(api: MatrixClientServerApiClient, roomStore: RoomStore, roomStateStore: RoomStateStore, roomAccountDataStore: RoomAccountDataStore, roomTimelineStore: RoomTimelineStore, roomOutboxMessageStore: RoomOutboxMessageStore, roomEventEncryptionServices: List<RoomEventEncryptionService>, mediaService: MediaService, forgetRoomService: ForgetRoomService, userInfo: UserInfo, timelineEventHandler: TimelineEventHandler, clock: Clock, config: MatrixClientConfiguration, typingEventHandler: TypingEventHandler, currentSyncState: CurrentSyncState, scope: CoroutineScope)

Properties

Link copied to clipboard
open override val usersTyping: StateFlow<Map<RoomId, TypingEventContent>>

Functions

Link copied to clipboard
open suspend override fun cancelSendMessage(roomId: RoomId, transactionId: String)
Link copied to clipboard
open suspend override fun fillTimelineGaps(roomId: RoomId, startEventId: EventId, limit: Long)
Link copied to clipboard
open suspend override fun forgetRoom(roomId: RoomId, force: Boolean)

If the room has Membership.LEAVE, you can delete it locally.

Link copied to clipboard
open override fun <C : RoomAccountDataEventContent> getAccountData(roomId: RoomId, eventContentClass: KClass<C>, key: String): Flow<C?>
Link copied to clipboard
inline fun <C : RoomAccountDataEventContent> RoomService.getAccountData(roomId: RoomId, key: String = ""): Flow<C?>
Link copied to clipboard
open override fun getAll(): Flow<Map<RoomId, Flow<Room?>>>

Upgraded rooms (Room.hasBeenReplaced) should not be rendered.

Link copied to clipboard
open override fun <C : StateEventContent> getAllState(roomId: RoomId, eventContentClass: KClass<C>): Flow<Map<String, Flow<ClientEvent.StateBaseEvent<C>?>>>
Link copied to clipboard
Link copied to clipboard
open override fun getById(roomId: RoomId): Flow<Room?>
Link copied to clipboard
open override fun getLastTimelineEvent(roomId: RoomId, config: GetTimelineEventConfig.() -> Unit): Flow<Flow<TimelineEvent>?>
Link copied to clipboard
open override fun getLastTimelineEvents(roomId: RoomId, config: GetTimelineEventsConfig.() -> Unit): Flow<Flow<Flow<TimelineEvent>>?>

Returns the last timeline events as flow.

Link copied to clipboard
open override fun getNextTimelineEvent(event: TimelineEvent, config: GetTimelineEventConfig.() -> Unit): Flow<TimelineEvent?>?
Link copied to clipboard
open override fun getOutbox(): Flow<List<Flow<RoomOutboxMessage<*>?>>>
open override fun getOutbox(roomId: RoomId): Flow<List<Flow<RoomOutboxMessage<*>?>>>
open override fun getOutbox(roomId: RoomId, transactionId: String): Flow<RoomOutboxMessage<*>?>
Link copied to clipboard
open override fun getPreviousTimelineEvent(event: TimelineEvent, config: GetTimelineEventConfig.() -> Unit): Flow<TimelineEvent?>?
Link copied to clipboard
open override fun <C : StateEventContent> getState(roomId: RoomId, eventContentClass: KClass<C>, stateKey: String): Flow<ClientEvent.StateBaseEvent<C>?>
Link copied to clipboard
inline fun <C : StateEventContent> RoomService.getState(roomId: RoomId, stateKey: String = ""): Flow<ClientEvent.StateBaseEvent<C>?>
Link copied to clipboard
open override fun <T> getTimeline(onStateChange: suspend (TimelineStateChange<T>) -> Unit, transformer: suspend (Flow<TimelineEvent>) -> T): Timeline<T>

Returns a Timeline for a room.

Link copied to clipboard
fun RoomService.getTimeline(onStateChange: suspend (TimelineStateChange<Flow<TimelineEvent>>) -> Unit = {}): SimpleTimeline
Link copied to clipboard
open override fun getTimelineEvent(roomId: RoomId, eventId: EventId, config: GetTimelineEventConfig.() -> Unit): Flow<TimelineEvent?>

Returns the TimelineEvent and starts decryption. If it is not found locally, the algorithm will try to find the event by traversing the events from the end of the timeline (i.e. from the last sent event). This can include filling sync gaps from the server and thus might take a while. Please consider changing the config.

Link copied to clipboard
open override fun getTimelineEventRelations(roomId: RoomId, eventId: EventId, relationType: RelationType): Flow<Map<EventId, Flow<TimelineEventRelation?>>?>
Link copied to clipboard
open override fun getTimelineEvents(response: Sync.Response, decryptionTimeout: Duration): Flow<TimelineEvent>

open override fun getTimelineEvents(roomId: RoomId, startFrom: EventId, direction: GetEvents.Direction, config: GetTimelineEventsConfig.() -> Unit): Flow<Flow<TimelineEvent>>

Returns a flow of timeline events wrapped in a flow. It emits, when there is a new timeline event. This flow only completes, when the start of the timeline is reached or GetTimelineEventsConfig.minSize and/or GetTimelineEventsConfig.maxSize are set and reached.

Link copied to clipboard
suspend fun RoomService.getTimelineEventsAround(roomId: RoomId, startFrom: EventId, configStart: GetTimelineEventConfig.() -> Unit = {}, configBefore: GetTimelineEventsConfig.() -> Unit = {}, configAfter: GetTimelineEventsConfig.() -> Unit = {}): List<Flow<TimelineEvent>>

Returns all timeline events around a starting event.

fun RoomService.getTimelineEventsAround(roomId: RoomId, startFrom: EventId, maxSizeBefore: StateFlow<Int>, maxSizeAfter: StateFlow<Int>, configStart: GetTimelineEventConfig.() -> Unit = {}, configBefore: GetTimelineEventsConfig.() -> Unit = {}, configAfter: GetTimelineEventsConfig.() -> Unit = {}): Flow<List<Flow<TimelineEvent>>>

Returns all timeline events around a starting event sorted with higher indexes being more recent.

Link copied to clipboard
open override fun getTimelineEventsFromNowOn(decryptionTimeout: Duration, syncResponseBufferSize: Int): Flow<TimelineEvent>

Returns all timeline events from the moment this method is called. This also triggers decryption for each timeline event.

Link copied to clipboard
open suspend override fun retrySendMessage(roomId: RoomId, transactionId: String)
Link copied to clipboard
open suspend override fun sendMessage(roomId: RoomId, keepMediaInCache: Boolean, builder: suspend MessageBuilder.() -> Unit): String

Puts a message to the outbox.