Various improvements

This commit is contained in:
Ilya Laktyushin
2023-12-16 15:57:24 +04:00
parent a3126f87a0
commit 7d45c4c9d0
80 changed files with 2816 additions and 1065 deletions

View File

@@ -257,11 +257,20 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
var displayCountAlert = false
var selectionState: ContactListNodeGroupSelectionState?
let reachedLimit = strongSelf.params.reachedLimit
switch strongSelf.contactsNode.contentNode {
case let .contacts(contactsNode):
contactsNode.updateSelectionState { state in
if let state = state {
var updatedState = state.withToggledPeerId(.peer(peer.id))
if let limit = limit, updatedState.selectedPeerIndices.count > limit {
reachedLimit?(Int32(limit))
updatedCount = nil
removedTokenId = nil
addedToken = nil
return state
}
if updatedState.selectedPeerIndices[.peer(peer.id)] == nil {
removedTokenId = peer.id
} else {
@@ -280,7 +289,6 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
}
}
case let .chats(chatsNode):
let reachedLimit = strongSelf.params.reachedLimit
chatsNode.updateState { initialState in
var state = initialState
if state.selectedPeerIds.contains(peer.id) {
@@ -524,6 +532,19 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
}
}
switch self.contactsNode.contentNode {
case let .contacts(contactsNode):
contactsNode.deselectedAll = { [weak self] in
guard let self else {
return
}
self.contactsNode.editableTokens = []
self.requestLayout(transition: ContainedViewLayoutTransition.animated(duration: 0.4, curve: .spring))
}
case .chats:
break
}
self.displayNodeDidLoad()
}