mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Add custom web app overscroll background
This commit is contained in:
parent
f7ec8a0bf2
commit
070609d969
@ -188,6 +188,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
|
|
||||||
private let backgroundNode: ASDisplayNode
|
private let backgroundNode: ASDisplayNode
|
||||||
private let headerBackgroundNode: ASDisplayNode
|
private let headerBackgroundNode: ASDisplayNode
|
||||||
|
private let topOverscrollNode: ASDisplayNode
|
||||||
|
|
||||||
fileprivate var webView: WebAppWebView?
|
fileprivate var webView: WebAppWebView?
|
||||||
private var placeholderIcon: (UIImage, Bool)?
|
private var placeholderIcon: (UIImage, Bool)?
|
||||||
@ -218,6 +219,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
|
|
||||||
self.backgroundNode = ASDisplayNode()
|
self.backgroundNode = ASDisplayNode()
|
||||||
self.headerBackgroundNode = ASDisplayNode()
|
self.headerBackgroundNode = ASDisplayNode()
|
||||||
|
self.topOverscrollNode = ASDisplayNode()
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
@ -387,6 +389,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.view.addSubview(webView)
|
self.view.addSubview(webView)
|
||||||
|
webView.scrollView.addSubnode(self.topOverscrollNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc fileprivate func mainButtonPressed() {
|
@objc fileprivate func mainButtonPressed() {
|
||||||
@ -482,6 +485,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
|
|
||||||
transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: .zero, size: layout.size))
|
transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: .zero, size: layout.size))
|
||||||
transition.updateFrame(node: self.headerBackgroundNode, frame: CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: navigationBarHeight)))
|
transition.updateFrame(node: self.headerBackgroundNode, frame: CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: navigationBarHeight)))
|
||||||
|
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 {
|
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)))
|
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)))
|
||||||
@ -718,6 +722,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
color = nil
|
color = nil
|
||||||
}
|
}
|
||||||
transition.updateBackgroundColor(node: self.headerBackgroundNode, color: color ?? .clear)
|
transition.updateBackgroundColor(node: self.headerBackgroundNode, color: color ?? .clear)
|
||||||
|
transition.updateBackgroundColor(node: self.topOverscrollNode, color: color ?? .clear)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleSendData(data string: String) {
|
private func handleSendData(data string: String) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user