|
@@ -10,6 +10,7 @@ import UIKit
|
|
|
|
|
|
class PublishEditVideoContentViewController: BaseViewController {
|
|
|
|
|
|
+ var isRenewEdit : Bool = false
|
|
|
/// 合成导出路径
|
|
|
var outputPath : String?
|
|
|
/// 封面路径
|
|
@@ -30,12 +31,13 @@ class PublishEditVideoContentViewController: BaseViewController {
|
|
|
setVideoCoverImagePath()
|
|
|
setupViews()
|
|
|
setupLayouts()
|
|
|
+ setupData()
|
|
|
}
|
|
|
|
|
|
func setVideoCoverImagePath() {
|
|
|
-
|
|
|
- // 视频路径
|
|
|
- if publishManagerVideoModel == nil {
|
|
|
+
|
|
|
+ if publishManagerModel == nil {
|
|
|
+ // 视频路径
|
|
|
let asset = AVURLAsset.init(url: URL(fileURLWithPath: outputPath ?? ""))
|
|
|
let gen = AVAssetImageGenerator.init(asset: asset)
|
|
|
gen.appliesPreferredTrackTransform = true
|
|
@@ -66,23 +68,22 @@ class PublishEditVideoContentViewController: BaseViewController {
|
|
|
publishManagerVideoModel?.outVideoPathURL = URL(fileURLWithPath: outputPath ?? "")
|
|
|
publishManagerVideoModel?.outCoverImagePath = outCoverImagePath
|
|
|
publishManagerVideoModel?.outCoverImagePathURL = URL(fileURLWithPath: outCoverImagePath ?? "")
|
|
|
- }
|
|
|
-
|
|
|
- // 内容
|
|
|
- if publishManagerContentModel == nil {
|
|
|
+ //发布内容
|
|
|
publishManagerContentModel = PublishManagerContentModel()
|
|
|
- }
|
|
|
-
|
|
|
- //话题
|
|
|
- if publishManagerTopicModel == nil {
|
|
|
+ // 话题
|
|
|
publishManagerTopicModel = PublishManagerTopicModel()
|
|
|
- }
|
|
|
-
|
|
|
- //定位
|
|
|
- if publishManagerLocationModel == nil {
|
|
|
+ // 定位
|
|
|
publishManagerLocationModel = PublishManagerLocationModel()
|
|
|
+ }else {
|
|
|
+ // 视频路径
|
|
|
+ publishManagerVideoModel = publishManagerModel?.video
|
|
|
+ //发布内容
|
|
|
+ publishManagerContentModel = publishManagerModel?.content
|
|
|
+ // 话题
|
|
|
+ publishManagerTopicModel = publishManagerModel?.topic
|
|
|
+ // 定位
|
|
|
+ publishManagerLocationModel = publishManagerModel?.location
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
override func setupViews() {
|
|
@@ -107,6 +108,10 @@ class PublishEditVideoContentViewController: BaseViewController {
|
|
|
|
|
|
override func setupData() {
|
|
|
|
|
|
+ publishButton.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
+ self?.publishAction()
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
lazy var publishButton: UIButton = {
|
|
@@ -140,7 +145,36 @@ class PublishEditVideoContentViewController: BaseViewController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ func publishAction() {
|
|
|
+ if publishManagerContentModel?.detailTitle?.count == 0 || publishManagerContentModel?.detailTitle == nil || publishManagerContentModel?.detailTitle == "" {
|
|
|
+ SwiftProgressHUD.shared().showText("还没输入描述内容")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if publishManagerTopicModel?.topics?.isEmpty ?? true {
|
|
|
+ SwiftProgressHUD.shared().showText("还没选择话题哟")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if publishManagerModel == nil {
|
|
|
+ publishManagerModel = PublishManagerModel()
|
|
|
+ }
|
|
|
+ publishManagerModel?.publishType = .video
|
|
|
+ publishManagerModel?.video = publishManagerVideoModel
|
|
|
+ publishManagerModel?.content = publishManagerContentModel
|
|
|
+ publishManagerModel?.topic = publishManagerTopicModel
|
|
|
+ publishManagerModel?.location = publishManagerLocationModel
|
|
|
+
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "DismissFromPublishEditVc"), object: publishManagerModel)
|
|
|
|
|
|
+ if isRenewEdit {
|
|
|
+ self.navigationController?.popViewController(animated: true)
|
|
|
+ }else {
|
|
|
+ self.dismissToRootViewController(animated: false) {
|
|
|
+ BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// MARK: - tableView dataSource && delegate
|