Browse Source

improvements

marinofaggiana 4 years ago
parent
commit
a3b7131fd4

+ 1 - 1
Share/ShareViewController.m

@@ -256,7 +256,7 @@
 {
     if ([self.filesName count] > 0) {
     
-        [[NCUtility shared] startActivityIndicatorWithView:nil bottom:0];
+        [[NCUtility shared] startActivityIndicatorWithBackgroundView:nil bottom:0];
         
         NSString *fileName = [self.filesName objectAtIndex:0];
         NSString *fileNameLocal = [NSTemporaryDirectory() stringByAppendingString:fileName];

+ 2 - 2
iOSClient/Activity/NCActivity.swift

@@ -387,7 +387,7 @@ extension activityTableViewCell: UICollectionViewDelegate {
             
             let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(activitySubjectRich.id, fileNameView: activitySubjectRich.name)!
             
-            NCUtility.shared.startActivityIndicator(view: (appDelegate.window?.rootViewController?.view)!)
+            NCUtility.shared.startActivityIndicator(backgroundView: (appDelegate.window?.rootViewController?.view)!)
             
             NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { (_) in
                 
@@ -574,7 +574,7 @@ extension NCActivity {
         canFetchActivity = false
         
         if idActivity > 0 {
-            NCUtility.shared.startActivityIndicator(view: self.view, bottom: 50)
+            NCUtility.shared.startActivityIndicator(backgroundView: self.view, bottom: 50)
         }
         
         NCCommunication.shared.getActivity(since: idActivity, limit: 200, objectId: filterFileId, objectType: objectType, previews: true) { (account, activities, errorCode, errorDescription) in

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

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

+ 1 - 1
iOSClient/Main/NCFunctionCenter.swift

@@ -284,7 +284,7 @@ import NCCommunication
         let fileNameMov = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadataMov.ocId, fileNameView: metadataMov.fileNameView)!)
         
         if let view = viewActivity {
-            NCUtility.shared.startActivityIndicator(view: view)
+            NCUtility.shared.startActivityIndicator(backgroundView: view)
         }
         
         NCLivePhoto.generate(from: fileNameImage, videoURL: fileNameMov, progress: { progress in

+ 1 - 1
iOSClient/Media/NCMedia.swift

@@ -548,7 +548,7 @@ extension NCMedia {
         }
         
         let height = self.tabBarController?.tabBar.frame.size.height ?? 0
-        NCUtility.shared.startActivityIndicator(view: self.view, bottom: height + 50)
+        NCUtility.shared.startActivityIndicator(backgroundView: self.view, bottom: height + 50)
 
         NCCommunication.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), timeout: 120) { (account, files, errorCode, errorDescription) in
             

+ 1 - 1
iOSClient/Networking/NCAutoUpload.swift

@@ -137,7 +137,7 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
         NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: appDelegate.window?.rootViewController) { (hasPermission) in
             if hasPermission {
                 NCContentPresenter.shared.messageNotification("_attention_", description: "_create_full_upload_", delay: NCGlobal.shared.dismissAfterSecondLong, type: .info, errorCode: 0, forced: true)
-                NCUtility.shared.startActivityIndicator(view: nil)
+                NCUtility.shared.startActivityIndicator(backgroundView: nil)
                 self.uploadAssetsNewAndFull(viewController: viewController, selector: NCGlobal.shared.selectorUploadAutoUploadAll, log: log) { (items) in
                     NCUtility.shared.stopActivityIndicator()
                 }

+ 1 - 1
iOSClient/Networking/NCNetworking.swift

@@ -281,7 +281,7 @@ import Queuer
         NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: NCCommunicationCommon.shared.sessionIdentifierDownload, sessionError: "", sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusInDownload)
                     
         if activityIndicator {
-            NCUtility.shared.startActivityIndicator(view: nil)
+            NCUtility.shared.startActivityIndicator(backgroundView: nil)
         }
         
         NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { (request) in

+ 1 - 1
iOSClient/Notification/NCNotification.swift

@@ -286,7 +286,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
     
     func getNetwokingNotification() {
     
-        NCUtility.shared.startActivityIndicator(view: self.navigationController?.view)
+        NCUtility.shared.startActivityIndicator(backgroundView: self.navigationController?.view)
 
         NCCommunication.shared.getNotifications() { (account, notifications, errorCode, errorDescription) in
          

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

@@ -202,7 +202,7 @@ class NCRenameFile: UIViewController, UITextFieldDelegate {
 
     func renameMetadata(_ metadata: tableMetadata, fileNameNew: String) {
         
-        NCUtility.shared.startActivityIndicator(view: nil)
+        NCUtility.shared.startActivityIndicator(backgroundView: nil)
         
         NCNetworking.shared.renameMetadata(metadata, fileNameNew: fileNameNew, urlBase: metadata.urlBase, 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 }
         
-        NCUtility.shared.startActivityIndicator(view: viewController.view)
+        NCUtility.shared.startActivityIndicator(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 == "" {
                 
-                NCUtility.shared.startActivityIndicator(view: viewController.view)
+                NCUtility.shared.startActivityIndicator(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

+ 6 - 6
iOSClient/Share/NCShareNetworking.swift

@@ -42,7 +42,7 @@ class NCShareNetworking: NSObject {
     }
     
     func readShare() {
-        NCUtility.shared.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(backgroundView: view)
         let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase, account: metadata.account)!
         NCCommunication.shared.readShares(path: filenamePath) { (account, shares, errorCode, errorDescription) in
             NCUtility.shared.stopActivityIndicator()
@@ -57,7 +57,7 @@ class NCShareNetworking: NSObject {
     }
     
     func createShareLink(password: String?) {
-        NCUtility.shared.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(backgroundView: view)
         let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase, account: metadata.account)!
         NCCommunication.shared.createShareLink(path: filenamePath, password: password) { (account, share, errorCode, errorDescription) in
             NCUtility.shared.stopActivityIndicator()
@@ -72,7 +72,7 @@ class NCShareNetworking: NSObject {
     }
     
     func createShare(shareWith: String, shareType: Int, metadata: tableMetadata) {
-        NCUtility.shared.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(backgroundView: view)
         let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase, account: metadata.account)!
         var permission: Int = 1
         if metadata.directory { permission = NCGlobal.shared.permissionMaxFolderShare } else { permission = NCGlobal.shared.permissionMaxFileShare }
@@ -89,7 +89,7 @@ class NCShareNetworking: NSObject {
     }
     
     func unShare(idShare: Int) {
-        NCUtility.shared.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(backgroundView: view)
         NCCommunication.shared.deleteShare(idShare: idShare) { (account, errorCode, errorDescription) in
             NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 {
@@ -102,7 +102,7 @@ class NCShareNetworking: NSObject {
     }
     
     func updateShare(idShare: Int, password: String?, permission: Int, note: String?, expirationDate: String?, hideDownload: Bool) {
-        NCUtility.shared.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(backgroundView: view)
         NCCommunication.shared.updateShare(idShare: idShare, password: password, expireDate: expirationDate, permissions: permission, note: note, hideDownload: hideDownload) { (account, share, errorCode, errorDescription) in
             NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 && share != nil {
@@ -117,7 +117,7 @@ class NCShareNetworking: NSObject {
     }
     
     func getSharees(searchString: String) {
-        NCUtility.shared.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(backgroundView: view)
         NCCommunication.shared.searchSharees(search: searchString) { (account, sharees, errorCode, errorDescription) in
             NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 {

+ 3 - 3
iOSClient/Utility/NCUtility.swift

@@ -456,7 +456,7 @@ class NCUtility: NSObject {
     
     // MARK: -
 
-    @objc func startActivityIndicator(view: UIView?, bottom: CGFloat = 0) {
+    @objc func startActivityIndicator(backgroundView: UIView?, bottom: CGFloat = 0) {
         
         if viewBackgroundActivityIndicator != nil { return }
         
@@ -464,7 +464,7 @@ class NCUtility: NSObject {
         activityIndicator.hidesWhenStopped = true
         activityIndicator.translatesAutoresizingMaskIntoConstraints = false
 
-        if view == nil {
+        if backgroundView == nil {
             if let window = UIApplication.shared.keyWindow {
                 viewBackgroundActivityIndicator?.removeFromSuperview()
                 viewBackgroundActivityIndicator = NCViewActivityIndicator(frame: window.bounds)
@@ -472,7 +472,7 @@ class NCUtility: NSObject {
                 viewBackgroundActivityIndicator?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
             }
         } else {
-            viewBackgroundActivityIndicator = view
+            viewBackgroundActivityIndicator = backgroundView
         }
         
         guard let view = viewBackgroundActivityIndicator else { return }

+ 2 - 2
iOSClient/Viewer/NCViewer.swift

@@ -93,7 +93,7 @@ class NCViewer: NSObject {
                             customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
                         }
                         
-                        NCUtility.shared.startActivityIndicator(view: viewController.view)
+                        NCUtility.shared.startActivityIndicator(backgroundView: viewController.view)
                         NCCommunication.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, customUserAgent: customUserAgent) { (account, url, errorCode, errorMessage) in
                             
                             NCUtility.shared.stopActivityIndicator()
@@ -144,7 +144,7 @@ class NCViewer: NSObject {
                                 
                 if metadata.url == "" {
                     
-                    NCUtility.shared.startActivityIndicator(view: viewController.view)
+                    NCUtility.shared.startActivityIndicator(backgroundView: viewController.view)
                     NCCommunication.shared.createUrlRichdocuments(fileID: metadata.fileId) { (account, url, errorCode, errorDescription) in
                         
                         NCUtility.shared.stopActivityIndicator()

+ 1 - 1
iOSClient/Viewer/NCViewerProviderContextMenu.swift

@@ -150,7 +150,7 @@ class NCViewerProviderContextMenu: UIViewController  {
         if let userInfo = notification.userInfo as NSDictionary? {
             if let ocId = userInfo["ocId"] as? String {
                 if ocId == self.metadata?.ocId || ocId == self.metadataLivePhoto?.ocId {
-                    NCUtility.shared.startActivityIndicator(view: self.view)
+                    NCUtility.shared.startActivityIndicator(backgroundView: self.view)
                 }
             }
         }

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

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