Selaa lähdekoodia

Merge branch 'develop' into feature/jeremy

# Conflicts:
#	RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecordMusicView.swift
南鑫林 5 vuotta sitten
vanhempi
commit
a11130406d

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift

@@ -851,6 +851,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
                 titleTopSpace = 20
             } else {
                 // 无标题
+                videoTitleLabel.text = ""
                 titleHeight = 0
                 titleTopSpace = 10
             }

+ 33 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -455,6 +455,16 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
     return _filterView;
 }
 
+//音乐
+- (PublishMusicChooseView *)musicView {
+    if (!_musicView) {
+        _musicView = [[PublishMusicChooseView alloc] initWithFrame:CGRectMake(0, ScreenHeight, ScreenWidth, ScreenHeight - SafeTop - SafeBottom - 22)];
+        [self.view addSubview:_musicView];
+        [_musicView addVisualEffect];
+    }
+    return _musicView;
+}
+
 - (AliyunDBHelper *)dbHelper {
     if (!_dbHelper) {
         _dbHelper = [[AliyunDBHelper alloc] init];
@@ -673,6 +683,9 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
 
 - (void)musicViewDidClose {
     [self resume];
+    
+    [self hideMusicView:YES];
+
 }
 
 
@@ -1261,7 +1274,26 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
 //音乐
 - (void)musicButtonClicked {
     [self pause];
-    self.musicView = [PublishMusicChooseView publishMusicChooseViewWithAttachedView:self.view curMusicUrl:self.curMusicUrl oriVolumn:self.originAudioVolumn backVolumn:self.backAudioVolumn];
+    
+    [self.musicView setCurMusicUrl:self.curMusicUrl];
+    self.musicView.attachedView = self.view;
+    self.musicView.originVolumn = self.originAudioVolumn;
+    self.musicView.backVolumn = self.backAudioVolumn;
+    
+    [self hideMusicView:NO];
+}
+
+- (void)hideMusicView:(BOOL)hidden {
+    CGRect frame = self.musicView.frame;
+    if (hidden) {
+        frame.origin.y = ScreenHeight;
+    }else {
+        frame.origin.y = ScreenHeight - self.musicView.bounds.size.height;
+    }
+    
+    [UIView animateWithDuration:0.2 animations:^{
+        self.musicView.frame = frame;
+    }];
 }
 
 //时间特效

+ 30 - 3
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m

@@ -466,6 +466,7 @@
 }
 
 - (void)musicViewDidClose {
+    [self hideMusicView:YES];
     self.magicCameraView.rateView.hidden = false;
     
     if (self.clipManager.partCount == 0) {
@@ -700,6 +701,7 @@
     [self.magicCameraView refreshFocusPointWithPoint:point];
     
     [self hideFilterView:YES];
+    [self hideMusicView:YES];
     
     if (self.clipManager.partCount == 0) {
         if (self.hideSegmentBlock) {
@@ -841,15 +843,30 @@
     _lastCameraPosition = _recorder.cameraPosition;
 }
 
-- (void)musicButtonClicked
-{
-    self.musicView = [PublishRecordMusicView publishRecordMusicViewWithAttachedView:self.view curMusicUrl:self.curMusicUrl];
+- (void)musicButtonClicked {
+    [self.musicView setCurMusicUrl:self.curMusicUrl];
+    [self hideMusicView:NO];
+    
     if (self.hideSegmentBlock) {
         self.hideSegmentBlock(true);
         self.magicCameraView.rateView.hidden = true;
     }
 }
 
+- (void)hideMusicView:(BOOL)hidden {
+    CGRect frame = self.musicView.frame;
+    if (hidden) {
+        frame.origin.y = ScreenHeight;
+    }else {
+        frame.origin.y = ScreenHeight - self.musicView.bounds.size.height;
+    }
+    
+    self.magicCameraView.rateView.hidden = false;
+    [UIView animateWithDuration:0.2 animations:^{
+        self.musicView.frame = frame;
+    }];
+}
+
 - (void)filterButtonClicked {
     [self hideFilterView:NO];
     if (self.hideSegmentBlock) {
@@ -1129,6 +1146,16 @@
     return _filterView;
 }
 
+//音乐
+- (PublishRecordMusicView *)musicView {
+    if (!_musicView) {
+        _musicView = [[PublishRecordMusicView alloc] initWithFrame:CGRectMake(0, ScreenHeight, ScreenWidth, ScreenHeight - SafeTop - SafeBottom - 22)];
+        [self.view addSubview:_musicView];
+        [_musicView addVisualEffect];
+    }
+    return _musicView;
+}
+
 #pragma mark - JXSegmentedDelegate
 
 - (UIView *)listView {

+ 10 - 8
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishManager/PublishUploadManager.swift

@@ -97,7 +97,7 @@ extension PublishUploadManager: AlivcShortVideoUploadManagerDelegate {
     
     // 上传进度回调
     func uploadManager(_ manager: AlivcShortVideoUploadManager!, updateProgress progress: CGFloat) {
-        print("\n--------uploadProgress == \(progress)")
+        NXLLog("\n--------uploadProgress == \(progress)")
 
         DispatchQueue.main.async(execute: {
 //            self.progressView.progress = Float(progress)
@@ -129,7 +129,7 @@ extension PublishUploadManager: AlivcShortVideoUploadManagerDelegate {
             // 设置主图
             self?.majorImageUrl = imgUrl as? String
             
-            print("------视频上传成功,去发布")
+            NXLLog("------视频上传成功,去发布")
             self?.progressView?.curUploadStatus = .success
             self?.communityPublishApi()
         }
@@ -143,6 +143,8 @@ extension PublishUploadManager {
     // 设置图片上传参数
     func setImagesPath(_ imageArr: Array<UIImage>) {
         self.imageArr = imageArr
+        // 新发布时置空管理类内部的imageUrl数组
+        self.imageUrlArray = []
     }
     
     // 上传图片
@@ -151,7 +153,7 @@ extension PublishUploadManager {
         
         var curTimes: Int = totalTimes
         
-        print("-----StartUpload,totalTimes == \(totalTimes)")
+        NXLLog("-----StartUpload,totalTimes == \(totalTimes)")
         SwiftMoyaNetWorkServiceConfig.shared().configUploadSingleImgWithoutHudApi(imageArray: [self.imageArr![totalTimes]]) {
             [weak self] (imgUrl) -> (Void) in
             let urlStr: String = imgUrl as! String
@@ -167,12 +169,12 @@ extension PublishUploadManager {
                 self?.majorImageUrl = urlStr
             }
             
-            print("-----FinishUpload,Times == \(curTimes)")
+            NXLLog("-----FinishUpload,Times == \(curTimes)")
             curTimes += 1
             // 更新进度
             DispatchQueue.main.async {
-                print("----\(Thread.current)")
-                print("----uploadProgress == \(Float(curTimes)/Float((self?.imageArr!.count)!))")                                
+                NXLLog("----\(Thread.current)")
+                NXLLog("----uploadProgress == \(Float(curTimes)/Float((self?.imageArr!.count)!))")
                 
                 self?.progressView?.uploadProgress = Float(curTimes/(self?.imageArr!.count)!)
                 
@@ -181,7 +183,7 @@ extension PublishUploadManager {
             if curTimes < self?.imageArr?.count ?? 0 {
                 self?.uploadAllImages(totalTimes: curTimes)
             } else {
-                print("------图片上传成功,去发布")
+                NXLLog("------图片上传成功,去发布")
                 self?.progressView?.curUploadStatus = .success
                 self?.communityPublishApi()
             }
@@ -213,7 +215,7 @@ extension PublishUploadManager {
         let topicJsonStr = JSON(selTopicIdArr).description
         let imgsJsonStr = JSON(imageUrlArray).description
         
-        print("----mediaType == \(typeStr)\n----pubTitle = \(pubTitle)\n----topicJsonStr == \(topicJsonStr)\n----imgsJsonStr == \(imgsJsonStr)")
+        NXLLog("----mediaType == \(typeStr)\n----pubTitle = \(pubTitle)\n----topicJsonStr == \(topicJsonStr)\n----imgsJsonStr == \(imgsJsonStr)")
         
         SwiftMoyaNetWorkServiceCommunity.shared().communityPublishApi(type: typeStr, img: majorImageUrl ?? "", topic_ids: topicJsonStr, video: paraVideo, title: pubTitle, content: pubContent, location: locationStr, imgs: imgsJsonStr) {
             [weak self] (communityPublishModel) -> (Void) in

+ 31 - 75
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicChooseView.swift

@@ -7,30 +7,29 @@
 //  编辑视频--选择音乐のView
 
 import UIKit
-import FWPopupView
 import RxSwift
 import SwiftyMediator
 import JXSegmentedView
 
-class PublishMusicChooseView: FWPopupView {
+class PublishMusicChooseView: BaseView {
     
-    let disposeBag = DisposeBag()
-    
-    var originVolumn: CGFloat?
-    var backVolumn: CGFloat?
+    @objc public var attachedView: UIView?
+    @objc public var originVolumn: CGFloat = 0
+    @objc public var backVolumn: CGFloat = 0
     
     typealias RecommendClosure = () -> Void
     var recommendClosure : RecommendClosure?
     
-    var curMusicUrl: String?
+    @objc public var curMusicUrl: String? {
+        didSet {
+            // 获取分类列表
+            self.communityGetMusicCategoryApi()
+        }
+    }
     
     override init(frame: CGRect) {
         super.init(frame: frame)
-        setupViews()
-        setupLayouts()
         
-        // 获取分类列表
-        self.communityGetMusicCategoryApi()
     }
     
     required init?(coder aDecoder: NSCoder) {
@@ -55,15 +54,7 @@ class PublishMusicChooseView: FWPopupView {
         }
     }
     
-    func setupViews() {
-        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
-        
-        // 添加毛玻璃效果,需使用frame设置位置
-        let blurEffect = UIBlurEffect(style: .dark)
-        let blurEffectView = UIVisualEffectView(effect: blurEffect)
-        blurEffectView.frame = CGRect(x: CGFloat(0), y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
-        addSubview(blurEffectView)
-        
+    override func setupViews() {
         self.backgroundColor = UIColor.clear
         
         configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
@@ -79,7 +70,7 @@ class PublishMusicChooseView: FWPopupView {
         addSubview(v_lineLabel)
     }
     
-    func setupLayouts() {
+    override func setupLayouts() {
         
         cancelButton.snp.makeConstraints { (make) in
             make.top.equalTo(2)
@@ -136,6 +127,12 @@ class PublishMusicChooseView: FWPopupView {
     lazy var cancelButton: UIButton = {
         let cancelButton = UIButton(type: UIButton.ButtonType.custom)
         cancelButton.setImage(kImage(name: "video_btn_close_white"), for: .normal)
+        cancelButton.rx.tap.subscribe(onNext: { [weak self] in
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "EditCloseMusicChooseViewNoti"), object: nil)
+            
+            MusicPlayManager.shared().destroyPlayer()
+            MusicPlayManager.shared().curPlayingId = -1
+        }).disposed(by: disposeBag)
         return cancelButton
     }()
     
@@ -152,6 +149,9 @@ class PublishMusicChooseView: FWPopupView {
         recommendButton.setTitle("点击推荐", for: UIControl.State.normal)
         recommendButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
         recommendButton.titleLabel?.font = kMediumFont14
+        recommendButton.rx.tap.subscribe(onNext: { [weak self] in
+            Mediator.push(PublishRouterModuleType.pushMucisChooseView)
+        }).disposed(by: disposeBag)
         return recommendButton
     }()
     
@@ -166,6 +166,9 @@ class PublishMusicChooseView: FWPopupView {
         musicButton.setTitle("配乐", for: UIControl.State.normal)
         musicButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
         musicButton.titleLabel?.font = kMediumFont17
+        musicButton.rx.tap.subscribe(onNext: { [weak self] in
+            
+        }).disposed(by: disposeBag)
         return musicButton
     }()
     
@@ -174,6 +177,11 @@ class PublishMusicChooseView: FWPopupView {
         volumnButton.setTitle("音量", for: UIControl.State.normal)
         volumnButton.setTitleColor(k999999Color, for: UIControl.State.normal)
         volumnButton.titleLabel?.font = kRegularFont16
+        volumnButton.rx.tap.subscribe(onNext: { [weak self] in
+            _ = PublishMusicVolumnView.publishMusicVolumnView(attachedView: self?.attachedView ?? UIView(), oriVolumn: self?.originVolumn ?? 0, backVolumn: self?.backVolumn ?? 0)
+            
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "EditCloseMusicChooseViewNoti"), object: nil)
+        }).disposed(by: disposeBag)
         return volumnButton
     }()
     
@@ -187,8 +195,7 @@ class PublishMusicChooseView: FWPopupView {
     //MARK: -
     //1.初始化JXSegmentedView
     lazy var segmentedView: JXSegmentedView = {
-//        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: 44))
-        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: 44+100))
+        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: 44))
         segmentedView.delegate = self
         segmentedView.dataSource = segmentedDataSource
         segmentedView.indicators = [indicator]
@@ -236,59 +243,9 @@ class PublishMusicChooseView: FWPopupView {
         let listContainerView = JXSegmentedListContainerView(dataSource: self)
         listContainerView.didAppearPercent = 0.01
         listContainerView.defaultSelectedIndex = 0
-//        listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 103 - 114)
-        
-        listContainerView.frame = CGRect(x: 0, y: 48+44+100, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 103 - 114-100)
+        listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 103 - 114)
         return listContainerView
     }()
-    
-    /// 初始化View
-    @objc class func publishMusicChooseView(attachedView:UIView, curMusicUrl:String, oriVolumn:CGFloat, backVolumn:CGFloat) -> PublishMusicChooseView {
-        let view = PublishMusicChooseView()
-        view.attachedView = attachedView
-        view.originVolumn = oriVolumn
-        view.backVolumn = backVolumn
-        view.curMusicUrl = curMusicUrl
-        let vProperty = FWPopupViewProperty()
-        vProperty.popupCustomAlignment = .bottomCenter
-        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        vProperty.popupAnimationType = .frame
-        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
-        // 用户点击外部遮罩层页面是否可以消失
-        vProperty.touchWildToHide = "0"
-        view.vProperty = vProperty
-        view.show()
-        
-        view.cancelButton.rx.tap.subscribe(onNext: { (data) in            
-            view.hide()
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "EditCloseMusicChooseViewNoti"), object: nil)
-            
-            MusicPlayManager.shared().destroyPlayer()
-            MusicPlayManager.shared().curPlayingId = -1
-            
-        }).disposed(by: view.disposeBag)
-        
-        
-        view.recommendButton.rx.tap.subscribe(onNext: { (data) in
-            Mediator.push(PublishRouterModuleType.pushMucisChooseView)
-            
-        }).disposed(by: view.disposeBag)
-        
-        view.musicButton.rx.tap.subscribe(onNext: { (data) in
-            
-        }).disposed(by: view.disposeBag)
-        
-        view.volumnButton.rx.tap.subscribe(onNext: { (data) in
-            view.hide(popupDidDisappearBlock: { (view1) in
-                _ = PublishMusicVolumnView.publishMusicVolumnView(attachedView: attachedView, oriVolumn: oriVolumn, backVolumn: backVolumn)
-                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "EditCloseMusicChooseViewNoti"), object: nil)
-            })
-            
-        }).disposed(by: view.disposeBag)
-        
-        return view
-    }
-    
 }
 
 // MARK: - JXSegmentedViewDelegate
@@ -361,7 +318,6 @@ extension PublishMusicChooseView :JXSegmentedListContainerViewDataSource {
         
         MusicPlayManager.shared().destroyPlayer()
         MusicPlayManager.shared().curPlayingId = -1
-        self.hide()
     }
 }
 

+ 19 - 66
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecordMusicView.swift

@@ -7,29 +7,25 @@
 //  录制视频--选择音乐のView
 
 import UIKit
-import FWPopupView
 import RxSwift
 import SwiftyMediator
 import JXSegmentedView
-import pop
 
-
-class PublishRecordMusicView: FWPopupView {
-    
-    let disposeBag = DisposeBag()
+class PublishRecordMusicView: BaseView {
     
     typealias RecommendClosure = () -> Void
     var recommendClosure : RecommendClosure?
     
-    var curMusicUrl: String?
+    @objc public var curMusicUrl: String? {
+        didSet {
+            // 获取分类列表
+            self.communityGetMusicCategoryApi()
+        }
+    }
     
     override init(frame: CGRect) {
         super.init(frame: frame)
-        setupViews()
-        setupLayouts()
         
-        // 获取分类列表
-        self.communityGetMusicCategoryApi()
     }
     
     required init?(coder aDecoder: NSCoder) {
@@ -54,16 +50,8 @@ class PublishRecordMusicView: FWPopupView {
         }
     }
     
-    func setupViews() {
-//        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
-        
-        // 添加毛玻璃效果,需使用frame设置位置
-        let blurEffect = UIBlurEffect(style: .dark)
-        let blurEffectView = UIVisualEffectView(effect: blurEffect)
-        blurEffectView.frame = CGRect(x: CGFloat(0), y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
-        addSubview(blurEffectView)
-        
-        self.backgroundColor = UIColor.white
+    override func setupViews() {
+        self.backgroundColor = UIColor.clear
         
         configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
         
@@ -73,7 +61,7 @@ class PublishRecordMusicView: FWPopupView {
         addSubview(recommendButton)
     }
     
-    func setupLayouts() {
+    override func setupLayouts() {
         
         cancelButton.snp.makeConstraints { (make) in
             make.top.equalTo(2)
@@ -104,6 +92,12 @@ class PublishRecordMusicView: FWPopupView {
     lazy var cancelButton: UIButton = {
         let cancelButton = UIButton(type: UIButton.ButtonType.custom)
         cancelButton.setImage(kImage(name: "video_btn_close_white"), for: .normal)
+        cancelButton.rx.tap.subscribe(onNext: { [weak self] in
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "RecordCloseMusicChooseViewNoti"), object: nil)
+            
+            MusicPlayManager.shared().destroyPlayer()
+            MusicPlayManager.shared().curPlayingId = -1
+        }).disposed(by: disposeBag)
         return cancelButton
     }()
     
@@ -120,6 +114,9 @@ class PublishRecordMusicView: FWPopupView {
         recommendButton.setTitle("点击推荐", for: UIControl.State.normal)
         recommendButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
         recommendButton.titleLabel?.font = kMediumFont14
+        recommendButton.rx.tap.subscribe(onNext: { [weak self] in
+            Mediator.push(PublishRouterModuleType.pushMucisChooseView)
+        }).disposed(by: disposeBag)
         return recommendButton
     }()
     
@@ -177,49 +174,6 @@ class PublishRecordMusicView: FWPopupView {
         listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 55 - 114)
         return listContainerView
     }()
-    
-    /// 初始化View    
-    @objc class func publishRecordMusicView(attachedView:UIView, curMusicUrl:String) -> PublishRecordMusicView {
-        
-        let view = PublishRecordMusicView(frame:CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
-)
-//        let base = POPBasicAnimation(propertyNamed: kPOPLayerPositionY)
-//        base?.toValue = 88
-//        base?.beginTime = CFTimeInterval() + 1.0
-//        view.pop_add(base, forKey: "position.y")
-        attachedView.addSubview(view)
-        
-        
-//        let view = PublishRecordMusicView()
-//        view.attachedView = attachedView
-//        view.curMusicUrl = curMusicUrl
-//        let vProperty = FWPopupViewProperty()
-//        vProperty.popupCustomAlignment = .bottomCenter
-//        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-//        vProperty.popupAnimationType = .frame
-//        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
-//        // 用户点击外部遮罩层页面是否可以消失
-//        vProperty.touchWildToHide = "0"
-//        view.vProperty = vProperty
-//        view.show()
-//
-//        view.cancelButton.rx.tap.subscribe(onNext: { (data) in
-//            view.hide()
-//            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "RecordCloseMusicChooseViewNoti"), object: nil)
-//
-//            MusicPlayManager.shared().destroyPlayer()
-//            MusicPlayManager.shared().curPlayingId = -1
-//
-//        }).disposed(by: view.disposeBag)
-//
-//        view.recommendButton.rx.tap.subscribe(onNext: { (data) in
-//            Mediator.push(PublishRouterModuleType.pushMucisChooseView)
-//
-//        }).disposed(by: view.disposeBag)
-        
-        return view
-    }
-    
 }
 
 // MARK: - JXSegmentedViewDelegate
@@ -292,7 +246,6 @@ extension PublishRecordMusicView :JXSegmentedListContainerViewDataSource {
         
         MusicPlayManager.shared().destroyPlayer()
         MusicPlayManager.shared().curPlayingId = -1
-        self.hide()
     }
 }