Browse Source

improvements

marinofaggiana 4 years ago
parent
commit
b6a953cd14

+ 6 - 1
iOSClient/Main/Colleaction Common/NCCollectionCommon.swift

@@ -210,16 +210,21 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
     
     // MARK: - Live Photo
     
-    func saveLivePhoto(metadata: tableMetadata, metadataMov: tableMetadata, progressView: UIProgressView?) {
+    func saveLivePhoto(metadata: tableMetadata, metadataMov: tableMetadata, progressView: UIProgressView?, viewActivity: UIView?) {
         
         let fileNameImage = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!)
         let fileNameMov = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadataMov.ocId, fileNameView: metadataMov.fileNameView)!)
         
+        if let view = viewActivity {
+            NCUtility.shared.startActivityIndicator(view: view)
+        }
+        
         NCLivePhoto.generate(from: fileNameImage, videoURL: fileNameMov, progress: { progress in
             DispatchQueue.main.async {
                 progressView?.progress = Float(progress)
             }
         }, completion: { livePhoto, resources in
+            NCUtility.shared.stopActivityIndicator()
             progressView?.progress = 0
             if resources != nil {
                 NCLivePhoto.saveToLibrary(resources!) { (result) in

+ 1 - 1
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -1078,7 +1078,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                         
                         save = UIAction(title: NSLocalizedString("_livephoto_save_", comment: ""), image: UIImage(systemName: "square.and.arrow.down")) { action in
                             
-                            NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMov: metadataLive, progressView: nil)
+                            NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMov: metadataLive, progressView: nil, viewActivity: self.view)
                         }
                     }
                 }

+ 1 - 1
iOSClient/Media/NCMedia.swift

@@ -518,7 +518,7 @@ extension NCMedia: UICollectionViewDelegate {
                         
                         save = UIAction(title: NSLocalizedString("_livephoto_save_", comment: ""), image: UIImage(systemName: "square.and.arrow.down")) { action in
                             
-                            NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMov: metadataLive, progressView: nil)
+                            NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMov: metadataLive, progressView: nil, viewActivity: self.view)
                         }
                     }
                 }

+ 1 - 1
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -224,7 +224,7 @@ class NCViewerImage: UIViewController {
         if let userInfo = notification.userInfo as NSDictionary? {
             if let ocId = userInfo["ocId"] as? String, let ocIdMov = userInfo["ocIdMov"] as? String, let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId), let metadataMov = NCManageDatabase.shared.getMetadataFromOcId(ocIdMov) {
                 
-                NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMov: metadataMov, progressView: self.progressView)
+                NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMov: metadataMov, progressView: self.progressView, viewActivity: nil)
             }
         }
     }