|
@@ -14,6 +14,9 @@ import Kingfisher
|
|
|
import BFUIKit
|
|
|
import Alamofire
|
|
|
|
|
|
+
|
|
|
+//mdf by ak 按 UI图 下方操作区的高度是固定的, 其它区高度和设备自适应
|
|
|
+public let bottomOprationBgViewHeight:CGFloat = 322.0
|
|
|
class PQStuckPointPublicController: BFBaseViewController {
|
|
|
private var isShared: Bool = false // 是否在分享
|
|
|
private var isExportSuccess: Bool = false // 是否导出完成
|
|
@@ -36,10 +39,11 @@ class PQStuckPointPublicController: BFBaseViewController {
|
|
|
var selectedDataCount: Int = 0
|
|
|
// 选择的图片总数-统计使用
|
|
|
var selectedImageDataCount: Int = 0
|
|
|
+
|
|
|
// 最大的宽度
|
|
|
private var maxWidth: CGFloat = cScreenWidth
|
|
|
// 最大的高度
|
|
|
- private var maxHeight: CGFloat = cScreenHeigth > 568 ? 385 : 385*cScreenHeigth/818
|
|
|
+ private var maxHeight: CGFloat = cScreenHeigth - bottomOprationBgViewHeight - cDevice_iPhoneNavBarAndStatusBarHei
|
|
|
// 开始导出的时间
|
|
|
private let startExportDate: Float64 = Date().timeIntervalSince1970
|
|
|
// 导出结束的时间
|
|
@@ -84,6 +88,8 @@ class PQStuckPointPublicController: BFBaseViewController {
|
|
|
private var endMovieLocalURL: URL?
|
|
|
// 保存相册的合成视频地址 水印+片尾 MP4 地址
|
|
|
private var saveMovieLocalURL: URL?
|
|
|
+
|
|
|
+ private var isSaveingLocalVideo = false
|
|
|
|
|
|
//----------------------------
|
|
|
|
|
@@ -322,7 +328,8 @@ class PQStuckPointPublicController: BFBaseViewController {
|
|
|
let titleLabel = UILabel()
|
|
|
titleLabel.numberOfLines = 2
|
|
|
titleLabel.isUserInteractionEnabled = true
|
|
|
- titleLabel.textColor = UIColor.hexColor(hexadecimal: "#ABABAB")
|
|
|
+
|
|
|
+ titleLabel.textColor = PQBFConfig.shared.styleTitleColor
|
|
|
titleLabel.textAlignment = .left
|
|
|
titleLabel.font = UIFont.systemFont(ofSize: 17)
|
|
|
let ges = UITapGestureRecognizer(target: self, action: #selector(titleLabelClick))
|
|
@@ -345,7 +352,7 @@ class PQStuckPointPublicController: BFBaseViewController {
|
|
|
inputText = inputText.replacingOccurrences(of: " ", with: "")
|
|
|
|
|
|
if inputText.count > 0 {
|
|
|
- self?.setTitleText(text: title ?? "", textColor: .black)
|
|
|
+ self?.setTitleText(text: title ?? "", textColor: PQBFConfig.shared.styleTitleColor)
|
|
|
// 更新数据
|
|
|
self?.videoData?.title = title
|
|
|
self?.updateCoverImagegOrTitle()
|
|
@@ -413,7 +420,7 @@ class PQStuckPointPublicController: BFBaseViewController {
|
|
|
|
|
|
// 除了播放器以外的 下半部分操作区
|
|
|
lazy var bottomOprationBgView: UIView = {
|
|
|
- let bottomOprationBgView = UIView(frame: CGRect(x: 0, y: cDevice_iPhoneNavBarAndStatusBarHei + maxHeight, width: cScreenWidth, height: view.frame.height - cDevice_iPhoneNavBarAndStatusBarHei - maxHeight))
|
|
|
+ let bottomOprationBgView = UIView(frame: CGRect(x: 0, y: cDevice_iPhoneNavBarAndStatusBarHei + maxHeight, width: cScreenWidth, height: bottomOprationBgViewHeight))
|
|
|
bottomOprationBgView.backgroundColor = .clear
|
|
|
bottomOprationBgView.isHidden = true
|
|
|
return bottomOprationBgView
|
|
@@ -950,7 +957,7 @@ extension PQStuckPointPublicController {
|
|
|
/// fp2-1-2 - 保存视频到相册
|
|
|
saveStuckPointVideo()
|
|
|
} else {
|
|
|
-// cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
|
|
|
+ cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -961,6 +968,7 @@ extension PQStuckPointPublicController {
|
|
|
|
|
|
if(saveMovieLocalURL == nil){
|
|
|
BFLog(message: "保存相册的视频导出地址无效!!!")
|
|
|
+ cShowHUB(superView: nil, msg: "保存相册的视频导出地址无效")
|
|
|
saveVideoTipsLabel.text = "视频保存失败"
|
|
|
saveRetryBtn.isHidden = false
|
|
|
saveVideoTipsBgView.isHidden = false
|
|
@@ -973,8 +981,10 @@ extension PQStuckPointPublicController {
|
|
|
if authStatus == .authorized {
|
|
|
let photoLibrary = PHPhotoLibrary.shared()
|
|
|
photoLibrary.performChanges({ [weak self] in
|
|
|
+ self?.isSaveingLocalVideo = true
|
|
|
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: (self?.saveMovieLocalURL)!)
|
|
|
}) { [weak self] isFinished, _ in
|
|
|
+ self?.isSaveingLocalVideo = false
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
if self?.view != nil {
|
|
|
if isFinished {
|
|
@@ -997,7 +1007,7 @@ extension PQStuckPointPublicController {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
-// cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
|
|
|
+ cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1315,9 +1325,8 @@ extension PQStuckPointPublicController {
|
|
|
} else {
|
|
|
bottomOprationBgView.isHidden = false
|
|
|
//add by ak 发布成功后如果带片尾的视频还没有生成成功时,出提示
|
|
|
- saveVideoTipsBgView.isHidden = false
|
|
|
self.saveRetryBtn.isHidden = true
|
|
|
- if(saveMovieLocalURL == nil){
|
|
|
+ if(saveMovieLocalURL == nil && self.isSaveingLocalVideo){
|
|
|
saveVideoTipsLabel.text = "视频保存中..."
|
|
|
}else{
|
|
|
self.saveVideoTipsLabel.text = "视频已保存到相册"
|
|
@@ -1325,6 +1334,9 @@ extension PQStuckPointPublicController {
|
|
|
self?.saveVideoTipsBgView.isHidden = true
|
|
|
}
|
|
|
}
|
|
|
+ if self.isSaveingLocalVideo{
|
|
|
+ saveVideoTipsBgView.isHidden = false
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -1438,9 +1450,10 @@ extension PQStuckPointPublicController {
|
|
|
// 发送通知
|
|
|
postNotification(name: cFinishedPublishedNotiKey)
|
|
|
case 97:
|
|
|
+ // 视频保存重试
|
|
|
saveRetryBtn.isHidden = true
|
|
|
saveVideoTipsLabel.text = "视频保存中..."
|
|
|
- self.saveStuckPointVideo()
|
|
|
+ saveStuckPointVideo()
|
|
|
default:
|
|
|
break
|
|
|
}
|