mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Fixes #2147 - Scroll the timeline to the bottom when sending message as well as media, polls and locations.
This commit is contained in:
committed by
Stefan Ceriu
parent
6905ac5f70
commit
8189b0a471
@@ -279,7 +279,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
.store(in: &cancellables)
|
||||
|
||||
roomProxy
|
||||
.stateUpdatesPublisher
|
||||
.actions
|
||||
.filter { $0 == .stateUpdate }
|
||||
.throttle(for: .seconds(1), scheduler: DispatchQueue.main, latest: true)
|
||||
.sink { [weak self] _ in
|
||||
guard let self else { return }
|
||||
@@ -288,6 +289,14 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
self.state.hasOngoingCall = roomProxy.hasOngoingCall
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
roomProxy.timeline.actions
|
||||
.filter { $0 == .sentMessage }
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] _ in
|
||||
self?.state.timelineViewState.scrollToBottomPublisher.send(())
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.$timelineStyle
|
||||
.weakAssign(to: \.state.timelineStyle, on: self)
|
||||
@@ -468,8 +477,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
case .recordVoiceMessage, .previewVoiceMessage:
|
||||
fatalError("invalid composer mode.")
|
||||
}
|
||||
|
||||
state.timelineViewState.scrollToBottomPublisher.send(())
|
||||
}
|
||||
|
||||
private func trackComposerMode(_ mode: RoomScreenComposerMode) {
|
||||
|
||||
Reference in New Issue
Block a user