浏览代码

Merge branch 'master' of https://git.yishihui.com/wenweiwei/BFCommonKit

* 'master' of https://git.yishihui.com/wenweiwei/BFCommonKit:
  tag 1.4.1
  1.修改拖动进度条改变当前播放进度
  1.增加播放器播放状态
  1.修改空白页布局
  1.新增埋点

# Conflicts:
#	BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift
huzhiqiang 3 年之前
父节点
当前提交
1a9f8f66d3

+ 1 - 1
BFCommonKit.podspec

@@ -8,7 +8,7 @@
 
 Pod::Spec.new do |s|
   s.name             = 'BFCommonKit'
-  s.version          = '1.4.0'
+  s.version          = '1.4.1'
   s.summary          = 'A short description of BFCommonKit.'
   s.swift_version    = '5.0'
 # This description is used to generate tags and improve search results.

+ 23 - 17
BFCommonKit/Classes/BFBase/View/PQRemindView.swift

@@ -320,6 +320,8 @@ extension PQEmptyRemindView {
 //            } else {
 //                imageView.image = nil
 //            }
+            remindSubLab.isHidden = !(emptyData?.title != nil && emptyData?.title?.count ?? 0 > 0)
+            remindSubLab.isHidden = !(emptyData?.summary != nil && emptyData?.summary?.count ?? 0 > 0)
             imageView.image = emptyData?.emptySoureImage ?? UIImage.moduleImage(named: emptyData?.emptyImage ?? "", moduleName: "BFCommonKit")
             remindLab.text = emptyData?.title
             remindSubLab.text = emptyData?.summary
@@ -344,24 +346,26 @@ extension PQEmptyRemindView {
     }
 
     public func addLayout() {
-        var imageH: CGFloat = cDefaultMargin * 7
+        let margin: CGFloat = 10
+        var imageH: CGFloat = margin * 7
         var contentH: CGFloat = 0
-
-        if (emptyData?.emptySoureImage != nil) || (emptyData?.emptyImage != nil &&  emptyData?.emptyImage?.count ?? 0 > 0) || !isNetLost {
-            contentH = contentH + imageH + cDefaultMargin
+        let normalH : CGFloat = margin * 2
+        
+        if (emptyData?.emptySoureImage != nil) || (emptyData?.emptyImage != nil &&  emptyData?.emptyImage?.count ?? 0 > 0) || isNetLost {
+            contentH = contentH + imageH
         } else {
             imageH = 0
         }
-        if emptyData?.title != nil, emptyData?.title?.count ?? 0 > 0 {
-            contentH = contentH + cDefaultMargin * 2 + cDefaultMargin
+        if !remindLab.isHidden {
+            contentH = contentH + normalH + margin
         }
-        if emptyData?.summary != nil, emptyData?.summary?.count ?? 0 > 0 {
-            contentH = contentH + cDefaultMargin * 2 + cDefaultMargin
+        if !remindSubLab.isHidden {
+            contentH = contentH + normalH + margin
         }
         if !refreshBtn.isHidden {
-            contentH = contentH + cDefaultMargin + cDefaultMargin * 4
+            contentH = contentH + normalH + margin * 4
         }
-        let topY = (frame.height - contentH) / 2
+        let topY = (frame.height - contentH) / 2 - normalH
         imageView.snp.remakeConstraints { make in
             make.top.equalTo(topY)
             make.centerX.equalTo(self)
@@ -373,16 +377,18 @@ extension PQEmptyRemindView {
 //        }
         remindLab.snp.remakeConstraints { make in
             make.left.right.equalToSuperview()
-            make.top.equalTo(imageView.snp.bottom).offset(cDefaultMargin)
+            make.height.equalTo(remindLab.isHidden ? 0 : normalH)
+            make.top.equalTo(imageView.snp.bottom).offset(remindLab.isHidden ? 0 : margin)
         }
-        remindSubLab.snp.makeConstraints { make in
+        remindSubLab.snp.remakeConstraints { make in
             make.left.right.equalToSuperview()
-            make.top.equalTo(remindLab.snp.bottom).offset(cDefaultMargin)
+            make.height.equalTo(remindSubLab.isHidden ? 0 : normalH)
+            make.top.equalTo(remindLab.snp.bottom).offset(remindSubLab.isHidden ? 0 : cDefaultMargin)
         }
-        refreshBtn.snp.makeConstraints { make in
-            make.width.equalTo(cDefaultMargin * 16)
-            make.height.equalTo(cDefaultMargin * 4)
-            make.top.equalTo(remindSubLab.snp.bottom).offset(cDefaultMargin)
+        refreshBtn.snp.remakeConstraints { make in
+            make.width.equalTo(margin * 16)
+            make.height.equalTo(margin * 4)
+            make.top.equalTo(remindSubLab.snp.bottom).offset(normalH)
             make.centerX.equalToSuperview()
         }
     }

+ 2 - 0
BFCommonKit/Classes/BFBase/View/PQSlideView.swift

@@ -177,6 +177,8 @@ public class PQSlideView: UIView {
             valueChangeBloc!(sender)
         }
         isDragingProgressSlder = false
+        progressValue = sender.value * duration
+        addData()
     }
 
     @objc public func btnClick(sender: UIButton) {

+ 12 - 1
BFCommonKit/Classes/BFEnums/Enums.swift

@@ -35,6 +35,7 @@ public  enum  PQVIDEO_PLAY_STATUS {
     case PQVIDEO_PLAY_STATUS_DISCONNECT // 重连失败
     case PQVIDEO_PLAY_STATUS_NOT_FOUND // 播放文件不存在
     case PQVIDEO_PLAY_STATUS_RECONNECT // 重连连接
+    case PQVIDEO_PLAY_STATUS_FAUILE // 播放失败
 }
 
 // MARK: - 页面场景
@@ -139,7 +140,8 @@ public  enum  PAGESOURCE: String {
     case sp_cmunit_create = "creationToolWindow" // 发布面板
     case sp_cmunit_publish = "publishPage" // 内容发布页
     case sp_cmunit_loginPage = "loginPage" // 登陆页
-    
+    case sp_cmunit_interestedTopic = "hotTopicRecommendWindow" // 热门话题推荐页
+    case sp_cmunit_cmtMsgPage = "commentMessagePage" // 评论消息页
 }
 
 // MARK: - objectType
@@ -291,6 +293,7 @@ public  enum  objectType: String {
     case ot_cmunit_topicCreate = "createVideoButton" // 话题详情页
     case ot_cmunit_topicClose = "closeButton" // 话题详情页
     case ot_cmunit_joinBtn = "joinTopicButton" // 内容发布页-参与话题
+    case ot_cmunit_joinAllBtn = "joinAllButton" // 点击「一键加入」按钮
     case ot_cmunit_listTopicBtn = "topicButton" // 话题列表-话题按钮曝光
     case ot_cmunit_cacelBtn = "cancelJoinTopicButton" // 话题列表-点击「取消加入话题」按钮
     case ot_cmunit_recoItem = "recommendTopicItem" // 内容发布页-推荐话题 Item
@@ -302,6 +305,8 @@ public  enum  objectType: String {
     case ot_cmunit_nextStepBtn = "nextStepButton" // 点击「下一步」按钮
     case ot_cmunit_skipBtn = "skipButton" // 点击「跳过」按钮
     case ot_cmunit_loginButton = "loginButton" // 点击「登录」按钮
+    case ot_cmunit_cmtMsgItem = "commentMessageItem" // 评论消息item
+    
 }
 
 // MARK: - 视频上报类型
@@ -389,6 +394,12 @@ public  enum  businessType: String {
     case bt_ad_close = "adClose" // 广告被关闭-非需求
     case bt_ad_configRequest = "adConfigRequest" // 客户端请求广告配置
     case bt_ad_configLoaded = "adConfigLoaded" // 客户端请求广告配置成功
+    
+    /*************** 话题相关businessType ***************/
+    case bt_cmunit_clickTopic = "videoClickTopic" // 增加首页话题点击上报
+    case bt_cmunit_videoReport = "videoReport" // 举报视频
+    case bt_cmunit_comment = "videoComment" // 视频被用户评论
+    case bt_cmunit_likeComment = "videoLikeComent" // 视频中的评论被点赞
 }
 
 // MARK: - autoType 自动动作的类型

+ 16 - 12
BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

@@ -131,14 +131,15 @@ public func kf_imageCacheImage(originUrl: String, completeHandle: @escaping (_ i
 }
 
 /** 打印 */
-public func BFLog<T>(message : T) {
+public func BFLog<T>(message: T) {
 //    if PQBFConfig.shared.enableBFLog {
-//        let logger = NXLogger.shared
-//
-//        logger.level = .info
-//        logger.ouput = .debuggerConsole
-//
-//        logger.d(message as? String ?? "")
+
+    let logger = NXLogger.shared
+
+    logger.level = .info
+    logger.ouput = .debuggerConsole
+
+    logger.d(message as? String ?? "")
 //    } else {
 //        BuglyLog.level(.warn, logs: message as? String)
 //    }
@@ -279,8 +280,11 @@ public func dictionaryToJsonString(_ dic: [String: Any]) -> String? {
 // MARK: 字符串转字典
 
 public func jsonStringToDictionary(_ str: String) -> [String: Any]? {
+    if str.count <= 0 {
+        return [:]
+    }
     let data = str.data(using: String.Encoding.utf8)
-    if data == nil {
+    if data == nil || (data?.count ?? 0) <= 0 {
         return [:]
     }
     if let dict = try? JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as? [String: Any] {
@@ -332,10 +336,10 @@ public func jsonStringToArray(jsonString: String) -> [Any]? {
 ///   - font: <#font description#>
 ///   - size: <#size description#>
 /// - Returns: <#description#>
-public func sizeWithText(attributedText: NSMutableAttributedString? = nil,text: String, font: UIFont, size: CGSize) -> CGSize {
+public func sizeWithText(attributedText: NSMutableAttributedString? = nil, text: String, font: UIFont, size: CGSize) -> CGSize {
     let option = NSStringDrawingOptions.usesLineFragmentOrigin
     if attributedText != nil {
-        let rect: CGRect = attributedText?.boundingRect(with: size, options: option, context: nil) ?? CGRect.init(origin: CGPoint.zero, size: size)
+        let rect: CGRect = attributedText?.boundingRect(with: size, options: option, context: nil) ?? CGRect(origin: CGPoint.zero, size: size)
         return rect.size
     } else {
         let attributes = [NSAttributedString.Key.font: font]
@@ -699,9 +703,9 @@ public func updateTimeToCurrenTime(timeInterval: TimeInterval) -> String {
     let dfmatter = DateFormatter()
     // yyyy-MM-dd HH:mm:ss
     dfmatter.dateFormat = "yyyy年M月d日 HH:mm"
-    
+
     var dfmatterStr = dfmatter.string(from: date as Date)
-    
+
     let currentDF = DateFormatter()
     // yyyy-MM-dd HH:mm:ss
     currentDF.dateFormat = "yyyy"