|
@@ -436,9 +436,14 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
shareBtnRight.setImage(kImage(name: "nav_share_white"), for: UIControl.State.normal)
|
|
|
shareBtnRight.rx.tap.subscribe(onNext: {
|
|
|
[weak self] (data) in
|
|
|
- if let shareClosure = self?.shareClosure {
|
|
|
- shareClosure(self!.videoItemMdl!)
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ if let shareClosure = self?.shareClosure {
|
|
|
+ shareClosure(self!.videoItemMdl!)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}).disposed(by: disposeBag)
|
|
|
return shareBtnRight
|
|
|
}()
|
|
@@ -448,9 +453,14 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
shareBtnLeft.setImage(kImage(name: "nav_share_poster"), for: UIControl.State.normal)
|
|
|
shareBtnLeft.rx.tap.subscribe(onNext: {
|
|
|
[weak self] (data) in
|
|
|
- if let shareClosure = self?.shareClosure {
|
|
|
- shareClosure(self!.videoItemMdl!)
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ if let shareClosure = self?.shareClosure {
|
|
|
+ shareClosure(self!.videoItemMdl!)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}).disposed(by: disposeBag)
|
|
|
return shareBtnLeft
|
|
|
}()
|
|
@@ -475,9 +485,14 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
commentBtn.setImage(kImage(name: "video_btn_note_white"), for: UIControl.State.normal)
|
|
|
commentBtn.titleLabel?.font = kRegularFont14
|
|
|
commentBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
- if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
- buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
+ buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}).disposed(by: disposeBag)
|
|
|
return commentBtn
|
|
|
}()
|
|
@@ -509,24 +524,30 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
collectBtn.setImage(kImage(name: "btn_collect_pre"), for: UIControl.State.selected)
|
|
|
collectBtn.titleLabel?.font = kRegularFont14
|
|
|
collectBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
- collectBtn.isSelected = !collectBtn.isSelected
|
|
|
- // 本地修改收藏数据
|
|
|
- var collectCount = self?.videoItemMdl?.collectCount ?? 0
|
|
|
- if self?.videoItemMdl?.isCollect == 0 {
|
|
|
- collectBtn.setTitle("\(collectCount)", for: .normal)
|
|
|
- collectBtn.setTitle("\(collectCount+1)", for: .selected)
|
|
|
- self?.collectAnimationView.isHidden = false
|
|
|
- self?.collectAnimationView.play(completion: { (_) in
|
|
|
- self?.collectAnimationView.isHidden = true
|
|
|
- })
|
|
|
- } else {
|
|
|
- collectBtn.setTitle("\(collectCount)", for: .selected)
|
|
|
- collectBtn.setTitle("\(collectCount-1)", for: .normal)
|
|
|
- }
|
|
|
- // 点击回调
|
|
|
- if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
- buttonClickClosure(videoBtnClickType.typeCollect, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ collectBtn.isSelected = !collectBtn.isSelected
|
|
|
+ // 本地修改收藏数据
|
|
|
+ var collectCount = self?.videoItemMdl?.collectCount ?? 0
|
|
|
+ if self?.videoItemMdl?.isCollect == 0 {
|
|
|
+ collectBtn.setTitle("\(collectCount)", for: .normal)
|
|
|
+ collectBtn.setTitle("\(collectCount+1)", for: .selected)
|
|
|
+ self?.collectAnimationView.isHidden = false
|
|
|
+ self?.collectAnimationView.play(completion: { (_) in
|
|
|
+ self?.collectAnimationView.isHidden = true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ collectBtn.setTitle("\(collectCount)", for: .selected)
|
|
|
+ collectBtn.setTitle("\(collectCount-1)", for: .normal)
|
|
|
+ }
|
|
|
+ // 点击回调
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
+ buttonClickClosure(videoBtnClickType.typeCollect, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}).disposed(by: disposeBag)
|
|
|
return collectBtn
|
|
|
}()
|
|
@@ -538,24 +559,30 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
likeBtn.setImage(kImage(name: "btn_praise_pre_36px"), for: UIControl.State.selected)
|
|
|
likeBtn.titleLabel?.font = kRegularFont14
|
|
|
likeBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
- likeBtn.isSelected = !likeBtn.isSelected
|
|
|
- // 本地修改点赞数据
|
|
|
- var praiseCount = self?.videoItemMdl?.praiseCount ?? 0
|
|
|
- if self?.videoItemMdl?.isLike == 0 {
|
|
|
- likeBtn.setTitle("\(praiseCount)", for: .normal)
|
|
|
- likeBtn.setTitle("\(praiseCount+1)", for: .selected)
|
|
|
- self?.praiseAnimationView.isHidden = false
|
|
|
- self?.praiseAnimationView.play(completion: { (_) in
|
|
|
- self?.praiseAnimationView.isHidden = true
|
|
|
- })
|
|
|
- } else {
|
|
|
- likeBtn.setTitle("\(praiseCount)", for: .selected)
|
|
|
- likeBtn.setTitle("\(praiseCount-1)", for: .normal)
|
|
|
- }
|
|
|
- // 点击回调
|
|
|
- if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
- buttonClickClosure(videoBtnClickType.typeLike, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ likeBtn.isSelected = !likeBtn.isSelected
|
|
|
+ // 本地修改点赞数据
|
|
|
+ var praiseCount = self?.videoItemMdl?.praiseCount ?? 0
|
|
|
+ if self?.videoItemMdl?.isLike == 0 {
|
|
|
+ likeBtn.setTitle("\(praiseCount)", for: .normal)
|
|
|
+ likeBtn.setTitle("\(praiseCount+1)", for: .selected)
|
|
|
+ self?.praiseAnimationView.isHidden = false
|
|
|
+ self?.praiseAnimationView.play(completion: { (_) in
|
|
|
+ self?.praiseAnimationView.isHidden = true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ likeBtn.setTitle("\(praiseCount)", for: .selected)
|
|
|
+ likeBtn.setTitle("\(praiseCount-1)", for: .normal)
|
|
|
+ }
|
|
|
+ // 点击回调
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
+ buttonClickClosure(videoBtnClickType.typeLike, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}).disposed(by: disposeBag)
|
|
|
return likeBtn
|
|
|
}()
|
|
@@ -579,9 +606,14 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
private lazy var textBtn: UIButton = {
|
|
|
let textBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
textBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
- if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
- buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
+ buttonClickClosure(videoBtnClickType.typeComment, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}).disposed(by: disposeBag)
|
|
|
return textBtn
|
|
|
}()
|
|
@@ -686,8 +718,12 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
avatarButton.masksToBounds = true
|
|
|
avatarButton.rx.tap.subscribe(onNext: {
|
|
|
[weak self] (data) in
|
|
|
- if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
- buttonClickClosure(videoBtnClickType.typePerson, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ kAppDelegate.setLogin()
|
|
|
+ }else {
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
+ buttonClickClosure(videoBtnClickType.typePerson, self?.videoItemMdl?.uid ?? 0, self?.videoItemMdl?.id ?? 0)
|
|
|
+ }
|
|
|
}
|
|
|
}).disposed(by: disposeBag)
|
|
|
return avatarButton
|