mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Various improvements
This commit is contained in:
@@ -74,6 +74,13 @@ func leftNavigationButtonForChatInterfaceState(_ presentationInterfaceState: Cha
|
||||
}
|
||||
|
||||
func rightNavigationButtonForChatInterfaceState(context: AccountContext, presentationInterfaceState: ChatPresentationInterfaceState, strings: PresentationStrings, currentButton: ChatNavigationButton?, target: Any?, selector: Selector?, chatInfoNavigationButton: ChatNavigationButton?, moreInfoNavigationButton: ChatNavigationButton?) -> ChatNavigationButton? {
|
||||
var hasMessages = false
|
||||
if let chatHistoryState = presentationInterfaceState.chatHistoryState {
|
||||
if case .loaded(false, _) = chatHistoryState {
|
||||
hasMessages = true
|
||||
}
|
||||
}
|
||||
|
||||
if let _ = presentationInterfaceState.interfaceState.selectionState {
|
||||
if case .messageOptions = presentationInterfaceState.subject {
|
||||
return nil
|
||||
@@ -100,12 +107,18 @@ func rightNavigationButtonForChatInterfaceState(context: AccountContext, present
|
||||
}
|
||||
|
||||
if let channel = presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.isMonoForum, case .peer = presentationInterfaceState.chatLocation {
|
||||
if case .search(false) = currentButton?.action {
|
||||
return currentButton
|
||||
let displaySearch = hasMessages
|
||||
|
||||
if displaySearch {
|
||||
if case .search(false) = currentButton?.action {
|
||||
return currentButton
|
||||
} else {
|
||||
let buttonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(presentationInterfaceState.theme), style: .plain, target: target, action: selector)
|
||||
buttonItem.accessibilityLabel = strings.Conversation_Search
|
||||
return ChatNavigationButton(action: .search(hasTags: false), buttonItem: buttonItem)
|
||||
}
|
||||
} else {
|
||||
let buttonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(presentationInterfaceState.theme), style: .plain, target: target, action: selector)
|
||||
buttonItem.accessibilityLabel = strings.Conversation_Search
|
||||
return ChatNavigationButton(action: .search(hasTags: false), buttonItem: buttonItem)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,13 +132,6 @@ func rightNavigationButtonForChatInterfaceState(context: AccountContext, present
|
||||
}
|
||||
}
|
||||
|
||||
var hasMessages = false
|
||||
if let chatHistoryState = presentationInterfaceState.chatHistoryState {
|
||||
if case .loaded(false, _) = chatHistoryState {
|
||||
hasMessages = true
|
||||
}
|
||||
}
|
||||
|
||||
if case .messageOptions = presentationInterfaceState.subject {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user