Browse Source

Improveds

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 3 years ago
parent
commit
05d9f42d50
2 changed files with 8 additions and 7 deletions
  1. 1 1
      Share/NCShareExtension+NCDelegate.swift
  2. 7 6
      Share/NCShareExtension.swift

+ 1 - 1
Share/NCShareExtension+NCDelegate.swift

@@ -154,6 +154,6 @@ extension NCShareExtension: NCCreateFormUploadConflictDelegate {
         }
 
         self.uploadMetadata.append(contentsOf: metadatas)
-        self.upload()
+        self.upload(withHUD: true)
     }
 }

+ 7 - 6
Share/NCShareExtension.swift

@@ -139,7 +139,6 @@ class NCShareExtension: UIViewController {
         // HUD
         IHProgressHUD.set(viewForExtension: self.collectionView)
         IHProgressHUD.set(defaultMaskType: .clear)
-        IHProgressHUD.set(minimumDismiss: 0)
 
         NotificationCenter.default.addObserver(self, selector: #selector(triggerProgressTask(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterProgressTask), object: nil)
     }
@@ -362,11 +361,11 @@ extension NCShareExtension {
             conflict.delegate = self
             self.present(conflict, animated: true, completion: nil)
         } else {
-            upload()
+            upload(withHUD: true)
         }
     }
 
-    func upload() {
+    func upload(withHUD hud: Bool = false) {
         guard uploadStarted else { return }
         guard uploadMetadata.count > counterUploaded else { return finishedUploading() }
         let metadata = uploadMetadata[counterUploaded]
@@ -376,9 +375,11 @@ extension NCShareExtension {
 
         // CHUNCK
         metadata.chunk = chunckSize != 0 && metadata.size > chunckSize
-
-        let status = NSLocalizedString("_upload_file_", comment: "") + " \(counterUploaded + 1) " + NSLocalizedString("_of_", comment: "") + " \(filesName.count)"
-        IHProgressHUD.show(progress: 0, status: status)
+        
+        if hud {
+            let status = NSLocalizedString("_upload_file_", comment: "") + " \(counterUploaded + 1) " + NSLocalizedString("_of_", comment: "") + " \(filesName.count)"
+            IHProgressHUD.show(withStatus: status)
+        }
         
         NCNetworking.shared.upload(metadata: metadata) { } completion: { errorCode, _ in
             if errorCode == 0 {