Browse Source

添加用户隐私窗口

jsonwang 3 years ago
parent
commit
1c9f657d7e
1 changed files with 139 additions and 0 deletions
  1. 139 0
      Introduce/Record/INRecorderController.swift

+ 139 - 0
Introduce/Record/INRecorderController.swift

@@ -10,7 +10,13 @@ import BFRecordScreenKit
 import BFUIKit
 import Foundation
 import UIKit
+import TYAttributedLabel
+import BFCommonKit
 
+public let cUserProtocol = "https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html?type=15"
+/** 隐私政策 */
+public let cPrivacy = "https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html?type=15"
+ 
 class INRecorderController: BFBaseViewController {
     lazy var addVideoBtn: UIButton = {
         let btn = UIButton(type: .custom)
@@ -26,6 +32,70 @@ class INRecorderController: BFBaseViewController {
         bgView.image = UIImage(named: "homebg")
         return bgView
     }()
+    
+    //欢迎界面
+    lazy var welcomeView:UIView = {
+        let view = UIView.init()
+        view.backgroundColor = .white
+        view.addCorner(corner:17)
+        return view
+        
+    }()
+    
+    lazy var welcomeTitle:UILabel = {
+       
+        let l = UILabel()
+        l.text = "欢迎使用"
+        l.textColor = .black
+        l.font = UIFont.boldSystemFont(ofSize: 22)
+        l.textAlignment = .center
+        view.addSubview(l)
+        return l
+    }()
+    
+    lazy var protocolLab: TYAttributedLabel = {
+        let protocolLab = TYAttributedLabel()
+        protocolLab.highlightedLinkBackgroundColor = UIColor.black
+        protocolLab.backgroundColor = UIColor.clear
+        protocolLab.numberOfLines = 0
+        protocolLab.delegate = self
+        protocolLab.font = UIFont.systemFont(ofSize: 14)
+        protocolLab.text = "在您使用视说服务前,请认准阅读"
+        protocolLab.textAlignment = .left
+        protocolLab.textColor = UIColor(red: 0.262, green: 0.262, blue: 0.262, alpha: 1)
+        protocolLab.appendLink(withText: "《视说用户协议》、 ", linkFont: UIFont.systemFont(ofSize: 14), linkColor: UIColor.hexColor(hexadecimal: "#90a9d2"),  underLineStyle:CTUnderlineStyle(), linkData: cUserProtocol)
+
+        protocolLab.appendLink(withText: "  《用户隐私政策》", linkFont: UIFont.systemFont(ofSize: 14), linkColor: UIColor.hexColor(hexadecimal: "#90a9d2"), underLineStyle:CTUnderlineStyle(), linkData: cPrivacy)
+        
+        protocolLab.appendLink(withText: "\n\n", linkFont: UIFont.systemFont(ofSize: 14), linkColor: UIColor.hexColor(hexadecimal: "#999999"), underLineStyle: CTUnderlineStyle(), linkData: nil)
+        
+        protocolLab.appendLink(withText: "点击同意表示您已阅读并且认可所有条款。", linkFont: UIFont.systemFont(ofSize: 14), linkColor: UIColor(red: 0.262, green: 0.262, blue: 0.262, alpha: 1), underLineStyle: CTUnderlineStyle(), linkData: nil)
+        protocolLab.textAlignment = CTTextAlignment.center
+        return protocolLab
+    }()
+    
+    lazy var doneBtn:UIButton = {
+        let doneBtn = UIButton()
+        doneBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#28BE67")
+        doneBtn.setTitle("同意", for: .normal)
+        doneBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
+        doneBtn.addTarget(self, action: #selector(doneAction), for: .touchUpInside)
+        doneBtn.addCorner(corner: 4)
+        return doneBtn
+    }()
+    
+    lazy var cancleBtn:UIButton = {
+        let cancleBtn = UIButton()
+        cancleBtn.backgroundColor = UIColor.clear
+        cancleBtn.setTitle("取消", for: .normal)
+        cancleBtn.setTitleColor( UIColor(red: 0.262, green: 0.262, blue: 0.262, alpha: 1), for: .normal)
+        cancleBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14)
+        cancleBtn.addTarget(self, action: #selector(cancleAction), for: .touchUpInside)
+        
+        cancleBtn.addCorner(corner: 4)
+        return cancleBtn
+    }()
+    
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
         hiddenNavigation()
@@ -54,6 +124,62 @@ class INRecorderController: BFBaseViewController {
             make.width.equalTo(200)
             make.height.equalTo(24)
         }
+    
+        //欢迎界面
+        if(getUserDefaults(key: "welcomeViewisshow") == nil){
+            view.addSubview(welcomeView)
+            welcomeView.addSubview(protocolLab)
+            welcomeView.addSubview(welcomeTitle)
+            welcomeView.addSubview(doneBtn)
+            welcomeView.addSubview(cancleBtn)
+            
+            welcomeView.snp.makeConstraints{ make in
+                make.center.equalToSuperview()
+                make.width.equalTo(280)
+                make.height.equalTo(350)
+            }
+            
+            welcomeTitle.snp.makeConstraints{ make in
+                make.centerX.equalToSuperview()
+                make.width.equalTo(120)
+                make.top.equalToSuperview().offset(30)
+                make.height.equalTo(31)
+            }
+            
+            protocolLab.snp.makeConstraints{ make in
+                make.centerX.equalToSuperview()
+                make.width.equalTo(230)
+                make.top.equalTo(welcomeTitle.snp.bottom).offset(16)
+                make.height.equalTo(140)
+            }
+     
+            doneBtn.snp.makeConstraints { make in
+                make.centerX.equalToSuperview()
+                make.width.equalTo(230)
+                make.height.equalTo(47)
+                make.top.equalTo(protocolLab.snp.bottom).offset(30)
+            }
+            
+            cancleBtn.snp.makeConstraints { make in
+                make.centerX.equalToSuperview()
+                make.width.equalTo(230)
+                make.height.equalTo(20)
+                make.top.equalTo(doneBtn.snp.bottom).offset(17)
+            }
+        }
+   
+    }
+    
+    @objc func doneAction() {
+        welcomeView.isHidden = true
+        
+        saveUserDefaults(key: "welcomeViewisshow", value: "true")
+       
+    }
+    
+    
+    @objc func cancleAction() {
+        welcomeView.isHidden = true
     }
 
     override func didReceiveMemoryWarning() {
@@ -67,3 +193,16 @@ class INRecorderController: BFBaseViewController {
         navigationController?.pushViewController(vc, animated: true)
     }
 }
+
+
+//点击超链接回调
+extension INRecorderController: TYAttributedLabelDelegate {
+    func attributedLabel(_: TYAttributedLabel!, textStorageClicked textStorage: TYTextStorageProtocol!, at _: CGPoint) {
+        let link: String? = (textStorage as? TYLinkTextStorage)?.linkData as? String ?? ""
+        if link != nil, (link?.count ?? 0) > 0 {
+            let detail = BFBaseWebViewController()
+            detail.baseUrl = link
+            self.navigationController?.pushViewController(detail, animated: true)
+        }
+    }
+}