CNLiveInfoShowViewController.swift
4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//
// CNLiveInfoShowViewController.swift
// metaCode
//
// Created by open on 2023/6/8.
//
import Foundation
import YYCategories
import WebKit
enum ListShowInfoType {
case service
case privacy
case yinsi
}
class CNLiveInfoShowViewController: CNLiveBaseViewController, WKNavigationDelegate, WKUIDelegate {
var _show_type:ListShowInfoType!
init(show_type:ListShowInfoType) {
super.init(nibName:nil, bundle:nil)
_show_type = show_type
}
override func viewWillAppear(_ animated: Bool) {
navigationBarHidden = false
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var webView: WKWebView = {
let config = WKWebViewConfiguration()
let webView = WKWebView.init(frame: .zero, configuration: config)
webView.backgroundColor = .white
webView.allowsBackForwardNavigationGestures = true
webView.navigationDelegate = self
webView.uiDelegate = self
return webView
}()
override func viewDidLoad() {
super.viewDidLoad()
var attrString = ""
switch _show_type {
case .service:
titleName = "APP用户服务协议"
attrString = "https://wjjh5.cnlive.com/yuanmaYhxy.html"
case .privacy:
titleName = "个人信息保护政策"
attrString = "https://wjjh5.cnlive.com/yuanmaYszc.html"
case .yinsi:
titleName = "隐私协议"
attrString = "https://wjjh5.cnlive.com/yuanmaYszc.html"
case .none:
break
}
view.addSubview(webView)
webView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(get_system_nav_height())
make.left.right.bottom.equalToSuperview()
}
webView.load(URLRequest(url: URL(string: attrString)!, cachePolicy: .returnCacheDataElseLoad))
}
// override func viewDidLoad() {
// super.viewDidLoad()
// var attrString = ""
// switch _show_type {
// case .service:
// titleName = "APP用户服务协议"
// attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限。 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"
// case .privacy:
// titleName = "个人信息保护政策"
// attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"
// case .none:
// break
// }
//
// let paraph = NSMutableParagraphStyle()
// paraph.lineSpacing = 10
// let attributes = [NSAttributedString.Key.font:Font_16_Fit,
// NSAttributedString.Key.paragraphStyle: paraph]
// let h = attrString.boundingRect(with: CGSize(width: KSreenWidth - 40, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size.height + 40
// let textView = UITextView.init()
// textView.attributedText = NSAttributedString(string: attrString, attributes: attributes)
// textView.textColor = HexColor("#666666")
// textView.layer.cornerRadius = 10
// textView.layer.masksToBounds = true
// textView.textAlignment = .left
// textView.contentMode = .scaleAspectFill
// textView.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
// textView.sizeToFit()
// view.addSubview(textView)
// textView.snp.makeConstraints { make in
// make.centerX.equalToSuperview()
// make.top.equalToSuperview().offset(get_system_nav_height() + 10)
// make.left.equalToSuperview().offset(10)
// make.right.equalToSuperview().offset(-10)
// make.height.equalTo(h)
// }
// }
}