mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
[WIP] Monoforums
This commit is contained in:
@@ -23,6 +23,8 @@ func updateChatPresentationInterfaceStateImpl(
|
||||
_ f: (ChatPresentationInterfaceState) -> ChatPresentationInterfaceState,
|
||||
completion externalCompletion: @escaping (ContainedViewLayoutTransition) -> Void
|
||||
) {
|
||||
let previousChatLocation = selfController.chatDisplayNode.historyNode.chatLocation
|
||||
|
||||
var completion = externalCompletion
|
||||
var temporaryChatPresentationInterfaceState = f(selfController.presentationInterfaceState)
|
||||
|
||||
@@ -434,6 +436,11 @@ func updateChatPresentationInterfaceStateImpl(
|
||||
|
||||
selfController.presentationInterfaceState = updatedChatPresentationInterfaceState
|
||||
|
||||
if selfController.chatDisplayNode.chatLocation != selfController.presentationInterfaceState.chatLocation {
|
||||
let tabSwitchDirection = selfController.chatDisplayNode.chatLocationTabSwitchDirection(from: selfController.chatDisplayNode.chatLocation, to: selfController.presentationInterfaceState.chatLocation)
|
||||
selfController.chatDisplayNode.updateChatLocation(chatLocation: selfController.presentationInterfaceState.chatLocation, transition: transition, tabSwitchDirection: tabSwitchDirection)
|
||||
}
|
||||
|
||||
selfController.updateSlowmodeStatus()
|
||||
|
||||
switch updatedChatPresentationInterfaceState.inputMode {
|
||||
@@ -489,19 +496,25 @@ 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 {
|
||||
if let currentButton = selfController.rightNavigationButton?.action, currentButton == button.action {
|
||||
buttonsAnimated = false
|
||||
if let channel = presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.isForumOrMonoForum {
|
||||
} else {
|
||||
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 {
|
||||
if let currentButton = selfController.rightNavigationButton?.action, currentButton == button.action {
|
||||
buttonsAnimated = false
|
||||
}
|
||||
if case .replyThread = selfController.chatLocation {
|
||||
buttonsAnimated = false
|
||||
}
|
||||
if let channel = updatedChatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.isMonoForum {
|
||||
buttonsAnimated = false
|
||||
}
|
||||
selfController.rightNavigationButton = button
|
||||
}
|
||||
if case .replyThread = selfController.chatLocation {
|
||||
buttonsAnimated = false
|
||||
}
|
||||
selfController.rightNavigationButton = button
|
||||
} else if let _ = selfController.rightNavigationButton {
|
||||
selfController.rightNavigationButton = nil
|
||||
}
|
||||
} else if let _ = selfController.rightNavigationButton {
|
||||
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) {
|
||||
@@ -587,12 +600,10 @@ func updateChatPresentationInterfaceStateImpl(
|
||||
}
|
||||
}
|
||||
|
||||
if selfController.chatDisplayNode.historyNode.chatLocation != selfController.presentationInterfaceState.chatLocation {
|
||||
if previousChatLocation != selfController.presentationInterfaceState.chatLocation {
|
||||
selfController.chatLocation = selfController.presentationInterfaceState.chatLocation
|
||||
selfController.chatDisplayNode.chatLocation = selfController.presentationInterfaceState.chatLocation
|
||||
selfController.reloadChatLocation()
|
||||
selfController.reloadCachedData()
|
||||
selfController.chatDisplayNode.historyNode.updateChatLocation(chatLocation: selfController.presentationInterfaceState.chatLocation)
|
||||
}
|
||||
|
||||
selfController.updateDownButtonVisibility()
|
||||
|
||||
Reference in New Issue
Block a user