Sfoglia il codice sorgente

Merge branch 'dev' of https://git.yishihui.com/iOS/MusicVideoPlus into dev
合并代码

jsonwang 4 anni fa
parent
commit
6ad079c165

+ 22 - 18
MusicVideoPlus/MusicVideoPlus.xcodeproj/project.pbxproj

@@ -7,7 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		2D1EC138266B4F4900CBACE4 /* MVUMApiUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D1EC137266B4F4900CBACE4 /* MVUMApiUtil.swift */; };
+		2D076756266DF8E300E64472 /* PQServerProtocalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D076755266DF8E300E64472 /* PQServerProtocalView.swift */; };
+		2D076758266E08E700E64472 /* MVHomeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D076757266E08E700E64472 /* MVHomeController.swift */; };
+		2D1EC138266B4F4900CBACE4 /* MVThirdApiUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D1EC137266B4F4900CBACE4 /* MVThirdApiUtil.swift */; };
 		4112DD832669BFA600A5AFD9 /* MVBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD822669BFA600A5AFD9 /* MVBanner.swift */; };
 		4112DD862669BFFA00A5AFD9 /* MVBannerFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD852669BFFA00A5AFD9 /* MVBannerFlowLayout.swift */; };
 		4112DD912669C11C00A5AFD9 /* MVBannerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD902669C11C00A5AFD9 /* MVBannerCell.swift */; };
@@ -18,7 +20,6 @@
 		418532302665342100DCA2C1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4185322F2665342100DCA2C1 /* AppDelegate.swift */; };
 		418532392665342200DCA2C1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 418532382665342200DCA2C1 /* Assets.xcassets */; };
 		41CA6E5E266782EC00874B19 /* MVBaseController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E5D266782EC00874B19 /* MVBaseController.swift */; };
-		41CA6E632667853C00874B19 /* MVHomeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E622667853C00874B19 /* MVHomeController.swift */; };
 		41CA6E662667887C00874B19 /* MVMineController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E652667887C00874B19 /* MVMineController.swift */; };
 		41CA6E69266788C000874B19 /* MVLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E68266788C000874B19 /* MVLoginController.swift */; };
 		41CA6E6C266788F700874B19 /* MVPlayerConntroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E6B266788F700874B19 /* MVPlayerConntroller.swift */; };
@@ -29,7 +30,9 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
-		2D1EC137266B4F4900CBACE4 /* MVUMApiUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVUMApiUtil.swift; sourceTree = "<group>"; };
+		2D076755266DF8E300E64472 /* PQServerProtocalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PQServerProtocalView.swift; sourceTree = "<group>"; };
+		2D076757266E08E700E64472 /* MVHomeController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MVHomeController.swift; sourceTree = "<group>"; };
+		2D1EC137266B4F4900CBACE4 /* MVThirdApiUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVThirdApiUtil.swift; sourceTree = "<group>"; };
 		3FA19A38D145C54301B3CD85 /* Pods_MusicVideoPlus.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MusicVideoPlus.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		4112DCF02668C45B00A5AFD9 /* MusicVideoPlus.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MusicVideoPlus.entitlements; sourceTree = "<group>"; };
 		4112DD492668D6A600A5AFD9 /* MusicVideoPlus-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MusicVideoPlus-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -45,7 +48,6 @@
 		418532382665342200DCA2C1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		4185323D2665342200DCA2C1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		41CA6E5D266782EC00874B19 /* MVBaseController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVBaseController.swift; sourceTree = "<group>"; };
-		41CA6E622667853C00874B19 /* MVHomeController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MVHomeController.swift; path = MusicVideoPlus/Classes/Modules/Home/MVHomeController.swift; sourceTree = SOURCE_ROOT; };
 		41CA6E652667887C00874B19 /* MVMineController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMineController.swift; sourceTree = "<group>"; };
 		41CA6E68266788C000874B19 /* MVLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVLoginController.swift; sourceTree = "<group>"; };
 		41CA6E6B266788F700874B19 /* MVPlayerConntroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVPlayerConntroller.swift; sourceTree = "<group>"; };
@@ -68,10 +70,18 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		2D076754266DF8C000E64472 /* Views */ = {
+			isa = PBXGroup;
+			children = (
+				2D076755266DF8E300E64472 /* PQServerProtocalView.swift */,
+			);
+			path = Views;
+			sourceTree = "<group>";
+		};
 		2D1EC136266B4F3300CBACE4 /* Utils */ = {
 			isa = PBXGroup;
 			children = (
-				2D1EC137266B4F4900CBACE4 /* MVUMApiUtil.swift */,
+				2D1EC137266B4F4900CBACE4 /* MVThirdApiUtil.swift */,
 			);
 			name = Utils;
 			path = Modules/Utils;
@@ -187,7 +197,7 @@
 		41CA6E41266782C900874B19 /* Controllers */ = {
 			isa = PBXGroup;
 			children = (
-				41CA6E622667853C00874B19 /* MVHomeController.swift */,
+				2D076757266E08E700E64472 /* MVHomeController.swift */,
 			);
 			path = Controllers;
 			sourceTree = "<group>";
@@ -327,10 +337,10 @@
 		41CA6E52266782C900874B19 /* Base */ = {
 			isa = PBXGroup;
 			children = (
+				2D076754266DF8C000E64472 /* Views */,
 				41CA6E53266782C900874B19 /* ViewModels */,
 				41CA6E54266782C900874B19 /* Models */,
 				41CA6E55266782C900874B19 /* Controllers */,
-				41CA6E56266782C900874B19 /* Views */,
 			);
 			path = Base;
 			sourceTree = "<group>";
@@ -357,13 +367,6 @@
 			path = Controllers;
 			sourceTree = "<group>";
 		};
-		41CA6E56266782C900874B19 /* Views */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			path = Views;
-			sourceTree = "<group>";
-		};
 		41CA6E57266782C900874B19 /* Player */ = {
 			isa = PBXGroup;
 			children = (
@@ -440,7 +443,7 @@
 				418532292665342100DCA2C1 /* Frameworks */,
 				4185322A2665342100DCA2C1 /* Resources */,
 				3115904EEDD5A7932018A62B /* [CP] Embed Pods Frameworks */,
-				7EA76EEB18443B8F15F6D8BC /* [CP] Copy Pods Resources */,
+				36B90BC26C7AB8E215507497 /* [CP] Copy Pods Resources */,
 			);
 			buildRules = (
 			);
@@ -535,7 +538,7 @@
 			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MusicVideoPlus/Pods-MusicVideoPlus-frameworks.sh\"\n";
 			showEnvVarsInLog = 0;
 		};
-		7EA76EEB18443B8F15F6D8BC /* [CP] Copy Pods Resources */ = {
+		36B90BC26C7AB8E215507497 /* [CP] Copy Pods Resources */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -561,14 +564,15 @@
 			files = (
 				4112DD862669BFFA00A5AFD9 /* MVBannerFlowLayout.swift in Sources */,
 				41CA6E702667953700874B19 /* MVSettingController.swift in Sources */,
+				2D076758266E08E700E64472 /* MVHomeController.swift in Sources */,
 				4112DD912669C11C00A5AFD9 /* MVBannerCell.swift in Sources */,
 				41CA6E6C266788F700874B19 /* MVPlayerConntroller.swift in Sources */,
 				41CA6E5E266782EC00874B19 /* MVBaseController.swift in Sources */,
 				417D86A7266A3CC900DA2444 /* MVHotVideoModel.swift in Sources */,
-				41CA6E632667853C00874B19 /* MVHomeController.swift in Sources */,
 				4149C8932669FE6F0055CAA2 /* MVTagsCell.swift in Sources */,
 				4112DD832669BFA600A5AFD9 /* MVBanner.swift in Sources */,
-				2D1EC138266B4F4900CBACE4 /* MVUMApiUtil.swift in Sources */,
+				2D1EC138266B4F4900CBACE4 /* MVThirdApiUtil.swift in Sources */,
+				2D076756266DF8E300E64472 /* PQServerProtocalView.swift in Sources */,
 				41CA6E69266788C000874B19 /* MVLoginController.swift in Sources */,
 				41CA6E662667887C00874B19 /* MVMineController.swift in Sources */,
 				41CA6F4B26689F4400874B19 /* PQMineViewModel.swift in Sources */,

+ 3 - 1
MusicVideoPlus/MusicVideoPlus/AppDelegate.swift

@@ -29,7 +29,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         wxappInfo.scope = "snsapi_userinfo"
         PQSingletoWXApiUtil.shared.registerApp(appInfo: wxappInfo)
         // 注册友盟
-        MVUMApiUtil.register()
+        MVThirdApiUtil.registerUM()
+        // 注册bugly
+        MVThirdApiUtil.registerBugly()
         return true
     }
 

+ 139 - 0
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Base/Views/PQServerProtocalView.swift

@@ -0,0 +1,139 @@
+//
+//  PQServerProtocalView.swift
+//  MusicVideoPlus
+//
+//  Created by SanW on 2021/6/7.
+//
+
+import BFFramework
+import UIKit
+
+// MARK: - 应用服务协议
+
+/// 应用服务协议
+class PQServerProtocalView: UIView {
+    public var remindBlock: ((_ sender: UIButton?, _ webUrl: String?) -> Void)?
+
+    public lazy var contentView: UIView = {
+        let contentView = UIView()
+        contentView.backgroundColor = UIColor.white
+        contentView.addCorner(corner: 4)
+        return contentView
+    }()
+
+    public lazy var titleLab: UILabel = {
+        let titleLab = UILabel()
+        titleLab.font = UIFont.systemFont(ofSize: 18, weight: .medium)
+        titleLab.textAlignment = .center
+        titleLab.numberOfLines = 0
+        titleLab.textColor = UIColor.black
+        return titleLab
+    }()
+
+    public lazy var confirmBtn: UIButton = {
+        let confirmBtn = UIButton(type: .custom)
+        confirmBtn.setTitle("确定", for: .normal)
+        confirmBtn.setTitleColor(UIColor.black, for: .normal)
+        confirmBtn.tag = 2
+        confirmBtn.addTarget(self, action: #selector(btnClck(sender:)), for: .touchUpInside)
+        confirmBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
+        return confirmBtn
+    }()
+
+    lazy var protocolLab: TYAttributedLabel = {
+        let protocolLab = TYAttributedLabel()
+        protocolLab.highlightedLinkBackgroundColor = UIColor.white
+        protocolLab.delegate = self
+        protocolLab.numberOfLines = 0
+        protocolLab.font = UIFont(name: "PingFang SC", size: 15)
+        protocolLab.text = "感谢您选择闪音APP\n我们非常重视您的个人信息安全和隐私保护。依据最新法律要求,使用我们的产品前,请仔细阅读并同意"
+        protocolLab.textColor = UIColor.black
+        protocolLab.appendLink(withText: "《软件许可及服务协议》", linkFont: UIFont(name: "PingFang SC", size: 15), linkColor: UIColor.hexColor(hexadecimal: "#07C160"), underLineStyle: CTUnderlineStyle(), linkData: cUserProtocol)
+        protocolLab.appendLink(withText: "和", linkFont: UIFont(name: "PingFang SC", size: 15), linkColor: UIColor.black, underLineStyle: CTUnderlineStyle(), linkData: nil)
+        protocolLab.appendLink(withText: "《隐私政策》", linkFont: UIFont(name: "PingFang SC", size: 15), linkColor: UIColor.hexColor(hexadecimal: "#07C160"), underLineStyle: CTUnderlineStyle(), linkData: cPrivacy)
+        protocolLab.appendLink(withText: ",以便我们向您提供更优质的服务!\n\n我们承诺将尽全力保护您的个人信息及合法权益,再次感谢您的信任!", linkFont: UIFont(name: "PingFang SC", size: 15), linkColor: UIColor.black, underLineStyle: CTUnderlineStyle(), linkData: nil)
+        return protocolLab
+    }()
+
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        addSubview(contentView)
+        contentView.addSubview(titleLab)
+        contentView.addSubview(confirmBtn)
+        contentView.addSubview(protocolLab)
+        titleLab.text = "服务协议与隐私政策"
+        titleLab.textAlignment = .center
+        confirmBtn.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
+        confirmBtn.setTitle("同意", for: .normal)
+        confirmBtn.setTitleColor(UIColor.white, for: .normal)
+        confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#07C160")
+        confirmBtn.addCorner(corner: cDefaultMargin * 2.5)
+    }
+
+    override func layoutSubviews() {
+        super.layoutSubviews()
+        addLayout()
+    }
+
+    func addLayout() {
+        let normalH: CGFloat = cDefaultMargin * 2.5
+        var protocolH: CGFloat = protocolLab.getSizeWithWidth(cScreenWidth - cDefaultMargin * 12).height
+        if cScreenHeigth <= 568.0 {
+            protocolH = protocolH + cDefaultMargin * 4
+        }
+        let contentH: CGFloat = normalH + cDefaultMargin * 2 + cDefaultMargin + protocolH + cDefaultMargin * 2 + cDefaultMargin * 5 + cDefaultMargin * 2
+
+        contentView.snp.makeConstraints { make in
+            make.left.equalTo(self).offset(cDefaultMargin * 4)
+            make.right.equalTo(self).offset(-cDefaultMargin * 4)
+            make.height.equalTo(contentH)
+            make.center.equalTo(self)
+        }
+        contentView.addCorner(corner: 4)
+        titleLab.snp.makeConstraints { make in
+            make.left.equalTo(contentView).offset(normalH)
+            make.right.equalTo(contentView).offset(-normalH)
+            make.height.equalTo(cDefaultMargin * 2)
+            make.top.equalTo(contentView).offset(normalH)
+        }
+        protocolLab.snp.makeConstraints { make in
+            make.top.equalTo(titleLab.snp.bottom).offset(cDefaultMargin)
+            make.left.right.equalTo(titleLab)
+            make.height.equalTo(protocolH)
+        }
+        confirmBtn.snp.makeConstraints { make in
+            make.left.right.equalTo(titleLab)
+            make.height.equalTo(cDefaultMargin * 5)
+            make.bottom.equalToSuperview().offset(-cDefaultMargin * 2)
+        }
+    }
+
+    required init?(coder _: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+
+    @objc func btnClck(sender: UIButton) {
+        saveUserDefaults(key: cShowProtocal, value: "1")
+        removeFromSuperview()
+        if remindBlock != nil {
+            remindBlock!(sender, nil)
+        }
+    }
+}
+
+extension PQServerProtocalView: TYAttributedLabelDelegate {
+    func attributedLabel(_: TYAttributedLabel!, textStorageClicked textStorage: TYTextStorageProtocol!, at _: CGPoint) {
+        var link: String? = (textStorage as? TYLinkTextStorage)?.linkData as? String ?? ""
+        if link == nil || (link?.count ?? 0) <= 0 {
+            let range = (textStorage as? TYLinkTextStorage)?.range
+            if range?.length == 11 {
+                link = cUserProtocol
+            } else if range?.length == 6 {
+                link = cPrivacy
+            }
+        }
+        if link != nil, (link?.count ?? 0) > 0, remindBlock != nil {
+            remindBlock!(nil, link)
+        }
+    }
+}

+ 77 - 92
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/MVHomeController.swift → MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Controllers/MVHomeController.swift

@@ -7,8 +7,6 @@
 
 import BFFramework
 class MVHomeController: MVBaseController {
-
-
     private var banner: MVBanner = {
         let banner = MVBanner(frame: .zero, margin: 30, lineSpacing: 12, minScale: MVBanner.Scale(scale: 1))
         banner.backgroundColor = UIColor.white
@@ -50,7 +48,7 @@ class MVHomeController: MVBaseController {
         settingBtn.tag = 3000
         return settingBtn
     }()
- 
+
     // 标签分类
     lazy var collectionView: UICollectionView = {
         let flowLayout = UICollectionViewFlowLayout()
@@ -74,19 +72,18 @@ class MVHomeController: MVBaseController {
         collectionView.delaysContentTouches = false
         return collectionView
     }()
-    
-    var mVideos:Array = Array<MVHotVideoModel>.init()
-    
-    var mAllVideos:Array = Array<PQVideoListModel>.init()
-    
-    var lastBnnerSelectIndex:IndexPath = IndexPath.init()
-    
-    
+
+    var mVideos: Array = Array<MVHotVideoModel>.init()
+
+    var mAllVideos: Array = Array<PQVideoListModel>.init()
+
+    var lastBnnerSelectIndex: IndexPath = IndexPath()
+
     override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
 
-        //停止播放
-        let cell: MVBannerCell?  =  banner.collectionView.cellForItem(at: lastBnnerSelectIndex) as? MVBannerCell
+        // 停止播放
+        let cell: MVBannerCell? = banner.collectionView.cellForItem(at: lastBnnerSelectIndex) as? MVBannerCell
         cell?.pauseView.isHidden = false
         PQSingletoVideoPlayer.shared.stopPlayer(isRemove: false)
     }
@@ -99,23 +96,21 @@ class MVHomeController: MVBaseController {
         }
         MVHomeViewModel.getHomeHotVideos {[weak self] hotVideos, _ in
             BFLog(message: "hotVideos count is :\(hotVideos.count)")
-            
+
             self?.mVideos = hotVideos
-            
+
             self?.collectionView.reloadData()
-            if((self?.mVideos.count ?? 0) > 0 ){
-                
+            if (self?.mVideos.count ?? 0) > 0 {
                 self?.mVideos[0].isSelected = true
-                for hotModel in  self!.mVideos{
+                for hotModel in self!.mVideos {
                     for video in hotModel.videos {
                         self?.mAllVideos.append(video)
                     }
                 }
                 BFLog(message: " self?.mAllVideos count is \(String(describing: self?.mAllVideos.count))")
             }
-            
-            self?.banner.reloadData()
 
+            self?.banner.reloadData()
         }
     }
 
@@ -143,26 +138,40 @@ class MVHomeController: MVBaseController {
                 self?.getData()
             }
         }
- 
-     
-  
         PQSingletoVideoPlayer.shared.progressBloc = { [weak self] loadProgress, playProgress, duration in
-        
+
             BFLog(message: "loadProgress \(loadProgress) playProgress\(playProgress) \(duration)")
-            let cell: MVBannerCell?  =  self?.banner.collectionView.cellForItem(at: self?.lastBnnerSelectIndex ?? IndexPath.init()) as? MVBannerCell
-            
+            let cell: MVBannerCell? = self?.banner.collectionView.cellForItem(at: self?.lastBnnerSelectIndex ?? IndexPath()) as? MVBannerCell
+
             cell?.progressView.progress = playProgress / loadProgress
-             
         }
         PQSingletoVideoPlayer.shared.playStatusBloc = { [weak self] status in
 
-            if(status == .PQVIDEO_PLAY_STATUS_END){
+            if status == .PQVIDEO_PLAY_STATUS_END {
                 PQSingletoVideoPlayer.shared.playVideoData!.playProgress = 0
                 PQSingletoVideoPlayer.shared.resetPlayer()
             }
         }
+        // 添加协议
+        let showProtocal: String? = getUserDefaults(key: cShowProtocal) as? String
+        if showProtocal == nil || showProtocal?.count ?? 0 <= 0 || showProtocal != "1" {
+            let protocalView: PQServerProtocalView = PQServerProtocalView(frame: view.frame)
+            protocalView.tag = cProtocalViewTag
+            protocalView.remindBlock = { [weak self] sender, webUrl in
+                if sender == nil, webUrl != nil {
+                    let detail = PQBaseWebViewController()
+                    detail.evaluateJavaScript = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust='210%'"
+                    detail.baseUrl = webUrl
+                    self?.navigationController?.pushViewController(detail, animated: true)
+                }
+                // 移除继续播放
+                if sender != nil {
+                    PQSingletoVideoPlayer.shared.resetPlayer()
+                }
+            }
+            UIApplication.shared.keyWindow?.addSubview(protocalView)
+        }
     }
-    
 
     func addLayout() {
 //        mineBtn.snp.remakeConstraints { make in
@@ -202,7 +211,7 @@ class MVHomeController: MVBaseController {
 
     @objc func btnClick(sender: UIButton) {
         // 先判断是否登录
-        if !BFLoginUserInfo.shared.isLogin() && sender.tag != 3000 {
+        if !BFLoginUserInfo.shared.isLogin(), sender.tag != 3000 {
             let vc = MVLoginController()
             vc.modalPresentationStyle = .fullScreen
             present(vc, animated: true, completion: nil)
@@ -212,28 +221,24 @@ class MVHomeController: MVBaseController {
         switch sender.tag {
         case 1000:
             navigationController?.pushViewController(MVMineController(), animated: true)
-            break
         case 2000:
             navigationController?.pushViewController(PQStuckPointMaterialController(), animated: true)
-            break
 
         case 3000:
             navigationController?.pushViewController(MVSettingController(), animated: true)
-            break
 
         default:
             break
         }
     }
-    
-    //再创作视频
+
+    // 再创作视频
     func createVideo(indexPath: IndexPath) {
         // 无网
         if !isNetConnected() {
-        
-            let remindData:PQBaseModel = PQBaseModel()
+            let remindData: PQBaseModel = PQBaseModel()
             remindData.title = "似乎已断开与互联网的连接"
-            
+
             let remindView = PQRemindView(frame: CGRect(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
             UIApplication.shared.keyWindow?.addSubview(remindView)
             remindView.remindData = remindData
@@ -243,21 +248,17 @@ class MVHomeController: MVBaseController {
                 }
             }
             return
-            
-            
         }
-        
-        
-        
+
         if !BFLoginUserInfo.shared.isLogin() {
             let vc = MVLoginController()
             vc.modalPresentationStyle = .fullScreen
             present(vc, animated: true, completion: nil)
-             
-        }else{
+
+        } else {
             PQStuckPointViewModel.stuckPointProjectMusicInfo(projectId: mAllVideos[indexPath.row].reCreateVideoData?.projectId ?? "") { musicData, _ in
-                if musicData != nil{
-                    let vc = PQStuckPointMaterialController.init()
+                if musicData != nil {
+                    let vc = PQStuckPointMaterialController()
                     vc.reCreateMusicData = musicData
                     self.navigationController?.pushViewController(vc, animated: true)
                 }
@@ -278,28 +279,24 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
         cell.contentView.layer.masksToBounds = true
         cell.contentView.layer.cornerRadius = 10
         cell.contentView.backgroundColor = UIColor.white
- 
+
         cell.videoData = mAllVideos[indexPath.row]
         cell.reCreateBtnClicHandle = { [weak self] _, _ in
             BFLog(message: "点击了创同款")
             self?.createVideo(indexPath: indexPath)
-       
         }
- 
 
         return cell
     }
-    
-    func changePlayerStatus(indexPath: IndexPath){
-         
-        
-        let cell: MVBannerCell?  =  banner.collectionView.cellForItem(at: indexPath) as? MVBannerCell
-        
-        if(PQSingletoVideoPlayer.shared.player.isPlaying()){
+
+    func changePlayerStatus(indexPath: IndexPath) {
+        let cell: MVBannerCell? = banner.collectionView.cellForItem(at: indexPath) as? MVBannerCell
+
+        if PQSingletoVideoPlayer.shared.player.isPlaying() {
             cell?.pauseView.isHidden = false
             PQSingletoVideoPlayer.shared.stopPlayer(isRemove: false)
-        
-        }else{
+
+        } else {
             PQSingletoVideoPlayer.shared.resetPlayer()
             cell?.pauseView.isHidden = true
         }
@@ -310,41 +307,37 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
     func banner(_: MVBanner, didSelectItemAt indexPath: IndexPath) {
         NSLog("didSelectItemAt %d", indexPath.row)
         lastBnnerSelectIndex = indexPath
-        
-        changePlayerStatus(indexPath: indexPath)
-      
 
+        changePlayerStatus(indexPath: indexPath)
     }
-    
+
     func pageControl(currentPage page: Int) {
         BFLog(message: "page is \(page)")
-        
-        let cell: MVBannerCell?  =  banner.collectionView.cellForItem(at: IndexPath.init(row: page, section: 0)) as? MVBannerCell
-        
-       
-        if (mVideos.count > 0  && cell != nil) {
+
+        let cell: MVBannerCell? = banner.collectionView.cellForItem(at: IndexPath(row: page, section: 0)) as? MVBannerCell
+        let showProtocal: String? = getUserDefaults(key: cShowProtocal) as? String
+        if mVideos.count > 0, cell != nil, showProtocal != nil, showProtocal == "1" {
             cell?.pauseView.isHidden = true
-            PQSingletoVideoPlayer.shared.configPlyer(videoData:  mAllVideos[page], controllerView: cell!.converView)
-            
+            PQSingletoVideoPlayer.shared.configPlyer(videoData: mAllVideos[page], controllerView: cell!.converView)
+
             let hotVides = mVideos.first(where: { (items) -> Bool in
-                items.categoryName ==  mAllVideos[page].categoryName
+                items.categoryName == mAllVideos[page].categoryName
             })
             for hot in mVideos {
                 hot.isSelected = false
             }
-            
+
             mVideos[(hotVides?.categoryId ?? 0) - 1].isSelected = true
             collectionView.reloadData()
-            
-            lastBnnerSelectIndex = IndexPath.init(row: page, section: 0)
+
+            lastBnnerSelectIndex = IndexPath(row: page, section: 0)
         }
-    
     }
 }
 
 // MARK: - 划动分类相关代理
 
-///  
+///
 extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate {
     func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int {
         return mVideos.count
@@ -359,36 +352,28 @@ extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource
 
     func collectionView(_ collectionView: UICollectionView, layout _: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
         let itemData: MVHotVideoModel = mVideos[indexPath.item]
-        let width:CGFloat = CGFloat(CGFloat((itemData.categoryName ).ga_widthForComment(font:UIFont.boldSystemFont(ofSize: 17),height:17.0)) + 36.0 + 20.0)
- 
+        let width: CGFloat = CGFloat(CGFloat(itemData.categoryName.ga_widthForComment(font: UIFont.boldSystemFont(ofSize: 17), height: 17.0)) + 36.0 + 20.0)
+
         return CGSize(width: width, height: collectionView.frame.height)
     }
-  
 
     func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-     
         for hot in mVideos {
             hot.isSelected = false
         }
-        
+
         let itemDataNew: MVHotVideoModel = mVideos[indexPath.item]
         itemDataNew.isSelected = true
         collectionView.reloadData()
-        
-        //找出当前选择分类之前的视频数量和
-        var videosCount:Int = 0
-        if(indexPath.row != 0){
-      
-            for i in 0...indexPath.row - 1 {
+
+        // 找出当前选择分类之前的视频数量和
+        var videosCount: Int = 0
+        if indexPath.row != 0 {
+            for i in 0 ... indexPath.row - 1 {
                 videosCount = videosCount + mVideos[i].videos.count
             }
             BFLog(message: "indexPath 选择\(indexPath.item) 之前的视频合\(videosCount)")
-         
         }
         banner.scrollToItem(at: videosCount, animated: true)
-        
-        
-       
     }
- 
 }

+ 1 - 0
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Login/Controllers/MVLoginController.swift

@@ -221,6 +221,7 @@ extension MVLoginController: TYAttributedLabelDelegate {
         }
         let detail = PQBaseWebViewController()
         detail.baseUrl = link
+        detail.evaluateJavaScript = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust='210%'"
         navigationController?.pushViewController(detail, animated: true)
     }
 }

+ 1 - 0
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Setting/Controllers/MVSettingController.swift

@@ -132,6 +132,7 @@ extension MVSettingController: TYAttributedLabelDelegate {
             }
         }
         let detail = PQBaseWebViewController()
+        detail.evaluateJavaScript = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust='210%'"
         detail.baseUrl = link
         navigationController?.pushViewController(detail, animated: true)
     }

+ 29 - 3
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Utils/MVUMApiUtil.swift → MusicVideoPlus/MusicVideoPlus/Classes/Modules/Utils/MVThirdApiUtil.swift

@@ -1,18 +1,43 @@
 //
-//  MVUMApiUtil.swift
+//  MVThirdApiUtil.swift
 //  MusicVideoPlus
 //
 //  Created by SanW on 2021/6/5.
 //
 
 import BFFramework
+import Bugly
 import UIKit
 
 // MARK: - 友盟相关工具类
 
 /// 友盟相关工具类
-class MVUMApiUtil: NSObject {
-    class func register() {
+class MVThirdApiUtil: NSObject {
+    // 注册
+    class func registerBugly() {
+        // 注册bugly
+        let buglyConfig = BuglyConfig()
+        buglyConfig.reportLogLevel = .warn
+        #if DEBUG
+            buglyConfig.version = versionName + ".6666"
+        #else
+            if PQENVUtil.shared.envMode == .ENVModeOnline {
+                buglyConfig.version = versionName + "." + versionCode
+            } else if PQENVUtil.shared.envMode == .ENVModePre {
+                buglyConfig.version = versionName + ".8888"
+            } else {
+                buglyConfig.version = versionName + ".9999"
+            }
+        #endif
+        buglyConfig.channel = PQBFConfig.shared.channelID
+        buglyConfig.deviceIdentifier = BFLoginUserInfo.shared.isLogin() ? BFLoginUserInfo.shared.uid : getMachineCode()
+        buglyConfig.unexpectedTerminatingDetectionEnable = true
+        buglyConfig.blockMonitorEnable = true
+        buglyConfig.blockMonitorTimeout = 2
+        Bugly.start(withAppId: PQBFConfig.shared.buglyAppkey, config: buglyConfig)
+    }
+
+    class func registerUM() {
         // 注册友盟
         UMConfigure.setEncryptEnabled(true)
         // 初始化友盟所有组件产品
@@ -22,6 +47,7 @@ class MVUMApiUtil: NSObject {
         #endif
         BFLog(message: "友盟版本号:\(UMConfigure.version())")
     }
+
     /// 页面时长统计
     /// - Parameters:
     ///   - pageName: 页面名称

+ 1 - 0
MusicVideoPlus/Podfile

@@ -14,4 +14,5 @@ target 'MusicVideoPlus' do
   pod 'UMDevice','1.2.0'
   pod 'UMCSecurityPlugins','1.0.6'
   pod 'UMAPM','1.2.1'
+  pod 'Bugly','2.5.90'
 end