mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
7d95c0a512
commit
ccf6956beb
@ -1575,7 +1575,8 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
}
|
||||
|
||||
self.moreButtonNode = MoreButtonNode(theme: self.presentationData.theme)
|
||||
|
||||
self.moreButtonNode.iconNode.enqueueState(.more, animated: false)
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: presentationData))
|
||||
|
||||
self.statusBar.statusBarStyle = .Ignore
|
||||
@ -1647,11 +1648,11 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
if collection == nil {
|
||||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed))
|
||||
|
||||
if mode == .story || mode == .addImage {
|
||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customDisplayNode: self.moreButtonNode)
|
||||
self.navigationItem.rightBarButtonItem?.action = #selector(self.rightButtonPressed)
|
||||
self.navigationItem.rightBarButtonItem?.target = self
|
||||
}
|
||||
// if mode == .story || mode == .addImage {
|
||||
// self.navigationItem.rightBarButtonItem = UIBarButtonItem(customDisplayNode: self.moreButtonNode)
|
||||
// self.navigationItem.rightBarButtonItem?.action = #selector(self.rightButtonPressed)
|
||||
// self.navigationItem.rightBarButtonItem?.target = self
|
||||
// }
|
||||
} else {
|
||||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(backButtonAppearanceWithTitle: self.presentationData.strings.Common_Back, target: self, action: #selector(self.backPressed))
|
||||
}
|
||||
@ -1785,11 +1786,11 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
|
||||
self.updateSelectionState(count: Int32(selectionContext.count()))
|
||||
|
||||
self.longTapWithTabBar = { [weak self] in
|
||||
if let self, self.groupsController == nil {
|
||||
self.presentSearch(activateOnDisplay: false)
|
||||
}
|
||||
}
|
||||
// self.longTapWithTabBar = { [weak self] in
|
||||
// if let self, self.groupsController == nil {
|
||||
// self.presentSearch(activateOnDisplay: false)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
@ -1965,19 +1966,23 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
private var selectionCount: Int32 = 0
|
||||
fileprivate func updateSelectionState(count: Int32) {
|
||||
self.selectionCount = count
|
||||
|
||||
|
||||
var moreIsVisible = false
|
||||
if case let .media(media) = self.subject {
|
||||
self.titleView.title = media.count == 1 ? self.presentationData.strings.Attachment_Pasteboard : self.presentationData.strings.Attachment_SelectedMedia(count)
|
||||
self.titleView.segmentsHidden = true
|
||||
self.moreButtonNode.iconNode.enqueueState(.more, animated: false)
|
||||
moreIsVisible = true
|
||||
// self.moreButtonNode.iconNode.enqueueState(.more, animated: false)
|
||||
} else {
|
||||
if count > 0 {
|
||||
self.titleView.segments = [self.presentationData.strings.Attachment_AllMedia, self.presentationData.strings.Attachment_SelectedMedia(count)]
|
||||
self.titleView.segmentsHidden = false
|
||||
self.moreButtonNode.iconNode.enqueueState(.more, animated: true)
|
||||
moreIsVisible = true
|
||||
// self.moreButtonNode.iconNode.enqueueState(.more, animated: true)
|
||||
} else {
|
||||
self.titleView.segmentsHidden = true
|
||||
self.moreButtonNode.iconNode.enqueueState(.search, animated: true)
|
||||
moreIsVisible = false
|
||||
// self.moreButtonNode.iconNode.enqueueState(.search, animated: true)
|
||||
|
||||
if self.titleView.index != 0 {
|
||||
Queue.mainQueue().after(0.3) {
|
||||
@ -1986,6 +1991,10 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.25, curve: .easeInOut)
|
||||
transition.updateAlpha(node: self.moreButtonNode.iconNode, alpha: moreIsVisible ? 1.0 : 0.0)
|
||||
transition.updateTransformScale(node: self.moreButtonNode.iconNode, scale: moreIsVisible ? 1.0 : 0.1)
|
||||
}
|
||||
|
||||
private func updateThemeAndStrings() {
|
||||
@ -2149,7 +2158,8 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
@objc private func searchOrMorePressed(node: ContextReferenceContentNode, gesture: ContextGesture?) {
|
||||
switch self.moreButtonNode.iconNode.iconState {
|
||||
case .search:
|
||||
self.presentSearch(activateOnDisplay: true)
|
||||
// self.presentSearch(activateOnDisplay: true)
|
||||
break
|
||||
case .more:
|
||||
let strings = self.presentationData.strings
|
||||
let selectionCount = self.selectionCount
|
||||
|
@ -145,7 +145,10 @@ public final class MoreButtonNode: ASDisplayNode {
|
||||
override public func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
|
||||
let animationSize = CGSize(width: 30.0, height: 30.0)
|
||||
let inset: CGFloat = 0.0
|
||||
self.iconNode.frame = CGRect(origin: CGPoint(x: inset + 6.0, y: floor((constrainedSize.height - animationSize.height) / 2.0) + 1.0), size: animationSize)
|
||||
let iconFrame = CGRect(origin: CGPoint(x: inset + 6.0, y: floor((constrainedSize.height - animationSize.height) / 2.0) + 1.0), size: animationSize)
|
||||
|
||||
self.iconNode.position = iconFrame.center
|
||||
self.iconNode.bounds = CGRect(origin: .zero, size: iconFrame.size)
|
||||
|
||||
let size = CGSize(width: animationSize.width + inset * 2.0, height: constrainedSize.height)
|
||||
let bounds = CGRect(origin: CGPoint(), size: size)
|
||||
|
@ -307,7 +307,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
|
||||
let (messageButtonWidth, messageContinueLayout) = makeMessageButtonLayout(constrainedSize.width, nil, false, item.presentationData.strings.Conversation_ContactMessage.uppercased(), mainColor, false, false)
|
||||
let (addButtonWidth, addContinueLayout) = makeAddButtonLayout(constrainedSize.width, nil, false, item.presentationData.strings.Conversation_ContactAddContact.uppercased(), mainColor, false, false)
|
||||
let (addButtonWidth, addContinueLayout) = makeAddButtonLayout(constrainedSize.width, nil, false, !canMessage && !canAdd ? item.presentationData.strings.Conversation_ViewContactDetails.uppercased() : item.presentationData.strings.Conversation_ContactAddContact.uppercased(), mainColor, false, false)
|
||||
|
||||
let maxButtonWidth = max(messageButtonWidth, addButtonWidth)
|
||||
var maxContentWidth: CGFloat = avatarSize.width + 7.0
|
||||
@ -326,13 +326,10 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
let lineWidth: CGFloat = 3.0
|
||||
|
||||
var buttonCount = 0
|
||||
var buttonCount = 1
|
||||
if canMessage {
|
||||
buttonCount += 1
|
||||
}
|
||||
if canAdd {
|
||||
buttonCount += 1
|
||||
}
|
||||
var buttonWidth = floor((boundingWidth - layoutConstants.text.bubbleInsets.right * 2.0 - lineWidth))
|
||||
if buttonCount > 1 {
|
||||
buttonWidth /= CGFloat(buttonCount)
|
||||
@ -385,7 +382,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
strongSelf.textNode.frame = CGRect(origin: CGPoint(x: avatarFrame.maxX + 7.0, y: avatarFrame.minY + 20.0), size: textLayout.size)
|
||||
|
||||
strongSelf.addButtonNode.frame = addButtonFrame
|
||||
strongSelf.addButtonNode.isHidden = !canAdd
|
||||
strongSelf.addButtonNode.isHidden = !canAdd && canMessage
|
||||
strongSelf.messageButtonNode.frame = messageButtonFrame
|
||||
strongSelf.messageButtonNode.isHidden = !canMessage
|
||||
|
||||
|
@ -649,7 +649,14 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
transition.updateFrame(node: self.topOverscrollNode, frame: CGRect(origin: CGPoint(x: 0.0, y: -1000.0), size: CGSize(width: layout.size.width, height: 1000.0)))
|
||||
|
||||
if let webView = self.webView {
|
||||
let frame = CGRect(origin: CGPoint(x: layout.safeInsets.left, y: navigationBarHeight), size: CGSize(width: layout.size.width - layout.safeInsets.left - layout.safeInsets.right, height: max(1.0, layout.size.height - navigationBarHeight - layout.intrinsicInsets.bottom)))
|
||||
var scrollInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: layout.intrinsicInsets.bottom, right: 0.0)
|
||||
var frameBottomInset: CGFloat = 0.0
|
||||
if scrollInset.bottom > 40.0 {
|
||||
frameBottomInset = scrollInset.bottom
|
||||
scrollInset.bottom = 0.0
|
||||
}
|
||||
|
||||
let frame = CGRect(origin: CGPoint(x: layout.safeInsets.left, y: navigationBarHeight), size: CGSize(width: layout.size.width - layout.safeInsets.left - layout.safeInsets.right, height: max(1.0, layout.size.height - navigationBarHeight - frameBottomInset)))
|
||||
|
||||
var bottomInset = layout.intrinsicInsets.bottom + layout.additionalInsets.bottom
|
||||
if let inputHeight = self.validLayout?.0.inputHeight, inputHeight > 44.0 {
|
||||
@ -657,6 +664,11 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
}
|
||||
let viewportFrame = CGRect(origin: CGPoint(x: layout.safeInsets.left, y: navigationBarHeight), size: CGSize(width: layout.size.width - layout.safeInsets.left - layout.safeInsets.right, height: max(1.0, layout.size.height - navigationBarHeight - bottomInset)))
|
||||
|
||||
if webView.scrollView.contentInset != scrollInset {
|
||||
webView.scrollView.contentInset = scrollInset
|
||||
webView.scrollView.scrollIndicatorInsets = scrollInset
|
||||
}
|
||||
|
||||
if previousLayout != nil && (previousLayout?.inputHeight ?? 0.0).isZero, let inputHeight = layout.inputHeight, inputHeight > 44.0, transition.isAnimated {
|
||||
webView.scrollToActiveElement(layout: layout, completion: { [weak self] contentOffset in
|
||||
self?.targetContentOffset = contentOffset
|
||||
|
Loading…
x
Reference in New Issue
Block a user