Browse Source

修复了评论

南鑫林 5 years ago
parent
commit
f95af44ff9

+ 5 - 5
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift

@@ -164,11 +164,11 @@ extension AppDelegate {
     
     /// 授权
     func setPermission() {
-        NXLPermission.request(NXLPermissionType.locationAlwaysAndWhenInUse) {}
-        NXLPermission.request(NXLPermissionType.notification) {}
-        NXLPermission.request(NXLPermissionType.photoLibrary) {}
-        NXLPermission.request(NXLPermissionType.camera) {}
-        NXLPermission.request(NXLPermissionType.microphone) {}
+//        NXLPermission.request(NXLPermissionType.locationAlwaysAndWhenInUse) {}
+//        NXLPermission.request(NXLPermissionType.notification) {}
+//        NXLPermission.request(NXLPermissionType.photoLibrary) {}
+//        NXLPermission.request(NXLPermissionType.camera) {}
+//        NXLPermission.request(NXLPermissionType.microphone) {}
     }
     
 }

+ 7 - 4
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/Comment/CardContentCommnetTableViewCell.swift

@@ -59,11 +59,9 @@ class CardContentCommnetTableViewCell: UITableViewCell {
         }
     }
     
-    private lazy var avatarButton: UIButton = {
+    lazy var avatarButton: UIButton = {
         let avatarButton = UIButton()
-        avatarButton.kf.setImage(with: kURLImage(name: UserModel.shared().getModel()?.avatarurl ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
         //KingfisherManager.shared.cache.clearMemoryCache()
-
         avatarButton.cornerRadius = 14
         avatarButton.masksToBounds = true
         return avatarButton
@@ -89,5 +87,10 @@ class CardContentCommnetTableViewCell: UITableViewCell {
         }).disposed(by: disposeBag)
         return addCommnetButton
     }()
-
+    
+    var isAvatar : Bool? {
+        didSet {
+            avatarButton.kf.setImage(with: kURLImage(name: UserModel.shared().getModel()?.avatarurl ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
+        }
+    }
 }

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -492,6 +492,7 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
                 self?.communityFollowDataModel = communityFollowDataModel
                 self?.showKeyBoardCommentView()
             }
+            cell.isAvatar = true
             return cell
         default:
             return UITableViewCell()

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift

@@ -377,6 +377,7 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
                     self?.communityRecommendDataModel = self?.communityRecommendDataModels[indexPath.section]
                     self?.showKeyBoardCommentView()
                 }
+                 cell.isAvatar = true
                 return cell
             default:
                 return UITableViewCell()

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -475,6 +475,7 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
                 self?.communityRecommendDataModel = self?.communityRecommendDataModels[indexPath.section]
                 self?.showKeyBoardCommentView()
             }
+             cell.isAvatar = true
             return cell
         default:
             return UITableViewCell()

+ 0 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/RecommendNoneCommentCell.swift

@@ -158,7 +158,6 @@ class RecommendNoneCommentCell: UITableViewCell {
     var communityPostDetailModel : CommunityPostDetailModel? {
         didSet {
             iconButton.kf.setImage(with: kURLImage(name: UserModel.shared().getModel()?.avatarurl ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
-            //KingfisherManager.shared.cache.clearMemoryCache()
         }
     }
     

+ 6 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityAllCommentView.swift

@@ -15,6 +15,7 @@ class CommunityAllCommentView: FWPopupView {
     
     let disposeBag = DisposeBag()
     
+    
     typealias DismissTransBlock = () -> Void
     var disTransBlock : DismissTransBlock?
     
@@ -169,7 +170,7 @@ class CommunityAllCommentView: FWPopupView {
     }
     
     /// 自定义评论View
-    class func communityAllCommentView(view:UIView? = nil,postId:Int, videoItemMdl: CommunityVideoItemModel) -> CommunityAllCommentView {
+    class func communityAllCommentView(view:UIView? = nil,postId:Int, videoItemMdl: CommunityVideoItemModel,isShow:Bool? = true) -> CommunityAllCommentView {
         let commentView = CommunityAllCommentView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kSafeTabBarHeight + 500))
         commentView.attachedView = view
         
@@ -186,8 +187,10 @@ class CommunityAllCommentView: FWPopupView {
         commentView.vProperty = vProperty
         commentView.show { [weak commentView] (popupView, popupViewState) in
             if popupViewState == .didAppear {
-                commentView?.communityPostCommentModel = nil
-                commentView?.showKeyBoardCommentView(placeholder:"添加评论...")
+                if isShow ?? true {
+                    commentView?.communityPostCommentModel = nil
+                    commentView?.showKeyBoardCommentView(placeholder:"添加评论...")
+                }
             }
         }
         commentView.disTransBlock = {

+ 7 - 7
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift

@@ -32,7 +32,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     typealias ShareClosure = (_ videoItemMdl: CommunityVideoItemModel) -> Void
     var shareClosure : ShareClosure?
     
-    typealias ButtonClickClosure = (_ clickType: videoBtnClickType, _ uid: Int, _ postId: Int) -> Void
+    typealias ButtonClickClosure = (_ clickType: videoBtnClickType, _ uid: Int, _ postId: Int,_ isShow:Bool) -> Void
     var buttonClickClosure : ButtonClickClosure?
     
     typealias FollowClosure = (_ videoItemMdl: CommunityVideoItemModel, _ button: UIButton) -> Void
@@ -164,7 +164,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
                     })
                     // 点击回调
                     if let buttonClickClosure = self.buttonClickClosure {
-                        buttonClickClosure(videoBtnClickType.typeLike, self.videoItemMdl?.uid ?? 0, self.videoItemMdl?.id ?? 0)
+                        buttonClickClosure(videoBtnClickType.typeLike, self.videoItemMdl?.uid ?? 0, self.videoItemMdl?.id ?? 0, true)
                     }
                 }
                 
@@ -545,7 +545,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
                 kAppDelegate.setLogin()
             }else {
                 if let buttonClickClosure = self?.buttonClickClosure {
-                    buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
+                    buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0, false)
                 }
             }
 
@@ -600,7 +600,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
 
                 // 点击回调
                 if let buttonClickClosure = self?.buttonClickClosure {
-                    buttonClickClosure(videoBtnClickType.typeCollect, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
+                    buttonClickClosure(videoBtnClickType.typeCollect, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0, true)
                 }
             }
             
@@ -635,7 +635,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
                 }
                 // 点击回调
                 if let buttonClickClosure = self?.buttonClickClosure {
-                    buttonClickClosure(videoBtnClickType.typeLike, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
+                    buttonClickClosure(videoBtnClickType.typeLike, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0,true)
                 }
             }
             
@@ -666,7 +666,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
                 kAppDelegate.setLogin()
             }else {
                 if let buttonClickClosure = self?.buttonClickClosure {
-                    buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
+                    buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0,true)
                 }
             }
         }).disposed(by: disposeBag)
@@ -778,7 +778,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
                 kAppDelegate.setLogin()
             }else {
                 if let buttonClickClosure = self?.buttonClickClosure {
-                    buttonClickClosure(videoBtnClickType.typePerson, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
+                    buttonClickClosure(videoBtnClickType.typePerson, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0, true)
                 }
             }
         }).disposed(by: disposeBag)

+ 4 - 4
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -244,10 +244,10 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
             CommunityFollowUserViewModel.shared.follow(communityVideoItemModel: videoItemMdl,videoItemList:(self?.videoItemList)!, button: followButton)
         }
         cell.buttonClickClosure = {
-            [weak self] (clickType, uid, postId) in
+            [weak self] (clickType, uid, postId,isShow) in
             switch clickType {
             case videoBtnClickType.typeComment:
-                self?.showCommentView(postId: postId, videoItemMdl: (self?.videoItemList?[indexPath.row])!)
+                self?.showCommentView(postId: postId, videoItemMdl: (self?.videoItemList?[indexPath.row])!, isShow: isShow)
                 
             case videoBtnClickType.typeLike:
                 VirusViewModel.shared.praise(communityVideoItemModel: (self?.videoItemList?[indexPath.row])!)
@@ -343,8 +343,8 @@ extension CommunityVideoListController {
         }
     }
     
-    func showCommentView(postId: Int, videoItemMdl: CommunityVideoItemModel) {
-        commentAlertSheetView = CommunityAllCommentView.communityAllCommentView(view:self.view,postId: postId, videoItemMdl: videoItemMdl)
+    func showCommentView(postId: Int, videoItemMdl: CommunityVideoItemModel,isShow:Bool) {
+        commentAlertSheetView = CommunityAllCommentView.communityAllCommentView(view:self.view,postId: postId, videoItemMdl: videoItemMdl,isShow:isShow)
     }
     
     /// 分享