mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various fixes
This commit is contained in:
parent
d88a29b378
commit
c9b76c9294
7 changed files with 78 additions and 31 deletions
|
|
@ -179,6 +179,7 @@ public protocol NavigationBar: ASDisplayNode {
|
|||
var leftButtonNode: NavigationButtonNode { get }
|
||||
var rightButtonNode: NavigationButtonNode { get }
|
||||
var additionalContentNode: SparseNode { get }
|
||||
var edgeEffectView: UIView? { get }
|
||||
|
||||
func reattachAdditionalContentNode()
|
||||
|
||||
|
|
|
|||
|
|
@ -583,11 +583,14 @@ public final class NavigationBarImpl: ASDisplayNode, NavigationBar {
|
|||
public var secondaryContentHeight: CGFloat
|
||||
|
||||
private var edgeEffectExtension: CGFloat = 0.0
|
||||
private var edgeEffectView: EdgeEffectView?
|
||||
private var edgeEffectViewImpl: EdgeEffectView?
|
||||
public var edgeEffectView: UIView? {
|
||||
return self.edgeEffectViewImpl
|
||||
}
|
||||
private var backgroundContainer: GlassBackgroundContainerView?
|
||||
|
||||
public var backgroundView: UIView {
|
||||
if let edgeEffectView = self.edgeEffectView {
|
||||
if let edgeEffectView = self.edgeEffectViewImpl {
|
||||
return edgeEffectView
|
||||
} else {
|
||||
return self.backgroundNode.view
|
||||
|
|
@ -654,7 +657,7 @@ public final class NavigationBarImpl: ASDisplayNode, NavigationBar {
|
|||
if case .glass = presentationData.theme.style {
|
||||
let edgeEffectView = EdgeEffectView()
|
||||
edgeEffectView.isUserInteractionEnabled = false
|
||||
self.edgeEffectView = edgeEffectView
|
||||
self.edgeEffectViewImpl = edgeEffectView
|
||||
self.view.addSubview(edgeEffectView)
|
||||
|
||||
let backgroundContainer = GlassBackgroundContainerView()
|
||||
|
|
@ -818,7 +821,7 @@ public final class NavigationBarImpl: ASDisplayNode, NavigationBar {
|
|||
backgroundContainer.update(size: backgroundContainerFrame.size, isDark: self.presentationData.theme.overallDarkAppearance, transition: ComponentTransition(transition))
|
||||
}
|
||||
|
||||
if let edgeEffectView = self.edgeEffectView {
|
||||
if let edgeEffectView = self.edgeEffectViewImpl {
|
||||
if let edgeEffectColor = self.presentationData.theme.edgeEffectColor, edgeEffectColor.alpha == 0.0 {
|
||||
edgeEffectView.isHidden = true
|
||||
} else {
|
||||
|
|
@ -1131,7 +1134,7 @@ public final class NavigationBarImpl: ASDisplayNode, NavigationBar {
|
|||
}
|
||||
|
||||
private func applyEdgeEffectExtension(transition: ContainedViewLayoutTransition) {
|
||||
if let edgeEffectView = self.edgeEffectView {
|
||||
if let edgeEffectView = self.edgeEffectViewImpl {
|
||||
transition.updateTransform(layer: edgeEffectView.layer, transform: CATransform3DMakeTranslation(0.0, max(0.0, min(20.0, self.edgeEffectExtension)), 0.0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import ViewControllerComponent
|
|||
import MultilineTextComponent
|
||||
import BalancedTextComponent
|
||||
import BackButtonComponent
|
||||
import EdgeEffect
|
||||
import ListSectionComponent
|
||||
import ListActionItemComponent
|
||||
import ListTextFieldItemComponent
|
||||
|
|
@ -144,6 +145,7 @@ final class ChatbotSetupScreenComponent: Component {
|
|||
private let scrollView: ScrollView
|
||||
|
||||
private let navigationTitle = ComponentView<Empty>()
|
||||
private let titleTransformContainer: UIView
|
||||
private let icon = ComponentView<Empty>()
|
||||
private let subtitle = ComponentView<Empty>()
|
||||
private let nameSection = ComponentView<Empty>()
|
||||
|
|
@ -190,6 +192,9 @@ final class ChatbotSetupScreenComponent: Component {
|
|||
}
|
||||
self.scrollView.alwaysBounceVertical = true
|
||||
|
||||
self.titleTransformContainer = UIView()
|
||||
self.titleTransformContainer.isUserInteractionEnabled = false
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.scrollView.delegate = self
|
||||
|
|
@ -203,6 +208,7 @@ final class ChatbotSetupScreenComponent: Component {
|
|||
}
|
||||
|
||||
deinit {
|
||||
self.titleTransformContainer.removeFromSuperview()
|
||||
}
|
||||
|
||||
func scrollToTop() {
|
||||
|
|
@ -251,33 +257,29 @@ final class ChatbotSetupScreenComponent: Component {
|
|||
self.updateScrolling(transition: .immediate)
|
||||
}
|
||||
|
||||
var scrolledUp = true
|
||||
private func updateScrolling(transition: ComponentTransition) {
|
||||
let navigationRevealOffsetY: CGFloat = 0.0
|
||||
|
||||
let navigationAlphaDistance: CGFloat = 16.0
|
||||
let navigationAlpha: CGFloat = max(0.0, min(1.0, (self.scrollView.contentOffset.y - navigationRevealOffsetY) / navigationAlphaDistance))
|
||||
if let controller = self.environment?.controller(), let navigationBar = controller.navigationBar {
|
||||
transition.setAlpha(layer: navigationBar.backgroundNode.layer, alpha: navigationAlpha)
|
||||
transition.setAlpha(layer: navigationBar.stripeNode.layer, alpha: navigationAlpha)
|
||||
guard let environment = self.environment else {
|
||||
return
|
||||
}
|
||||
|
||||
var scrolledUp = false
|
||||
if navigationAlpha < 0.5 {
|
||||
scrolledUp = true
|
||||
} else if navigationAlpha > 0.5 {
|
||||
scrolledUp = false
|
||||
}
|
||||
let titleCenterY: CGFloat = environment.statusBarHeight + (environment.navigationHeight - environment.statusBarHeight) * 0.5
|
||||
let titleTransformDistance: CGFloat = 20.0
|
||||
let titleY: CGFloat = max(titleCenterY, self.titleTransformContainer.center.y - self.scrollView.contentOffset.y)
|
||||
|
||||
if self.scrolledUp != scrolledUp {
|
||||
self.scrolledUp = scrolledUp
|
||||
if !self.isUpdating {
|
||||
self.state?.updated()
|
||||
}
|
||||
}
|
||||
transition.setSublayerTransform(view: self.titleTransformContainer, transform: CATransform3DMakeTranslation(0.0, titleY - self.titleTransformContainer.center.y, 0.0))
|
||||
|
||||
let titleYDistance: CGFloat = titleY - titleCenterY
|
||||
let titleTransformFraction: CGFloat = 1.0 - max(0.0, min(1.0, titleYDistance / titleTransformDistance))
|
||||
let titleMinScale: CGFloat = 17.0 / 24.0
|
||||
let titleScale: CGFloat = 1.0 * (1.0 - titleTransformFraction) + titleMinScale * titleTransformFraction
|
||||
if let navigationTitleView = self.navigationTitle.view {
|
||||
transition.setAlpha(view: navigationTitleView, alpha: 1.0)
|
||||
transition.setScale(view: navigationTitleView, scale: titleScale)
|
||||
}
|
||||
|
||||
if let controller = environment.controller(), let navigationBar = controller.navigationBar, let edgeEffectView = navigationBar.edgeEffectView {
|
||||
let edgeEffectAlphaDistance = max(1.0, self.titleTransformContainer.center.y - titleCenterY)
|
||||
let edgeEffectAlpha = max(0.0, min(1.0, self.scrollView.contentOffset.y / edgeEffectAlphaDistance))
|
||||
transition.setAlpha(view: edgeEffectView, alpha: edgeEffectAlpha)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -652,13 +654,30 @@ final class ChatbotSetupScreenComponent: Component {
|
|||
containerSize: CGSize(width: availableSize.width, height: 100.0)
|
||||
)
|
||||
let navigationTitleFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - navigationTitleSize.width) / 2.0), y: environment.navigationHeight + 76.0), size: navigationTitleSize)
|
||||
if let navigationTitleView = self.navigationTitle.view {
|
||||
if navigationTitleView.superview == nil {
|
||||
if let controller = self.environment?.controller(), let navigationBar = controller.navigationBar {
|
||||
navigationBar.view.addSubview(navigationTitleView)
|
||||
let overlaySuperview: UIView?
|
||||
if let controller = environment.controller(), let navigationBar = controller.navigationBar, let navigationBarSuperview = navigationBar.view.superview {
|
||||
overlaySuperview = navigationBarSuperview
|
||||
} else {
|
||||
overlaySuperview = self
|
||||
}
|
||||
if let overlaySuperview {
|
||||
if self.titleTransformContainer.superview !== overlaySuperview {
|
||||
self.titleTransformContainer.removeFromSuperview()
|
||||
if let controller = environment.controller(), let navigationBar = controller.navigationBar, overlaySuperview === navigationBar.view.superview {
|
||||
overlaySuperview.insertSubview(self.titleTransformContainer, aboveSubview: navigationBar.view)
|
||||
} else {
|
||||
overlaySuperview.addSubview(self.titleTransformContainer)
|
||||
}
|
||||
}
|
||||
transition.setFrame(view: navigationTitleView, frame: navigationTitleFrame)
|
||||
}
|
||||
if let navigationTitleView = self.navigationTitle.view {
|
||||
if navigationTitleView.superview !== self.titleTransformContainer {
|
||||
navigationTitleView.removeFromSuperview()
|
||||
self.titleTransformContainer.addSubview(navigationTitleView)
|
||||
}
|
||||
transition.setPosition(view: self.titleTransformContainer, position: navigationTitleFrame.center)
|
||||
transition.setBounds(view: self.titleTransformContainer, bounds: CGRect(origin: CGPoint(), size: navigationTitleFrame.size))
|
||||
transition.setFrame(view: navigationTitleView, frame: CGRect(origin: CGPoint(), size: navigationTitleFrame.size))
|
||||
}
|
||||
|
||||
let bottomContentInset: CGFloat = 24.0
|
||||
|
|
|
|||
12
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/AddMusic.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/AddMusic.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "addmusic.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/AddMusic.imageset/addmusic.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/AddMusic.imageset/addmusic.pdf
vendored
Normal file
Binary file not shown.
12
submodules/TelegramUI/Images.xcassets/Navigation/CreateGroup.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Navigation/CreateGroup.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "sharenewgroup.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
submodules/TelegramUI/Images.xcassets/Navigation/CreateGroup.imageset/sharenewgroup.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Navigation/CreateGroup.imageset/sharenewgroup.pdf
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue