mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Permalink Tweaks 2 (#2766)
* Missing changelog. * Parse bare room aliases as permalinks. Update the SDK. * Fix tapping the same permalink twice. Add a test. Don't clear the focussed item when reaching the bottom of the timeline. * Make sure sending a message returns to live.
This commit is contained in:
@@ -88,7 +88,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
roomAvatarURL: roomProxy.avatarURL,
|
||||
timelineStyle: appSettings.timelineStyle,
|
||||
isEncryptedOneToOneRoom: roomProxy.isEncryptedOneToOneRoom,
|
||||
timelineViewState: TimelineViewState(focussedEventID: focussedEventID),
|
||||
timelineViewState: TimelineViewState(focussedEventID: focussedEventID,
|
||||
focussedEventNeedsDisplay: focussedEventID != nil),
|
||||
ownUserID: roomProxy.ownUserID,
|
||||
hasOngoingCall: roomProxy.hasOngoingCall,
|
||||
bindings: .init(reactionsCollapsed: [:])),
|
||||
@@ -175,6 +176,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
paginateBackwards()
|
||||
case .paginateForwards:
|
||||
paginateForwards()
|
||||
case .scrollToBottom:
|
||||
scrollToBottom()
|
||||
case .poll(let pollAction):
|
||||
processPollAction(pollAction)
|
||||
case .audio(let audioAction):
|
||||
@@ -187,8 +190,9 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
Task { await focusOnEvent(eventID: eventID) }
|
||||
case .focusLive:
|
||||
focusLive()
|
||||
case .clearFocussedEvent:
|
||||
state.timelineViewState.focussedEventID = nil
|
||||
case .scrolledToFocussedItem:
|
||||
// Use a Task to mutate view state after the current view update.
|
||||
Task { state.timelineViewState.focussedEventNeedsDisplay = false }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +369,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
.filter { $0 == .sentMessage }
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] _ in
|
||||
self?.state.timelineViewState.scrollToBottomPublisher.send(())
|
||||
self?.scrollToBottom()
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -488,6 +492,14 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
}
|
||||
}
|
||||
|
||||
private func scrollToBottom() {
|
||||
if state.timelineViewState.isLive {
|
||||
state.timelineViewState.scrollToBottomPublisher.send(())
|
||||
} else {
|
||||
focusLive()
|
||||
}
|
||||
}
|
||||
|
||||
private func sendReadReceiptIfNeeded(for lastVisibleItemID: TimelineItemIdentifier) async {
|
||||
guard appMediator.appState == .active else { return }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user