mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Keep message selection active when every message is unselected
Unselecting the last message used to end the selection, closing it without the user asking. Selection mode is now its own state: Forward starts it and it only ends with the close button, once the messages are forwarded, when the timeline changes or the feature is turned off. With nothing selected the forward button stays visible but disabled.
This commit is contained in:
@@ -1200,7 +1200,7 @@ extension TimelineViewModel {
|
||||
.sink { [weak self] isEnabled in
|
||||
self?.state.messageSelection.isEnabled = isEnabled
|
||||
if !isEnabled {
|
||||
self?.state.messageSelection.selectedEventIDs.removeAll()
|
||||
self?.state.messageSelection.end()
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
@@ -1218,6 +1218,7 @@ extension TimelineViewModel {
|
||||
return
|
||||
}
|
||||
|
||||
state.messageSelection.isActive = true
|
||||
state.messageSelection.selectedEventIDs.insert(eventID)
|
||||
}
|
||||
|
||||
@@ -1239,7 +1240,7 @@ extension TimelineViewModel {
|
||||
guard state.messageSelection.isActive else { return }
|
||||
|
||||
if isSwitchingTimelines {
|
||||
state.messageSelection.selectedEventIDs.removeAll()
|
||||
state.messageSelection.end()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1249,7 +1250,7 @@ extension TimelineViewModel {
|
||||
|
||||
/// Ends the selection, either from the close button or once the selected messages have been forwarded.
|
||||
func clearMessageSelection() {
|
||||
state.messageSelection.selectedEventIDs.removeAll()
|
||||
state.messageSelection.end()
|
||||
}
|
||||
|
||||
/// Forwards the selection in timeline order, which is unrelated to the order the messages were selected in.
|
||||
|
||||
Reference in New Issue
Block a user