Fixes #2147 - Scroll the timeline to the bottom when sending message as well as media, polls and locations.

This commit is contained in:
Stefan Ceriu
2023-12-04 15:55:28 +02:00
committed by Stefan Ceriu
parent 6905ac5f70
commit 8189b0a471
9 changed files with 92 additions and 31 deletions
@@ -42,9 +42,9 @@ class RoomProxy: RoomProxyProtocol {
membersSubject.asCurrentValuePublisher()
}
private let stateUpdatesSubject = PassthroughSubject<Void, Never>()
var stateUpdatesPublisher: AnyPublisher<Void, Never> {
stateUpdatesSubject.eraseToAnyPublisher()
private let actionsSubject = PassthroughSubject<RoomProxyAction, Never>()
var actions: AnyPublisher<RoomProxyAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
var ownUserID: String {
@@ -407,7 +407,7 @@ class RoomProxy: RoomProxyProtocol {
private func subscribeToRoomStateUpdates() {
roomInfoObservationToken = room.subscribeToRoomInfoUpdates(listener: RoomInfoUpdateListener { [weak self] in
MXLog.info("Received room info update")
self?.stateUpdatesSubject.send(())
self?.actionsSubject.send(.stateUpdate)
})
}
}
@@ -35,6 +35,10 @@ enum RoomProxyError: Error, Equatable {
case failedCheckingPermission
}
enum RoomProxyAction {
case stateUpdate
}
// sourcery: AutoMockable
protocol RoomProxyProtocol {
var id: String { get }
@@ -65,9 +69,7 @@ protocol RoomProxyProtocol {
var activeMembersCount: Int { get }
/// Publishes room state updates
/// The thread on which this publisher sends the output isn't defined.
var stateUpdatesPublisher: AnyPublisher<Void, Never> { get }
var actions: AnyPublisher<RoomProxyAction, Never> { get }
var timeline: TimelineProxyProtocol { get }