mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Saved messages view as chats
This commit is contained in:
@@ -452,23 +452,58 @@ func updateChatPresentationInterfaceStateImpl(
|
||||
selfController.leftNavigationButton = nil
|
||||
}
|
||||
|
||||
var buttonsAnimated = transition.isAnimated
|
||||
if let button = rightNavigationButtonForChatInterfaceState(context: selfController.context, presentationInterfaceState: updatedChatPresentationInterfaceState, strings: updatedChatPresentationInterfaceState.strings, currentButton: selfController.rightNavigationButton, target: selfController, selector: #selector(selfController.rightNavigationButtonAction), chatInfoNavigationButton: selfController.chatInfoNavigationButton, moreInfoNavigationButton: selfController.moreInfoNavigationButton) {
|
||||
if selfController.rightNavigationButton != button {
|
||||
var animated = transition.isAnimated
|
||||
if let currentButton = selfController.rightNavigationButton?.action, currentButton == button.action {
|
||||
animated = false
|
||||
buttonsAnimated = false
|
||||
}
|
||||
if case .replyThread = selfController.chatLocation {
|
||||
animated = false
|
||||
buttonsAnimated = false
|
||||
}
|
||||
selfController.navigationItem.setRightBarButton(button.buttonItem, animated: animated)
|
||||
selfController.rightNavigationButton = button
|
||||
}
|
||||
} else if let _ = selfController.rightNavigationButton {
|
||||
selfController.navigationItem.setRightBarButton(nil, animated: transition.isAnimated)
|
||||
selfController.rightNavigationButton = nil
|
||||
}
|
||||
|
||||
if let button = secondaryRightNavigationButtonForChatInterfaceState(context: selfController.context, presentationInterfaceState: updatedChatPresentationInterfaceState, strings: updatedChatPresentationInterfaceState.strings, currentButton: selfController.secondaryRightNavigationButton, target: selfController, selector: #selector(selfController.secondaryRightNavigationButtonAction), chatInfoNavigationButton: selfController.chatInfoNavigationButton, moreInfoNavigationButton: selfController.moreInfoNavigationButton) {
|
||||
if selfController.secondaryRightNavigationButton != button {
|
||||
if let currentButton = selfController.secondaryRightNavigationButton?.action, currentButton == button.action {
|
||||
buttonsAnimated = false
|
||||
}
|
||||
if case .replyThread = selfController.chatLocation {
|
||||
buttonsAnimated = false
|
||||
}
|
||||
selfController.secondaryRightNavigationButton = button
|
||||
}
|
||||
} else if let _ = selfController.secondaryRightNavigationButton {
|
||||
selfController.secondaryRightNavigationButton = nil
|
||||
}
|
||||
|
||||
var rightBarButtons: [UIBarButtonItem] = []
|
||||
if let rightNavigationButton = selfController.rightNavigationButton {
|
||||
rightBarButtons.append(rightNavigationButton.buttonItem)
|
||||
}
|
||||
if let secondaryRightNavigationButton = selfController.secondaryRightNavigationButton {
|
||||
rightBarButtons.append(secondaryRightNavigationButton.buttonItem)
|
||||
}
|
||||
var rightBarButtonsUpdated = false
|
||||
let currentRightBarButtons = selfController.navigationItem.rightBarButtonItems ?? []
|
||||
if rightBarButtons.count != currentRightBarButtons.count {
|
||||
rightBarButtonsUpdated = true
|
||||
} else {
|
||||
for i in 0 ..< rightBarButtons.count {
|
||||
if rightBarButtons[i] !== currentRightBarButtons[i] {
|
||||
rightBarButtonsUpdated = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if rightBarButtonsUpdated {
|
||||
selfController.navigationItem.setRightBarButtonItems(rightBarButtons, animated: buttonsAnimated)
|
||||
}
|
||||
|
||||
if let controllerInteraction = selfController.controllerInteraction {
|
||||
if updatedChatPresentationInterfaceState.interfaceState.selectionState != controllerInteraction.selectionState {
|
||||
controllerInteraction.selectionState = updatedChatPresentationInterfaceState.interfaceState.selectionState
|
||||
|
||||
Reference in New Issue
Block a user