Selaa lähdekoodia

底部滑动黑屏 && 编辑返回相册

Chris 5 vuotta sitten
vanhempi
commit
70c483d603

+ 14 - 8
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -31,6 +31,8 @@ class CommunityVideoListController: BaseViewController {
     
     private var prePlayCell: CommunityVideoCoverCollectionCell?
     
+    private var videoListMdl: CommunityVideoListModel?
+    
     deinit {
         if observe != nil {
             NotificationCenter.default.removeObserver(observe!)
@@ -113,9 +115,11 @@ class CommunityVideoListController: BaseViewController {
     override func setupData() {
         self.communityVideoListApi()
         
-        collectionView.addFooterWithWithHeader(withAutomaticallyRefresh: false) {
+        collectionView.addFooterWithWithHeader(withAutomaticallyRefresh: true) {
             [weak self] (page) in
-            self?.communityVideoListApi(page:page)
+            if page <= self?.videoListMdl?.pagination?.totalPages ?? 1 {
+                self?.communityVideoListApi(page:page)
+            }
         }
     }
     
@@ -326,20 +330,22 @@ extension CommunityVideoListController {
     func communityVideoListApi(page:Int = 1) {
         SwiftMoyaNetWorkServiceCommunity.shared().communityVideoListApi(id: contentId ?? 0, page:page) {
             [weak self] (communityVideoListModel) -> (Void) in
-            let videoListMdl = communityVideoListModel as? CommunityVideoListModel
-            self?.videoItemList = videoListMdl?.data
+            self?.videoListMdl = communityVideoListModel as? CommunityVideoListModel
+            self?.videoItemList = self?.videoListMdl?.data
             self?.collectionView.reloadData()
             
-            if videoListMdl?.pagination?.currentPage ?? 1  <= videoListMdl?.pagination?.totalPages ?? 1 {
-                if videoListMdl?.pagination?.currentPage == 1{
+            if self?.videoListMdl?.pagination?.currentPage ?? 1  <= self?.videoListMdl?.pagination?.totalPages ?? 1 {
+                if self?.videoListMdl?.pagination?.currentPage == 1{
                     self?.videoItemList?.removeAll()
                 }
-                self?.videoItemList = (self?.videoItemList)! + (videoListMdl?.data!)!
+                self?.videoItemList = (self?.videoItemList)! + (self?.videoListMdl?.data!)!
                 self?.collectionView.reloadData()
-                if  self?.videoItemList?.count ?? 0 >= videoListMdl?.pagination?.total ?? 0 {
+                if  self?.videoListMdl?.pagination?.currentPage ?? 1 >= self?.videoListMdl?.pagination?.totalPages ?? 1 {
+                    self?.collectionView.endFooterNoMoreData()
                     self?.collectionView.isHiddenFooter(true)
                 }
             }else {
+                self?.collectionView.endFooterNoMoreData()
                 self?.collectionView.isHiddenFooter(true)
             }
             

+ 8 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMediaPicker/Controller/KSMediaPickerController.swift

@@ -408,6 +408,14 @@ open class KSMediaPickerController: UIViewController, UICollectionViewDelegate,
             }
             cell.isMultipleSelected = maxItemCount > 1
         }
+        
+        // 3.0s以下视频不可选择
+        if mediaType == .video {
+            let duration = Double(itemModel?.asset.duration ?? 0)
+            if duration < 3.0 {
+                itemModel?.isLoseFocus = true
+            }
+        }
         cell.itemModel = itemModel
         return cell
     }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMediaPicker/Model/KSMediaPickerItemModel.swift

@@ -45,8 +45,8 @@ open class KSMediaPickerItemModel: NSObject {
     open var zoomScale: CGFloat?
     open var contentSize: CGSize?
     open var imageFrame: CGRect?
-    open var isHighlight = false
-    open var isLoseFocus = false
+    open var isHighlight = false    // 是否被聚焦显示
+    open var isLoseFocus = false    // 是否被选中
     @objc open var index = UInt(0) {
         didSet {
             if index == 0 {

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMediaPicker/View/KSMediaPickerView.swift

@@ -159,7 +159,7 @@ open class KSMediaPickerView: UIView {
             _panBeginLocationY = pan.location(in: self).y
             break
         case .changed:
-            // preview视图收起展示逻辑
+            // FIXME: preview视图收起展示逻辑
 //            guard let baseY = _baseY else {
 //                return
 //            }