Преглед изворни кода

Added new HUD in pastePasteboard

Signed-off-by: marinofaggiana <marino@marinofaggiana.com>
marinofaggiana пре 3 година
родитељ
комит
51ef7c78f1
2 измењених фајлова са 17 додато и 12 уклоњено
  1. 14 9
      iOSClient/Main/NCFunctionCenter.swift
  2. 3 3
      iOSClient/Settings/Acknowledgements.rtf

+ 14 - 9
iOSClient/Main/NCFunctionCenter.swift

@@ -363,6 +363,7 @@ import IHProgressHUD
         let fileNameMov = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadataMov.ocId, fileNameView: metadataMov.fileNameView)!)
         
         IHProgressHUD.set(defaultMaskType: .clear)
+        IHProgressHUD.set(minimumDismiss: 2)
         
         NCLivePhoto.generate(from: fileNameImage, videoURL: fileNameMov, progress: { progress in
                 
@@ -373,16 +374,13 @@ import IHProgressHUD
             if resources != nil {
                 NCLivePhoto.saveToLibrary(resources!) { (result) in
                     if !result {
-                        NCContentPresenter.shared.messageNotification("_error_", description: "_livephoto_save_error_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError)
-                        IHProgressHUD.dismiss()
+                        IHProgressHUD.showError(withStatus: NSLocalizedString("_livephoto_save_error_", comment: ""))
                     } else {
                         IHProgressHUD.showSuccesswithStatus(NSLocalizedString("_success_", comment: ""))
-                        IHProgressHUD.dismissWithDelay(0.5)
                     }
                 }
             } else {
-                NCContentPresenter.shared.messageNotification("_error_", description: "_livephoto_save_error_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError)
-                IHProgressHUD.dismiss()
+                IHProgressHUD.showError(withStatus: NSLocalizedString("_livephoto_save_error_", comment: ""))
             }
         })
     }
@@ -460,17 +458,24 @@ import IHProgressHUD
                 let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocIdUpload, fileNameView: fileName)!
                 try data.write(to: URL(fileURLWithPath: fileNameLocalPath))
                
-                NCUtility.shared.startActivityIndicator(backgroundView: nil, blurEffect: true)
-                NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath) { account, ocId, etag, date, size, allHeaderFields, errorCode, errorDescription in
+                IHProgressHUD.set(defaultMaskType: .clear)
+                IHProgressHUD.set(minimumDismiss: 2)
+
+                NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath) { task in
+                } progressHandler: { progress in
+                    
+                    IHProgressHUD.show(progress: CGFloat(progress.fractionCompleted), status: fileName)
+                    
+                } completionHandler: { account, ocId, etag, date, size, allHeaderFields, errorCode, errorDescription in
                     if errorCode == 0 && etag != nil && ocId != nil {
                         let toPath = CCUtility.getDirectoryProviderStorageOcId(ocId!, fileNameView: fileName)!
                         NCUtilityFileSystem.shared.moveFile(atPath: fileNameLocalPath, toPath: toPath)
                         NCManageDatabase.shared.addLocalFile(account: account, etag: etag!, ocId: ocId!, fileName: fileName)
                         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": serverUrl])
+                        IHProgressHUD.showSuccesswithStatus(NSLocalizedString("_success_", comment: ""))
                     } else {
-                        NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, forced: false)
+                        IHProgressHUD.showError(withStatus: NSLocalizedString(errorDescription, comment: ""))
                     }
-                    NCUtility.shared.stopActivityIndicator()
                 }
             } catch {
                 return false

+ 3 - 3
iOSClient/Settings/Acknowledgements.rtf

@@ -1,4 +1,4 @@
-{\rtf1\ansi\ansicpg1252\cocoartf2578
+{\rtf1\ansi\ansicpg1252\cocoartf2580
 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;}
 {\colortbl;\red255\green255\blue255;}
 {\*\expandedcolortbl;;}
@@ -199,11 +199,11 @@ Copyright (c)  Tim Oliver\
 ____________________________________________\
 \
 
-\f1\b ChromaColorPicker
+\f1\b IHProgressHUD
 \f0\b0 \
 \
 MIT License\
 \
-Copyright (c)  Jonathan Cardasis\
+Copyright (c)  Md Ibrahim Hassan\
 ____________________________________________\
 }