mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Refactor PasswordSetupUI, PassportUI, GalleryUI and related modules
This commit is contained in:
35
submodules/WebUI/Sources/WebControllerNode.swift
Normal file
35
submodules/WebUI/Sources/WebControllerNode.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import WebKit
|
||||
|
||||
final class WebControllerNode: ViewControllerTracingNode {
|
||||
private let webView: WKWebView
|
||||
|
||||
init(url: URL) {
|
||||
let configuration = WKWebViewConfiguration()
|
||||
self.webView = WKWebView(frame: CGRect(), configuration: configuration)
|
||||
if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
|
||||
self.webView.allowsLinkPreview = false
|
||||
}
|
||||
self.webView.allowsBackForwardNavigationGestures = true
|
||||
//webView.navigationDelegate = self
|
||||
|
||||
super.init()
|
||||
|
||||
self.view.addSubview(self.webView)
|
||||
if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
|
||||
self.webView.scrollView.contentInsetAdjustmentBehavior = .never
|
||||
}
|
||||
self.webView.scrollView.contentInset = UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 10.0)
|
||||
|
||||
self.webView.load(URLRequest(url: url))
|
||||
}
|
||||
|
||||
func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
transition.animateView {
|
||||
self.webView.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: max(1.0, layout.size.height)))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user