Comment improvements

This commit is contained in:
Ali
2020-09-11 13:08:04 +01:00
parent 04e4297fdb
commit 0fbc4f7009
11 changed files with 99 additions and 36 deletions

View File

@@ -75,17 +75,15 @@ func rightNavigationButtonForChatInterfaceState(_ presentationInterfaceState: Ch
}
}
if case .replyThread = presentationInterfaceState.chatLocation {
if case .search = 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, buttonItem: buttonItem)
var hasMessages = false
if let chatHistoryState = presentationInterfaceState.chatHistoryState {
if case .loaded(false) = chatHistoryState {
hasMessages = true
}
}
if case let .peer(peerId) = presentationInterfaceState.chatLocation {
if peerId.isReplies {
if case .replyThread = presentationInterfaceState.chatLocation {
if hasMessages {
if case .search = currentButton?.action {
return currentButton
} else {
@@ -93,6 +91,23 @@ func rightNavigationButtonForChatInterfaceState(_ presentationInterfaceState: Ch
buttonItem.accessibilityLabel = strings.Conversation_Search
return ChatNavigationButton(action: .search, buttonItem: buttonItem)
}
} else {
return nil
}
}
if case let .peer(peerId) = presentationInterfaceState.chatLocation {
if peerId.isReplies {
if hasMessages {
if case .search = 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, buttonItem: buttonItem)
}
} else {
return nil
}
}
}