Commit 0366852f authored by DavidHuang's avatar DavidHuang

文章详情 添加 app标签

parent ca103504
......@@ -18,7 +18,31 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
var block: Block?
var viewModel: YHHomeWebViewModel!
var webview = DWKWebView()
// var webview = DWKWebView()
lazy var webview : DWKWebView = {
let config = WKWebViewConfiguration()
config.applicationNameForUserAgent = "YinHeApp"
#if DEBUG
if #available(iOS 14.5, *) {
config.upgradeKnownHostsToHTTPS = false
} else {
// Fallback on earlier versions
}
#endif
config.allowsInlineMediaPlayback = true
/// 开启让自动播放
config.mediaTypesRequiringUserActionForPlayback = []
let webview = DWKWebView(frame: .zero, configuration: config)
webview.scrollView.contentInsetAdjustmentBehavior = .never
webview.navigationDelegate = self
// webview.scrollView.delegate = self
webview.setDebugMode(false)
// webview.uiDelegate = self
return webview
}()
var progBar = UIProgressView()
var bottomView: YHHomeWebBottomView!
var url = ""
......@@ -110,7 +134,7 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
// 创建wkwebview
webview = DWKWebView(frame: CGRect(x: 0, y: statusHeight + navHeight!, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight! - 59 - k_Height_safeAreaInsetsBottom()))
// webview = DWKWebView(frame: CGRect(x: 0, y: statusHeight + navHeight!, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight! - 59 - k_Height_safeAreaInsetsBottom()))
webview.navigationDelegate = self
webview.setDebugMode(false)
......@@ -131,6 +155,7 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
printLog("url: 有问题")
}
}
webview.frame = CGRect(x: 0, y: statusHeight + navHeight!, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight! - 59 - k_Height_safeAreaInsetsBottom())
// 添加wkwebview
self.view.addSubview(webview)
......@@ -343,7 +368,7 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
guard let data = data, error == nil else { return }
let image = UIImage(data: data)
if let image = image {
let url = self.url + "&isShare=1" + "&fromPlatform=iOS" + "&uid=\(YHLoginManager.shared.userModel?.id ?? "0")" + "&article_id=\(self.id)"
let url = self.url + "&appShare=1" + "&isShare=1" + "&fromPlatform=iOS" + "&uid=\(YHLoginManager.shared.userModel?.id ?? "0")" + "&article_id=\(self.id)"
YHShareManager.shared.sendLinkContent(self.model.title, "", image, link: url)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment