mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 11:25:38 +00:00
Browser user agent
This commit is contained in:
parent
52f57774df
commit
abe8f6f2c3
@ -152,15 +152,27 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||||||
|
|
||||||
let configuration = WKWebViewConfiguration()
|
let configuration = WKWebViewConfiguration()
|
||||||
|
|
||||||
|
let bundle = Bundle.main
|
||||||
|
let bundleVersion = bundle.infoDictionary?["CFBundleShortVersionString"] ?? ""
|
||||||
|
|
||||||
var proxyServerHost = "magic.org"
|
var proxyServerHost = "magic.org"
|
||||||
if let data = context.currentAppConfiguration.with({ $0 }).data, let hostValue = data["ton_proxy_address"] as? String {
|
if let data = context.currentAppConfiguration.with({ $0 }).data, let hostValue = data["ton_proxy_address"] as? String {
|
||||||
proxyServerHost = hostValue
|
proxyServerHost = hostValue
|
||||||
}
|
}
|
||||||
configuration.setURLSchemeHandler(TonSchemeHandler(proxyServerHost: proxyServerHost), forURLScheme: "tonsite")
|
configuration.setURLSchemeHandler(TonSchemeHandler(proxyServerHost: proxyServerHost), forURLScheme: "tonsite")
|
||||||
|
configuration.allowsInlineMediaPlayback = true
|
||||||
|
configuration.applicationNameForUserAgent = "Telegram-iOS \(bundleVersion)"
|
||||||
|
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
|
||||||
|
configuration.mediaTypesRequiringUserActionForPlayback = []
|
||||||
|
} else {
|
||||||
|
configuration.mediaPlaybackRequiresUserAction = false
|
||||||
|
}
|
||||||
|
|
||||||
self.webView = WKWebView(frame: CGRect(), configuration: configuration)
|
self.webView = WKWebView(frame: CGRect(), configuration: configuration)
|
||||||
self.webView.allowsLinkPreview = true
|
self.webView.allowsLinkPreview = true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if #available(iOS 11.0, *) {
|
if #available(iOS 11.0, *) {
|
||||||
self.webView.scrollView.contentInsetAdjustmentBehavior = .never
|
self.webView.scrollView.contentInsetAdjustmentBehavior = .never
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user