Przeglądaj źródła

ActivityIndicator

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 lat temu
rodzic
commit
540b8488a2

+ 1 - 1
iOSClient/Activity/NCActivityTableViewCell.swift

@@ -145,7 +145,7 @@ extension NCActivityTableViewCell: UICollectionViewDelegate {
             let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(activitySubjectRich.id, fileNameView: activitySubjectRich.name)!
 
             if let backgroundView = appDelegate.window?.rootViewController?.view {
-                NCActivityIndicator.shared.start(backgroundView: backgroundView, blurEffect: true)
+                NCActivityIndicator.shared.start(backgroundView: backgroundView)
             }
 
             NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in

+ 2 - 2
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -417,7 +417,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
 
         } else {
 
-            NCActivityIndicator.shared.start(backgroundView: self.view, blurEffect: true)
+            NCActivityIndicator.shared.start(backgroundView: self.view)
 
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                 self.dismissAndUpload(metadataForUpload)
@@ -429,7 +429,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
 
         if metadatas != nil && metadatas!.count > 0 {
 
-            NCActivityIndicator.shared.start(backgroundView: self.view, blurEffect: true)
+            NCActivityIndicator.shared.start(backgroundView: self.view)
 
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                 self.dismissAndUpload(metadatas![0])

+ 1 - 1
iOSClient/Networking/NCAutoUpload.swift

@@ -62,7 +62,7 @@ class NCAutoUpload: NSObject {
             guard hasPermission else { return }
 
             NCContentPresenter.shared.messageNotification("_attention_", description: "_create_full_upload_", delay: NCGlobal.shared.dismissAfterSecondLong, type: .info, errorCode: NCGlobal.shared.errorNoError, priority: .max)
-            NCActivityIndicator.shared.start(blurEffect: true)
+            NCActivityIndicator.shared.start()
             self.uploadAssetsNewAndFull(viewController: viewController, selector: NCGlobal.shared.selectorUploadAutoUploadAll, log: log) { _ in
                 NCActivityIndicator.shared.stop()
             }

+ 0 - 4
iOSClient/Notification/NCNotification.swift

@@ -272,8 +272,6 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
 
     func getNetwokingNotification() {
 
-        NCActivityIndicator.shared.start(backgroundView: self.navigationController?.view, blurEffect: true)
-
         NCCommunication.shared.getNotifications { account, notifications, errorCode, _ in
 
             if errorCode == 0 && account == self.appDelegate.account {
@@ -290,8 +288,6 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
 
                 self.reloadDatasource()
             }
-
-            NCActivityIndicator.shared.stop()
         }
     }
 }

+ 1 - 1
iOSClient/Rename file/NCRenameFile.swift

@@ -231,7 +231,7 @@ class NCRenameFile: UIViewController, UITextFieldDelegate {
 
     func renameMetadata(_ metadata: tableMetadata, fileNameNew: String) {
 
-        NCActivityIndicator.shared.start(blurEffect: true)
+        NCActivityIndicator.shared.start()
 
         NCNetworking.shared.renameMetadata(metadata, fileNameNew: fileNameNew, viewController: self) { errorCode, errorDescription in
 

+ 2 - 2
iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift

@@ -37,7 +37,7 @@ import NCCommunication
 
         guard let directEditingCreator = NCManageDatabase.shared.getDirectEditingCreators(predicate: NSPredicate(format: "account == %@ AND editor == 'text'", appDelegate.account))?.first else { return }
 
-        NCActivityIndicator.shared.start(backgroundView: viewController.view, blurEffect: true)
+        NCActivityIndicator.shared.start(backgroundView: viewController.view)
 
         let fileNamePath = CCUtility.returnFileNamePath(fromFileName: NCGlobal.shared.fileNameRichWorkspace, serverUrl: serverUrl, urlBase: appDelegate.urlBase, account: appDelegate.account)!
         NCCommunication.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier, templateId: "") { account, url, errorCode, errorMessage in
@@ -72,7 +72,7 @@ import NCCommunication
 
             if metadata.url == "" {
 
-                NCActivityIndicator.shared.start(backgroundView: viewController.view, blurEffect: true)
+                NCActivityIndicator.shared.start(backgroundView: viewController.view)
 
                 let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: appDelegate.urlBase, account: appDelegate.account)!
                 NCCommunication.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text") { account, url, errorCode, errorMessage in

+ 1 - 1
iOSClient/Settings/CCAdvanced.m

@@ -416,7 +416,7 @@
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"_want_delete_cache_", nil) preferredStyle:UIAlertControllerStyleActionSheet];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_yes_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-        [[NCActivityIndicator shared] startActivityWithBackgroundView:nil blurEffect:true style: UIActivityIndicatorViewStyleWhiteLarge];
+        [[NCActivityIndicator shared] startActivityWithBackgroundView:nil style: UIActivityIndicatorViewStyleWhiteLarge];
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
             [self clearCache];
         });

+ 5 - 5
iOSClient/Utility/NCActivityIndicator.swift

@@ -34,11 +34,11 @@ class NCActivityIndicator: NSObject {
     private var viewActivityIndicator: UIView?
     private var viewBackgroundActivityIndicator: UIView?
 
-    @objc func startActivity(backgroundView: UIView?, blurEffect: Bool, style: UIActivityIndicatorView.Style) {
-        start(backgroundView: backgroundView, blurEffect: blurEffect, style: style)
+    @objc func startActivity(backgroundView: UIView?, style: UIActivityIndicatorView.Style) {
+        start(backgroundView: backgroundView, style: style)
     }
 
-    func start(backgroundView: UIView? = nil, blurEffect: Bool = false, bottom: CGFloat? = nil, top: CGFloat? = nil, style: UIActivityIndicatorView.Style = .whiteLarge) {
+    func start(backgroundView: UIView? = nil, bottom: CGFloat? = nil, top: CGFloat? = nil, style: UIActivityIndicatorView.Style = .whiteLarge) {
 
         if self.activityIndicator != nil { stop() }
 
@@ -52,7 +52,7 @@ class NCActivityIndicator: NSObject {
             activityIndicator.translatesAutoresizingMaskIntoConstraints = false
 
             var sizeActivityIndicator = activityIndicator.frame.height
-            if blurEffect {
+            if backgroundView == nil {
                 sizeActivityIndicator += 50
             }
 
@@ -83,7 +83,7 @@ class NCActivityIndicator: NSObject {
             guard let viewActivityIndicator = self.viewActivityIndicator else { return }
             viewActivityIndicator.addSubview(activityIndicator)
 
-            if blurEffect {
+            if backgroundView == nil {
                 let blurEffect = UIBlurEffect(style: .regular)
                 let blurEffectView = UIVisualEffectView(effect: blurEffect)
                 blurEffectView.frame = viewActivityIndicator.frame

+ 2 - 2
iOSClient/Viewer/NCViewer.swift

@@ -101,7 +101,7 @@ class NCViewer: NSObject {
 
                 if metadata.url == "" {
 
-                    NCActivityIndicator.shared.start(backgroundView: viewController.view, blurEffect: true)
+                    NCActivityIndicator.shared.start(backgroundView: viewController.view)
                     NCCommunication.shared.createUrlRichdocuments(fileID: metadata.fileId) { account, url, errorCode, errorDescription in
 
                         NCActivityIndicator.shared.stop()
@@ -166,7 +166,7 @@ class NCViewer: NSObject {
                             customUserAgent = NCUtility.shared.getCustomUserAgentNCText()
                         }
 
-                        NCActivityIndicator.shared.start(backgroundView: viewController.view, blurEffect: true)
+                        NCActivityIndicator.shared.start(backgroundView: viewController.view)
                         NCCommunication.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, customUserAgent: customUserAgent) { account, url, errorCode, errorMessage in
 
                             NCActivityIndicator.shared.stop()

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

@@ -276,7 +276,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
               fileName == self.metadata.fileName
         else { return }
 
-        NCActivityIndicator.shared.start(blurEffect: true)
+        NCActivityIndicator.shared.start()
     }
 
     @objc func uploadedFile(_ notification: NSNotification) {

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

@@ -192,7 +192,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
                         guard let url = URL(string: urlString) else { return }
                         let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + metadata.fileNameWithoutExt
 
-                        NCActivityIndicator.shared.start(backgroundView: view, blurEffect: true)
+                        NCActivityIndicator.shared.start(backgroundView: view)
 
                         NCCommunication.shared.download(serverUrlFileName: url, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in