mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Improvements
This commit is contained in:
parent
989ef5d6a0
commit
5aeef57fc9
@ -47,7 +47,7 @@ open class GalleryOverlayContentNode: ASDisplayNode {
|
||||
self.visibilityAlpha = alpha
|
||||
}
|
||||
|
||||
open func updateLayout(size: CGSize, metrics: LayoutMetrics, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
open func updateLayout(size: CGSize, metrics: LayoutMetrics, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, isHidden: Bool, transition: ContainedViewLayoutTransition) {
|
||||
}
|
||||
|
||||
open func animateIn(previousContentNode: GalleryOverlayContentNode?, transition: ContainedViewLayoutTransition) {
|
||||
|
@ -101,7 +101,7 @@ public final class GalleryFooterNode: ASDisplayNode {
|
||||
|
||||
let contentTransition = ContainedViewLayoutTransition.animated(duration: 0.4, curve: .spring)
|
||||
if let overlayContentNode = self.currentOverlayContentNode {
|
||||
overlayContentNode.updateLayout(size: layout.size, metrics: layout.metrics, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: backgroundHeight, transition: transition)
|
||||
overlayContentNode.updateLayout(size: layout.size, metrics: layout.metrics, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: isHidden ? layout.intrinsicInsets.bottom : backgroundHeight, isHidden: isHidden, transition: transition)
|
||||
transition.updateFrame(node: overlayContentNode, frame: CGRect(origin: CGPoint(), size: layout.size))
|
||||
|
||||
if animateOverlayIn {
|
||||
|
@ -1141,6 +1141,11 @@ private class ImageRecognitionOverlayContentNode: GalleryOverlayContentNode {
|
||||
self.action?(newValue)
|
||||
self.buttonNode.isSelected = newValue
|
||||
self.selectedBackgroundNode.isHidden = !newValue
|
||||
|
||||
if self.interfaceIsHidden && !newValue {
|
||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut)
|
||||
transition.updateAlpha(node: self.buttonNode, alpha: 0.0)
|
||||
}
|
||||
}
|
||||
|
||||
func transitionIn() {
|
||||
@ -1152,17 +1157,28 @@ private class ImageRecognitionOverlayContentNode: GalleryOverlayContentNode {
|
||||
self.buttonNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
}
|
||||
|
||||
override func updateLayout(size: CGSize, metrics: LayoutMetrics, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
private var interfaceIsHidden: Bool = false
|
||||
override func updateLayout(size: CGSize, metrics: LayoutMetrics, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, isHidden: Bool, transition: ContainedViewLayoutTransition) {
|
||||
self.interfaceIsHidden = isHidden
|
||||
|
||||
let buttonSize = CGSize(width: 32.0, height: 32.0)
|
||||
self.backgroundNode.frame = CGRect(origin: CGPoint(), size: buttonSize)
|
||||
self.selectedBackgroundNode.frame = CGRect(origin: CGPoint(), size: buttonSize)
|
||||
self.iconNode.frame = CGRect(origin: CGPoint(), size: buttonSize)
|
||||
|
||||
if self.appeared {
|
||||
if !self.buttonNode.isSelected && isHidden {
|
||||
transition.updateAlpha(node: self.buttonNode, alpha: 0.0)
|
||||
} else {
|
||||
transition.updateAlpha(node: self.buttonNode, alpha: 1.0)
|
||||
}
|
||||
}
|
||||
|
||||
transition.updateFrame(node: self.buttonNode, frame: CGRect(x: size.width - rightInset - buttonSize.width - 12.0, y: size.height - bottomInset - buttonSize.height - 12.0, width: buttonSize.width, height: buttonSize.height))
|
||||
}
|
||||
|
||||
override func animateIn(previousContentNode: GalleryOverlayContentNode?, transition: ContainedViewLayoutTransition) {
|
||||
guard self.appeared else {
|
||||
guard self.appeared && (!self.interfaceIsHidden || self.buttonNode.isSelected) else {
|
||||
return
|
||||
}
|
||||
self.buttonNode.alpha = 1.0
|
||||
|
@ -203,7 +203,7 @@ private final class UniversalVideoGalleryItemOverlayNode: GalleryOverlayContentN
|
||||
self.fullscreenNode.addTarget(self, action: #selector(self.toggleFullscreenPressed), forControlEvents: .touchUpInside)
|
||||
}
|
||||
|
||||
override func updateLayout(size: CGSize, metrics: LayoutMetrics, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
override func updateLayout(size: CGSize, metrics: LayoutMetrics, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, isHidden: Bool, transition: ContainedViewLayoutTransition) {
|
||||
self.validLayout = (size, metrics, leftInset, rightInset, bottomInset)
|
||||
|
||||
let isLandscape = size.width > size.height
|
||||
@ -235,7 +235,7 @@ private final class UniversalVideoGalleryItemOverlayNode: GalleryOverlayContentN
|
||||
self.wrapperNode.alpha = self.visibilityAlpha
|
||||
|
||||
if let validLayout = self.validLayout {
|
||||
self.updateLayout(size: validLayout.0, metrics: validLayout.1, leftInset: validLayout.2, rightInset: validLayout.3, bottomInset: validLayout.4, transition: .animated(duration: 0.3, curve: .easeInOut))
|
||||
self.updateLayout(size: validLayout.0, metrics: validLayout.1, leftInset: validLayout.2, rightInset: validLayout.3, bottomInset: validLayout.4, isHidden: false, transition: .animated(duration: 0.3, curve: .easeInOut))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -716,7 +716,7 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
|
||||
}
|
||||
|
||||
private func updateCounterTextNode(transition: ContainedViewLayoutTransition) {
|
||||
let inputTextMaxLength: Int?
|
||||
let inputTextMaxLength: Int32?
|
||||
if self.isCaption {
|
||||
inputTextMaxLength = self.context?.currentLimitsConfiguration.with { $0 }.maxMediaCaptionLength
|
||||
} else {
|
||||
@ -1034,13 +1034,13 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
|
||||
sendPressed(effectiveInputText)
|
||||
return
|
||||
}
|
||||
let inputTextMaxLength: Int?
|
||||
let inputTextMaxLength: Int32?
|
||||
if self.isCaption {
|
||||
inputTextMaxLength = self.context?.currentLimitsConfiguration.with { $0 }.maxMediaCaptionLength
|
||||
} else {
|
||||
inputTextMaxLength = nil
|
||||
}
|
||||
if let textInputNode = self.textInputNode, let presentationInterfaceState = self.presentationInterfaceState, let inputTextMaxLength = inputTextMaxLength {
|
||||
if let textInputNode = self.textInputNode, let inputTextMaxLength = inputTextMaxLength {
|
||||
let textCount = Int32(textInputNode.textView.text.count)
|
||||
let remainingCount = inputTextMaxLength - textCount
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user