mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +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:
@@ -205,17 +205,15 @@ struct TimelineViewStateBindings {
|
||||
var textToBeTranslated: String?
|
||||
}
|
||||
|
||||
/// The state of the multi-selection of messages, active as soon as an item is selected.
|
||||
/// The state of the multi-selection of messages.
|
||||
struct TimelineMessageSelectionState: Equatable {
|
||||
static let limit = 10
|
||||
|
||||
var isEnabled = false
|
||||
/// Stays on when every message is unselected, it only ends when closed or once the messages are forwarded.
|
||||
var isActive = false
|
||||
var selectedEventIDs: Set<String> = []
|
||||
|
||||
var isActive: Bool {
|
||||
!selectedEventIDs.isEmpty
|
||||
}
|
||||
|
||||
var count: Int {
|
||||
selectedEventIDs.count
|
||||
}
|
||||
@@ -228,6 +226,11 @@ struct TimelineMessageSelectionState: Equatable {
|
||||
guard let eventID else { return false }
|
||||
return selectedEventIDs.contains(eventID)
|
||||
}
|
||||
|
||||
mutating func end() {
|
||||
isActive = false
|
||||
selectedEventIDs.removeAll()
|
||||
}
|
||||
}
|
||||
|
||||
struct TimelineItemActionMenuInfo: Equatable, Identifiable {
|
||||
|
||||
Reference in New Issue
Block a user