Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-03-23 12:39:40 +05:00
parent 5d22762ab2
commit 44e243d1b1
3 changed files with 14 additions and 18 deletions

View File

@ -302,7 +302,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
let previousEditingAndNetworkState = previousEditingAndNetworkStateValue.swap((stateAndFilterId.state.editing, networkState))
if stateAndFilterId.state.editing {
if strongSelf.groupId == .root {
strongSelf.navigationItem.rightBarButtonItem = nil
strongSelf.navigationItem.setRightBarButton(nil, animated: true)
}
let title = !stateAndFilterId.state.selectedPeerIds.isEmpty ? strongSelf.presentationData.strings.ChatList_SelectedChats(Int32(stateAndFilterId.state.selectedPeerIds.count)) : defaultTitle
@ -315,10 +315,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
strongSelf.titleView.setTitle(NetworkStatusTitle(text: title, activity: false, hasProxy: false, connectsViaProxy: false, isPasscodeSet: false, isManuallyLocked: false), animated: animated)
} else if isReorderingTabs {
if strongSelf.groupId == .root {
strongSelf.navigationItem.rightBarButtonItem = nil
strongSelf.navigationItem.setRightBarButton(nil, animated: true)
}
let leftBarButtonItem = UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Done, style: .done, target: strongSelf, action: #selector(strongSelf.reorderingDonePressed))
strongSelf.navigationItem.leftBarButtonItem = leftBarButtonItem
strongSelf.navigationItem.setLeftBarButton(leftBarButtonItem, animated: true)
let (_, connectsViaProxy) = proxy
switch networkState {
@ -341,16 +341,16 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
isRoot = true
if isReorderingTabs {
strongSelf.navigationItem.rightBarButtonItem = nil
strongSelf.navigationItem.setRightBarButton(nil, animated: true)
} else {
let rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationComposeIcon(strongSelf.presentationData.theme), style: .plain, target: strongSelf, action: #selector(strongSelf.composePressed))
rightBarButtonItem.accessibilityLabel = strongSelf.presentationData.strings.VoiceOver_Navigation_Compose
strongSelf.navigationItem.rightBarButtonItem = rightBarButtonItem
strongSelf.navigationItem.setRightBarButton(rightBarButtonItem, animated: true)
}
if isReorderingTabs {
let leftBarButtonItem = UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Done, style: .done, target: strongSelf, action: #selector(strongSelf.reorderingDonePressed))
strongSelf.navigationItem.leftBarButtonItem = leftBarButtonItem
strongSelf.navigationItem.setLeftBarButton(leftBarButtonItem, animated: true)
} else {
let editItem: UIBarButtonItem
if stateAndFilterId.state.editing {
@ -360,7 +360,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
editItem = UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Edit, style: .plain, target: self, action: #selector(strongSelf.editPressed))
editItem.accessibilityLabel = strongSelf.presentationData.strings.Common_Edit
}
strongSelf.navigationItem.leftBarButtonItem = editItem
strongSelf.navigationItem.setLeftBarButton(editItem, animated: true)
}
}

View File

@ -258,17 +258,6 @@ public final class SearchDisplayController {
let backgroundNode = self.backgroundNode
let contentNode = self.contentNode
if animated {
if let placeholder = placeholder, let (layout, navigationBarHeight) = self.containerLayout {
let contentNodePosition = self.backgroundNode.layer.position
let targetTextBackgroundFrame = placeholder.convert(placeholder.backgroundNode.frame, to: nil)
var contentNavigationBarHeight = navigationBarHeight
if layout.statusBarHeight == nil {
contentNavigationBarHeight += 28.0
}
// self.backgroundNode.layer.animatePosition(from: contentNodePosition, to: CGPoint(x: contentNodePosition.x, y: contentNodePosition.y + (targetTextBackgroundFrame.maxY + 8.0 - contentNavigationBarHeight)), duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false)
}
backgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak backgroundNode] _ in
backgroundNode?.removeFromSupernode()
})

View File

@ -93,7 +93,11 @@ final class ThemeGridSearchColorsNode: ASDisplayNode {
return CGSize(width: constrainedSize.width, height: 100.0)
}
private var validLayout: (CGSize, CGFloat, CGFloat)?
func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat) {
let hadLayout = self.validLayout != nil
self.validLayout = (size, leftInset, rightInset)
self.sectionHeaderNode.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 29.0))
self.sectionHeaderNode.updateLayout(size: CGSize(width: size.width, height: 29.0), leftInset: leftInset, rightInset: rightInset)
@ -103,6 +107,9 @@ final class ThemeGridSearchColorsNode: ASDisplayNode {
self.scrollNode.frame = CGRect(x: 0.0, y: 29.0, width: size.width, height: size.height - 29.0)
self.scrollNode.view.contentInset = insets
if !hadLayout {
self.scrollNode.view.contentOffset = CGPoint(x: -leftInset, y: 0.0)
}
var offset: CGFloat = inset
if let subnodes = self.scrollNode.subnodes {