|
@@ -305,15 +305,18 @@ class INVideoExportController: BFBaseViewController {
|
|
|
if let url = (avplayer.currentItem?.asset as? AVURLAsset)?.url {
|
|
|
PHPhotoLibrary.shared().performChanges {
|
|
|
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url)
|
|
|
- } completionHandler: { isFinished, _ in
|
|
|
+ } completionHandler: {[weak self] isFinished, _ in
|
|
|
+ guard let sself = self else {
|
|
|
+ return
|
|
|
+ }
|
|
|
if isFinished {
|
|
|
DispatchQueue.main.async {
|
|
|
cShowHUB(superView: nil, msg: "保存成功")
|
|
|
}
|
|
|
- if self.saveAllBtn.isSelected {
|
|
|
- self.hasSaveAll = true
|
|
|
- } else if self.saveOnlyBtn.isSelected {
|
|
|
- self.hasSaveOnly = true
|
|
|
+ if sself.saveAllBtn.isSelected {
|
|
|
+ sself.hasSaveAll = true
|
|
|
+ } else if sself.saveOnlyBtn.isSelected {
|
|
|
+ sself.hasSaveOnly = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -354,10 +357,41 @@ class INVideoExportController: BFBaseViewController {
|
|
|
|
|
|
@objc func completeAction() {
|
|
|
// MARK: 删除所有录制资源. 现在放在了选择相册展示时清理cache
|
|
|
+ if (!self.hasSaveOnly && self.saveOnlyUlr.absoluteString != "aaa")
|
|
|
+ || (!self.hasSaveAll && self.saveAllUlr.absoluteString != "aaa") {
|
|
|
+ let remindData = BFBaseModel()
|
|
|
+ remindData.summary = "合成的视频尚未保存到相册"
|
|
|
+ let alertV = BFRemindView(frame: view.bounds)
|
|
|
+ alertV.isBanned = true
|
|
|
+ alertV.confirmBtn.setTitle("不保存", for: .normal)
|
|
|
+ alertV.cancelBtn.setTitle("确认保存", for: .normal)
|
|
|
+ alertV.remindData = remindData
|
|
|
+ alertV.remindBlock = { [weak self] item, _ in
|
|
|
+ guard let ssefl = self else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if item.tag == 1 { // 确定返回到上一层
|
|
|
+ if ssefl.hasExportOnly{
|
|
|
+ PHPhotoLibrary.shared().performChanges {
|
|
|
+ PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: ssefl.saveOnlyUlr)
|
|
|
+ } completionHandler: { isFinished, _ in
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ssefl.hasExportAll{
|
|
|
+ PHPhotoLibrary.shared().performChanges {
|
|
|
+ PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: ssefl.saveAllUlr)
|
|
|
+ } completionHandler: { isFinished, _ in
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self?.navigationController?.popToRootViewController(animated: true)
|
|
|
|
|
|
-// export.clearFileCache()
|
|
|
-// try? FileManager.default.removeItem(at: self.saveAllUlr)
|
|
|
-// try? FileManager.default.removeItem(at: self.saveOnlyUlr)
|
|
|
+ }
|
|
|
+ UIApplication.shared.keyWindow?.addSubview(alertV)
|
|
|
+ return
|
|
|
+ }
|
|
|
navigationController?.popToRootViewController(animated: true)
|
|
|
}
|
|
|
|