Browse Source

normalized

marinofaggiana 4 years ago
parent
commit
d0a0a8a896
44 changed files with 179 additions and 183 deletions
  1. 3 3
      File Provider Extension/FileProviderData.swift
  2. 1 1
      File Provider Extension/FileProviderExtension+Actions.swift
  3. 1 1
      File Provider Extension/FileProviderExtension.swift
  4. 2 0
      Nextcloud.xcodeproj/project.pbxproj
  5. 1 1
      Share/NCSelectDestination.m
  6. 3 3
      Share/ShareViewController.m
  7. 8 8
      iOSClient/Activity/NCActivity.swift
  8. 1 2
      iOSClient/AppDelegate.h
  9. 7 6
      iOSClient/AppDelegate.m
  10. 1 1
      iOSClient/AudioRecorder/NCAudioRecorderViewController.swift
  11. 0 4
      iOSClient/CCGlobal.h
  12. 5 11
      iOSClient/Database/NCManageDatabase.swift
  13. 5 5
      iOSClient/Favorites/CCFavorites.m
  14. 3 2
      iOSClient/Login/CCLogin.m
  15. 1 1
      iOSClient/Login/NCAppConfigView.swift
  16. 7 7
      iOSClient/Login/NCLoginWeb.swift
  17. 14 14
      iOSClient/Main/CCMain.m
  18. 2 2
      iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift
  19. 3 3
      iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift
  20. 6 6
      iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift
  21. 12 12
      iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift
  22. 5 5
      iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift
  23. 6 6
      iOSClient/Main/NCDetailViewController.swift
  24. 7 7
      iOSClient/Main/NCMainCommon.swift
  25. 3 3
      iOSClient/Media/NCMedia.swift
  26. 5 5
      iOSClient/Networking/NCNetworking.swift
  27. 1 1
      iOSClient/Networking/NCNetworkingAutoUpload.swift
  28. 2 2
      iOSClient/Networking/NCNetworkingE2EE.swift
  29. 1 1
      iOSClient/Networking/NCNetworkingNotificationCenter.swift
  30. 3 3
      iOSClient/Notification/NCNotification.swift
  31. 5 5
      iOSClient/Offline/NCOffline.swift
  32. 4 4
      iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift
  33. 5 5
      iOSClient/Select/NCSelect.swift
  34. 1 1
      iOSClient/Settings/CCManageAutoUpload.m
  35. 12 12
      iOSClient/Share/NCShareNetworking.swift
  36. 2 2
      iOSClient/Shares/NCShares.m
  37. 7 7
      iOSClient/Trash/NCTrash.swift
  38. 2 2
      iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.m
  39. 0 1
      iOSClient/Utility/CCUtility.h
  40. 3 11
      iOSClient/Utility/CCUtility.m
  41. 13 1
      iOSClient/Utility/NCUtility.swift
  42. 1 1
      iOSClient/Viewer/NCViewerImage/NCViewerImageCommon.swift
  43. 2 2
      iOSClient/Viewer/NCViewerNextcloudText.swift
  44. 3 3
      iOSClient/Viewer/NCViewerRichdocument.swift

+ 3 - 3
File Provider Extension/FileProviderData.swift

@@ -82,7 +82,7 @@ class fileProviderData: NSObject {
             accountUserID = tableAccount.userID
             accountPassword = CCUtility.getPassword(tableAccount.account)
             accountUrlBase = tableAccount.urlBase
-            homeServerUrl = CCUtility.getHomeServer(tableAccount.urlBase)
+            homeServerUrl = NCUtility.shared.getHomeServer(tableAccount.urlBase)
                         
             NCCommunicationCommon.shared.setup(account: account, user: accountUser, userId: accountUserID, password: accountPassword, urlBase: accountUrlBase, userAgent: CCUtility.getUserAgent(), capabilitiesGroup: NCBrandOptions.sharedInstance.capabilitiesGroups, webDavRoot: webDavRoot, davRoot: nil, nextcloudVersion: serverVersionMajor, delegate: NCNetworking.shared)
             NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate
@@ -108,7 +108,7 @@ class fileProviderData: NSObject {
                 guard let password = CCUtility.getPassword(tableAccount.account) else { return false }
                 accountPassword = password
                 accountUrlBase = tableAccount.urlBase
-                homeServerUrl = CCUtility.getHomeServer(tableAccount.urlBase)
+                homeServerUrl = NCUtility.shared.getHomeServer(tableAccount.urlBase)
                 
                 NCCommunicationCommon.shared.setup(account: account, user: accountUser, userId: accountUserID, password: accountPassword, urlBase: accountUrlBase, userAgent: CCUtility.getUserAgent(), capabilitiesGroup: NCBrandOptions.sharedInstance.capabilitiesGroups, webDavRoot: webDavRoot, davRoot: nil, nextcloudVersion: serverVersionMajor, delegate: NCNetworking.shared)
                 NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate
@@ -140,7 +140,7 @@ class fileProviderData: NSObject {
                 accountUserID = tableAccount.userID
                 accountPassword = CCUtility.getPassword(tableAccount.account)
                 accountUrlBase = tableAccount.urlBase
-                homeServerUrl = CCUtility.getHomeServer(tableAccount.urlBase)
+                homeServerUrl = NCUtility.shared.getHomeServer(tableAccount.urlBase)
                 
                 NCCommunicationCommon.shared.setup(account: account, user: accountUser, userId: accountUserID, password: accountPassword, urlBase: accountUrlBase, userAgent: CCUtility.getUserAgent(), capabilitiesGroup: NCBrandOptions.sharedInstance.capabilitiesGroups, webDavRoot: webDavRoot, davRoot: nil, nextcloudVersion: serverVersionMajor, delegate: NCNetworking.shared)
                 NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate

+ 1 - 1
File Provider Extension/FileProviderExtension+Actions.swift

@@ -33,7 +33,7 @@ extension FileProviderExtension {
             return
         }
         
-        let directoryName = NCUtility.sharedInstance.createFileName(directoryName, serverUrl: tableDirectory.serverUrl, account: fileProviderData.sharedInstance.account)
+        let directoryName = NCUtility.shared.createFileName(directoryName, serverUrl: tableDirectory.serverUrl, account: fileProviderData.sharedInstance.account)
         let serverUrlFileName = tableDirectory.serverUrl + "/" + directoryName
         
         NCCommunication.shared.createFolder(serverUrlFileName) { (account, ocId, date, errorCode, errorDescription) in

+ 1 - 1
File Provider Extension/FileProviderExtension.swift

@@ -357,7 +357,7 @@ class FileProviderExtension: NSFileProviderExtension {
                     return
                 }
         
-                let fileName = NCUtility.sharedInstance.createFileName(fileURL.lastPathComponent, serverUrl: tableDirectory.serverUrl, account: fileProviderData.sharedInstance.account)
+                let fileName = NCUtility.shared.createFileName(fileURL.lastPathComponent, serverUrl: tableDirectory.serverUrl, account: fileProviderData.sharedInstance.account)
                 let ocIdTemp = NSUUID().uuidString.lowercased()
                 
                 NSFileCoordinator().coordinate(readingItemAt: fileURL, options: .withoutChanges, error: &error) { (url) in

+ 2 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -202,6 +202,7 @@
 		F78071091EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F78295311F962EFA00A572F5 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
+		F782FDC424E6933900666099 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; };
 		F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */ = {isa = PBXBuildFile; fileRef = F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */; };
 		F785EE9E2461A09900B3F945 /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; };
 		F785EEA32461A23C00B3F945 /* CCExifGeo.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A54C351C6267B500E2C8BF /* CCExifGeo.m */; };
@@ -1917,6 +1918,7 @@
 				F73D5E4A246DE09200DF6467 /* NCElementsJSON.swift in Sources */,
 				F74AF3A7247FB6AE00AC767B /* NCUtilityFileSystem.swift in Sources */,
 				2CB7D1CA23E2EDCB00376EF9 /* NCPushNotificationEncryption.m in Sources */,
+				F782FDC424E6933900666099 /* NCUtility.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 1 - 1
Share/NCSelectDestination.m

@@ -69,7 +69,7 @@
     
     if (![_serverUrl length]) {
                 
-        _serverUrl = [CCUtility getHomeServer:urlBase];
+        _serverUrl = [[NCUtility shared] getHomeServer:urlBase];
         
         [self.navigationController.navigationBar.topItem setTitleView:[[UIImageView alloc] initWithImage: [UIImage imageNamed:@"themingLogo"]]];
         self.title = @"Home";

+ 3 - 3
Share/ShareViewController.m

@@ -84,7 +84,7 @@
             
             [CCUtility setAccountExt:self.account];
 
-            _serverUrl  = [CCUtility getHomeServer:tableAccount.urlBase];
+            _serverUrl  = [[NCUtility shared] getHomeServer:tableAccount.urlBase];
             [CCUtility setServerUrlExt:_serverUrl];
 
             _destinyFolderButton.title = [NSString stringWithFormat:NSLocalizedString(@"_destiny_folder_", nil), NSLocalizedString(@"_home_", nil)];
@@ -269,7 +269,7 @@
         
         // <--
         
-        NSString *fileNameForUpload = [[NCUtility sharedInstance] createFileName:fileName serverUrl:self.serverUrl account:self.account];
+        NSString *fileNameForUpload = [[NCUtility shared] createFileName:fileName serverUrl:self.serverUrl account:self.account];
         NSString *fileNameServer = [NSString stringWithFormat:@"%@/%@", self.serverUrl, fileNameForUpload];
         
         [[NCCommunication shared] uploadWithServerUrlFileName:fileNameServer fileNameLocalPath:fileNameLocal dateCreationFile:nil dateModificationFile:nil customUserAgent:nil addCustomHeaders:nil progressHandler:^(NSProgress * progress) {
@@ -406,7 +406,7 @@
     else if (UTTypeConformsTo(fileUTI, kUTTypeImage)) {
         image = [UIImage imageWithContentsOfFile:[NSTemporaryDirectory() stringByAppendingString:fileName]];
         if (image) {
-            image = [NCUtility.sharedInstance resizeImageWithImage:image toHeight:cell.frame.size.width];
+            image = [NCUtility.shared resizeImageWithImage:image toHeight:cell.frame.size.width];
         } else {
             image = [UIImage imageNamed:@"file_photo"];
         }

+ 8 - 8
iOSClient/Activity/NCActivity.swift

@@ -393,11 +393,11 @@ extension activityTableViewCell: UICollectionViewDelegate {
             var pathComponents = activityPreview.link.components(separatedBy: "?")
             pathComponents = pathComponents[1].components(separatedBy: "&")
             var serverUrlFileName = pathComponents[0].replacingOccurrences(of: "dir=", with: "").removingPercentEncoding!
-            serverUrlFileName = appDelegate.urlBase + k_webDAV + serverUrlFileName + "/" + activitySubjectRich.name
+            serverUrlFileName = appDelegate.urlBase + NCUtility.shared.getWebDAV() + serverUrlFileName + "/" + activitySubjectRich.name
             
             let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(activitySubjectRich.id, fileNameView: activitySubjectRich.name)!
             
-            NCUtility.sharedInstance.startActivityIndicator(view: (appDelegate.window.rootViewController?.view)!)
+            NCUtility.shared.startActivityIndicator(view: (appDelegate.window.rootViewController?.view)!)
             
             NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { (_) in
                 
@@ -413,7 +413,7 @@ extension activityTableViewCell: UICollectionViewDelegate {
                     
                     NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, account: activityPreview.account) { (account, metadata, errorCode, errorDescription) in
                         
-                        NCUtility.sharedInstance.stopActivityIndicator()
+                        NCUtility.shared.stopActivityIndicator()
                         
                         if account == self.appDelegate.account && errorCode == 0  {
                             
@@ -430,7 +430,7 @@ extension activityTableViewCell: UICollectionViewDelegate {
                     
                 } else {
                     
-                    NCUtility.sharedInstance.stopActivityIndicator()
+                    NCUtility.shared.stopActivityIndicator()
                 }
             }
         }
@@ -461,7 +461,7 @@ extension activityTableViewCell: UICollectionViewDataSource {
                 
                 let source = activityPreview.source
                 
-                NCUtility.sharedInstance.convertSVGtoPNGWriteToUserData(svgUrlString: source, fileName: nil, width: 100, rewrite: false, account: appDelegate.account) { (imageNamePath) in
+                NCUtility.shared.convertSVGtoPNGWriteToUserData(svgUrlString: source, fileName: nil, width: 100, rewrite: false, account: appDelegate.account) { (imageNamePath) in
                     if imageNamePath != nil {
                         if let image = UIImage(contentsOfFile: imageNamePath!) {
                             cell.imageView.image = image
@@ -477,7 +477,7 @@ extension activityTableViewCell: UICollectionViewDataSource {
                     
                     let source = activityPreview.source
                     
-                    NCUtility.sharedInstance.convertSVGtoPNGWriteToUserData(svgUrlString: source, fileName: nil, width: 100, rewrite: false, account: appDelegate.account) { (imageNamePath) in
+                    NCUtility.shared.convertSVGtoPNGWriteToUserData(svgUrlString: source, fileName: nil, width: 100, rewrite: false, account: appDelegate.account) { (imageNamePath) in
                         if imageNamePath != nil {
                             if let image = UIImage(contentsOfFile: imageNamePath!) {
                                 cell.imageView.image = image
@@ -583,7 +583,7 @@ extension NCActivity {
         canFetchActivity = false
         
         if idActivity > 0 {
-            NCUtility.sharedInstance.startActivityIndicator(view: self.view, bottom: 50)
+            NCUtility.shared.startActivityIndicator(view: self.view, bottom: 50)
         }
         
         NCCommunication.shared.getActivity(since: idActivity, limit: 200, objectId: filterFileId, objectType: objectType, previews: true) { (account, activities, errorCode, errorDescription) in
@@ -592,7 +592,7 @@ extension NCActivity {
                 NCManageDatabase.sharedInstance.addActivity(activities , account: account)
             }
             
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             
             if errorCode == 304 {
                 self.canFetchActivity = false

+ 1 - 2
iOSClient/AppDelegate.h

@@ -51,7 +51,7 @@
 // For LMMediaPlayerView
 @property (strong, nonatomic) UIWindow *window;
 
-// Paramente account
+// Parameter account
 @property (nonatomic, strong) NSString *account;
 @property (nonatomic, strong) NSString *urlBase;
 @property (nonatomic, strong) NSString *user;
@@ -133,7 +133,6 @@
 
 // Push Notification
 - (void)pushNotification;
-//- (void)unsubscribingNextcloudServerPushNotification:(NSString *)account url:(NSString *)url withSubscribing:(BOOL)subscribing;
 
 // Theming Color
 - (void)settingThemingColorBrand;

+ 7 - 6
iOSClient/AppDelegate.m

@@ -45,7 +45,7 @@
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
-    if ([[NCUtility sharedInstance] isSimulatorOrTestFlight]) {
+    if ([[NCUtility shared] isSimulatorOrTestFlight]) {
         NCBrandOptions.sharedInstance.disable_crash_service = false;
     }
     if (![CCUtility getDisableCrashservice] && NCBrandOptions.sharedInstance.disable_crash_service == false) {
@@ -119,7 +119,7 @@
     [self startTimerErrorNetworking];
 
     // Store review
-    if ([[NCUtility sharedInstance] isSimulatorOrTestFlight] == false) {
+    if ([[NCUtility shared] isSimulatorOrTestFlight] == false) {
         NCStoreReview *review = [NCStoreReview new];
         [review incrementAppRuns];
         [review showStoreReview];
@@ -849,7 +849,7 @@
 
 - (NSString *)getTabBarControllerActiveServerUrl
 {
-    NSString *serverUrl = [CCUtility getHomeServer:self.urlBase];
+    NSString *serverUrl = [[NCUtility shared] getHomeServer:self.urlBase];
 
     UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
     if ([splitViewController isKindOfClass:[UISplitViewController class]]) {
@@ -1112,20 +1112,21 @@
                                             
                                             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
                                                 
-                                                NSString *fileNamePath = [NSString stringWithFormat:@"%@%@/%@", matchedAccount.urlBase, k_webDAV, path];
+                                                NSString *webDAV = [[NCUtility shared] getWebDAV];
+                                                NSString *fileNamePath = [NSString stringWithFormat:@"%@%@/%@", matchedAccount.urlBase, webDAV, path];
                                                 
                                                 if ([path containsString:@"/"]) {
                                                     
                                                     // Push
                                                     NSString *fileName = [[path stringByDeletingLastPathComponent] lastPathComponent];
-                                                    NSString *serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@%@/%@", matchedAccount.urlBase, k_webDAV, [path stringByDeletingLastPathComponent]]];
+                                                    NSString *serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@%@/%@", matchedAccount.urlBase, webDAV, [path stringByDeletingLastPathComponent]]];
                                                     tableMetadata *metadata = [[NCManageDatabase sharedInstance] createMetadataWithAccount:matchedAccount.account fileName:fileName ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrl urlBase: @"" url:@"" contentType:@"" livePhoto:false];
                                                     [self.activeMain performSegueDirectoryWithMetadata:metadata blinkFileNamePath:fileNamePath];
                                                     
                                                 } else {
                                                     
                                                     // Reload folder
-                                                    NSString *serverUrl = [NSString stringWithFormat:@"%@%@", matchedAccount.urlBase, k_webDAV];
+                                                    NSString *serverUrl = [NSString stringWithFormat:@"%@%@", matchedAccount.urlBase, webDAV];
                                                     
                                                     self.activeMain.blinkFileNamePath = fileNamePath;
                                                     [self.activeMain readFolder:serverUrl];

+ 1 - 1
iOSClient/AudioRecorder/NCAudioRecorderViewController.swift

@@ -131,7 +131,7 @@ class NCAudioRecorderViewController: UIViewController , NCAudioRecorderDelegate
         voiceRecordHUD.update(CGFloat(rate))
         voiceRecordHUD.fillColor = UIColor.green
         recordDuration += 1
-        durationLabel.text = NCUtility.sharedInstance.formatSecondsToString(recordDuration/60)
+        durationLabel.text = NCUtility.shared.formatSecondsToString(recordDuration/60)
     }
 }
 

+ 0 - 4
iOSClient/CCGlobal.h

@@ -60,10 +60,6 @@
 // Server Status
 #define k_serverStatus                                  @"/status.php"
 
-// webDAV & DAV
-#define k_webDAV                                        @"/remote.php/webdav"
-#define k_dav                                           @"/remote.php/dav"
-
 // Login Flow
 #define k_flowEndpoint                                  @"/index.php/login/flow"
 

+ 5 - 11
iOSClient/Database/NCManageDatabase.swift

@@ -405,7 +405,7 @@ class NCManageDatabase: NSObject {
         if result.autoUploadDirectory.count > 0 {
             return result.autoUploadDirectory
         } else {
-            return CCUtility.getHomeServer(urlBase)
+            return NCUtility.shared.getHomeServer(urlBase)
         }
     }
 
@@ -422,23 +422,17 @@ class NCManageDatabase: NSObject {
     @objc func setAccountActive(_ account: String) -> tableAccount? {
         
         let realm = try! Realm()
-
-        var tAccount = tableAccount()
+        var accountReturn = tableAccount()
         
         do {
             try realm.write {
             
                 let results = realm.objects(tableAccount.self)
-
                 for result in results {
-                
                     if result.account == account {
-                    
                         result.active = true
-                        tAccount = result
-                    
+                        accountReturn = result
                     } else {
-                    
                         result.active = false
                     }
                 }
@@ -448,7 +442,7 @@ class NCManageDatabase: NSObject {
             return nil
         }
         
-        return tableAccount.init(value: tAccount)
+        return tableAccount.init(value: accountReturn)
     }
     
     @objc func removePasswordAccount(_ account: String) {
@@ -2462,7 +2456,7 @@ class NCManageDatabase: NSObject {
         for share in shares {
             
             let addObject = tableShare()
-            let fullPath = CCUtility.getHomeServer(urlBase) + share.path
+            let fullPath = NCUtility.shared.getHomeServer(urlBase) + share.path
             let serverUrl = CCUtility.deletingLastPathComponent(fromServerUrl: fullPath)!
             let fileName = NSString(string: fullPath).lastPathComponent
                         

+ 5 - 5
iOSClient/Favorites/CCFavorites.m

@@ -232,9 +232,9 @@
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_all_task_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-        [NCUtility.sharedInstance startActivityIndicatorWithView:self.view bottom:0];
+        [NCUtility.shared startActivityIndicatorWithView:self.view bottom:0];
         [[NCMainCommon sharedInstance] cancelAllTransfer];
-        [NCUtility.sharedInstance stopActivityIndicator];
+        [NCUtility.shared stopActivityIndicator];
     }]];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { }]];
@@ -269,7 +269,7 @@
         viewController.imageFile = cell.file.image;
         viewController.showOpenIn = true;
         viewController.showShare = false;
-        viewController.showOpenQuickLook = [[NCUtility sharedInstance] isQuickLookDisplayableWithMetadata:metadata];
+        viewController.showOpenQuickLook = [[NCUtility shared] isQuickLookDisplayableWithMetadata:metadata];
        
         return viewController;
     }
@@ -536,7 +536,7 @@
                         
                     [self shouldPerformSegue:self.metadata selector:@""];
                 
-                } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility sharedInstance] isDirectEditingWithAccount:self.metadata.account contentType:self.metadata.contentType] != nil) {
+                } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility shared] isDirectEditingWithAccount:self.metadata.account contentType:self.metadata.contentType] != nil) {
                         
                         if (NCCommunication.shared.isNetworkReachable) {
                             [self shouldPerformSegue:self.metadata selector:@""];
@@ -544,7 +544,7 @@
                             [[NCContentPresenter shared] messageNotification:@"_info_" description:@"_go_online_" delay:k_dismissAfterSecond type:messageTypeInfo errorCode:k_CCErrorInternalError forced:false];
                         }
                         
-                    } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility sharedInstance] isRichDocument:self.metadata]) {
+                    } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility shared] isRichDocument:self.metadata]) {
                         
                         if (NCCommunication.shared.isNetworkReachable) {
                             [self shouldPerformSegue:self.metadata selector:@""];

+ 3 - 2
iOSClient/Login/CCLogin.m

@@ -330,7 +330,8 @@
             self.login.enabled = NO;
             [self.activity startAnimating];
             
-            NSString *serverUrl = [NSString stringWithFormat:@"%@%@", url, k_webDAV];
+            NSString *webDAV = [[NCUtility shared] getWebDAV];
+            NSString *serverUrl = [NSString stringWithFormat:@"%@%@", url, webDAV];
             
             [[NCCommunication shared] checkServerWithServerUrl:serverUrl completionHandler:^(NSInteger errorCode, NSString *errorDescription) {
                 
@@ -390,7 +391,7 @@
         NSString *account = [NSString stringWithFormat:@"%@ %@", user, url];
         
         // NO account found, clear
-        if ([NCManageDatabase.sharedInstance getAccounts] == nil) { [NCUtility.sharedInstance removeAllSettings]; }
+        if ([NCManageDatabase.sharedInstance getAccounts] == nil) { [NCUtility.shared removeAllSettings]; }
         
         [[NCManageDatabase sharedInstance] deleteAccount:account];
         [[NCManageDatabase sharedInstance] addAccount:account urlBase:url user:user password:token];

+ 1 - 1
iOSClient/Login/NCAppConfigView.swift

@@ -79,7 +79,7 @@ class NCAppConfigView: UIViewController {
                     let account: String = "\(username) \(serverUrl)"
                     
                     // NO account found, clear
-                    if NCManageDatabase.sharedInstance.getAccounts() == nil { NCUtility.sharedInstance.removeAllSettings() }
+                    if NCManageDatabase.sharedInstance.getAccounts() == nil { NCUtility.shared.removeAllSettings() }
                     
                     // Add new account
                     NCManageDatabase.sharedInstance.deleteAccount(account)

+ 7 - 7
iOSClient/Login/NCLoginWeb.swift

@@ -208,29 +208,29 @@ extension NCLoginWeb: WKNavigationDelegate {
 
     func createAccount(server: String, username: String, password: String) {
         
-        var serverUrl = server
+        var urlBase = server
         
         // NO account found, clear all
-        if NCManageDatabase.sharedInstance.getAccounts() == nil { NCUtility.sharedInstance.removeAllSettings() }
+        if NCManageDatabase.sharedInstance.getAccounts() == nil { NCUtility.shared.removeAllSettings() }
             
         // Normalized
-        if (serverUrl.last == "/") {
-            serverUrl = String(serverUrl.dropLast())
+        if (urlBase.last == "/") {
+            urlBase = String(urlBase.dropLast())
         }
         
         // Create account
-        let account: String = "\(username) \(serverUrl)"
+        let account: String = "\(username) \(urlBase)"
 
         // Add new account
         NCManageDatabase.sharedInstance.deleteAccount(account)
-        NCManageDatabase.sharedInstance.addAccount(account, urlBase: serverUrl, user: username, password: password)
+        NCManageDatabase.sharedInstance.addAccount(account, urlBase: urlBase, user: username, password: password)
             
         guard let tableAccount = NCManageDatabase.sharedInstance.setAccountActive(account) else {
             self.dismiss(animated: true, completion: nil)
             return
         }
             
-        appDelegate.settingAccount(account, urlBase: serverUrl, user: username, userID: tableAccount.userID, password: password)
+        appDelegate.settingAccount(account, urlBase: urlBase, user: username, userID: tableAccount.userID, password: password)
             
         if (CCUtility.getIntro()) {
             

+ 14 - 14
iOSClient/Main/CCMain.m

@@ -239,7 +239,7 @@
 
     // Check server URL "/"
     if (self.navigationController.viewControllers.firstObject == self && self.serverUrl == nil) {
-        self.serverUrl = [CCUtility getHomeServer:appDelegate.urlBase];
+        self.serverUrl = [[NCUtility shared] getHomeServer:appDelegate.urlBase];
     }
     
     // RichWorkspace
@@ -378,7 +378,7 @@
         // This is Root home main add list
         appDelegate.homeMain = self;
         _isRoot = YES;
-        _serverUrl = [CCUtility getHomeServer:appDelegate.urlBase];
+        _serverUrl = [[NCUtility shared] getHomeServer:appDelegate.urlBase];
         [appDelegate.listMainVC setObject:self forKey:_serverUrl];
         
         // go Home
@@ -778,7 +778,7 @@
                     metadataForUpload.size = data.length;
                     metadataForUpload.status = k_metadataStatusWaitUpload;
                     
-                    if ([[NCUtility sharedInstance] getMetadataConflictWithAccount:appDelegate.account serverUrl:serverUrl fileName:fileName] != nil) {
+                    if ([[NCUtility shared] getMetadataConflictWithAccount:appDelegate.account serverUrl:serverUrl fileName:fileName] != nil) {
                        
                         NCCreateFormUploadConflict *conflict = [[UIStoryboard storyboardWithName:@"NCCreateFormUploadConflict" bundle:nil] instantiateInitialViewController];
                         conflict.serverUrl = self.serverUrl;
@@ -939,7 +939,7 @@
         viewController.imageFile = cell.file.image;
         viewController.showOpenIn = true;
         viewController.showShare = true;
-        viewController.showOpenQuickLook = [[NCUtility sharedInstance] isQuickLookDisplayableWithMetadata:metadata];
+        viewController.showOpenQuickLook = [[NCUtility shared] isQuickLookDisplayableWithMetadata:metadata];
         
         return viewController;
     }
@@ -1037,7 +1037,7 @@
         metadataForUpload.size = [[NCUtilityFileSystem shared] getFileSizeWithAsset:asset];
         metadataForUpload.status = k_metadataStatusWaitUpload;
                         
-        if ([[NCUtility sharedInstance] getMetadataConflictWithAccount:appDelegate.account serverUrl:serverUrl fileName:fileName] != nil) {
+        if ([[NCUtility shared] getMetadataConflictWithAccount:appDelegate.account serverUrl:serverUrl fileName:fileName] != nil) {
             [metadatasUploadInConflict addObject:metadataForUpload];
         } else {
             [metadatasNOConflict addObject:metadataForUpload];
@@ -1438,7 +1438,7 @@
     NSString *message;
     UIAlertController *alertController;
     
-    if ([serverUrl isEqualToString:[CCUtility getHomeServer:appDelegate.urlBase]]) {
+    if ([serverUrl isEqualToString:[[NCUtility shared] getHomeServer:appDelegate.urlBase]]) {
         message = @"/";
     } else {
         message = [serverUrl lastPathComponent];
@@ -1506,9 +1506,9 @@
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_all_task_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-        [NCUtility.sharedInstance startActivityIndicatorWithView:self.view bottom:0];
+        [NCUtility.shared startActivityIndicatorWithView:self.view bottom:0];
         [[NCMainCommon sharedInstance] cancelAllTransfer];
-        [NCUtility.sharedInstance stopActivityIndicator];
+        [NCUtility.shared stopActivityIndicator];
     }]];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { }]];
@@ -1623,7 +1623,7 @@
         if ([NCBrandOptions sharedInstance].disable_openin_file == false) {
             [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_open_in_", nil) action:@selector(openinTouchFile:)]];
         }
-        if ([[NCUtility sharedInstance] isQuickLookDisplayableWithMetadata:self.metadata]) {
+        if ([[NCUtility shared] isQuickLookDisplayableWithMetadata:self.metadata]) {
             [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_open_quicklook_", nil) action:@selector(openQuickLookTouch:)]];
         }
         [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_paste_file_", nil) action:@selector(pasteTouchFile:)]];
@@ -1835,7 +1835,7 @@
             
             if ([CCUtility fileProviderStorageExists:metadata.ocId fileNameView:metadata.fileNameView]) {
                 
-                NSString *fileName = [[NCUtility sharedInstance] createFileName:metadata.fileNameView serverUrl:self.serverUrl account:appDelegate.account];
+                NSString *fileName = [[NCUtility shared] createFileName:metadata.fileNameView serverUrl:self.serverUrl account:appDelegate.account];
                 NSString *ocId = [[NSUUID UUID] UUIDString];
                 
                 [CCUtility copyFileAtPath:[CCUtility getDirectoryProviderStorageOcId:metadata.ocId fileNameView:metadata.fileNameView] toPath:[CCUtility getDirectoryProviderStorageOcId:ocId fileNameView:fileName]];
@@ -2015,7 +2015,7 @@
     }
     
     // Get MetadataFolder
-    if ([serverUrl isEqualToString:[CCUtility getHomeServer:appDelegate.urlBase]])
+    if ([serverUrl isEqualToString:[[NCUtility shared] getHomeServer:appDelegate.urlBase]])
         _metadataFolder = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", appDelegate.account, k_serverUrl_root]];
     else
         _metadataFolder = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", appDelegate.account, serverUrl]];
@@ -2051,7 +2051,7 @@
                                 CCCellMain *cell = [self.tableView cellForRowAtIndexPath:indexPath];
                                 if (cell) {
                                     self.blinkFileNamePath = nil;
-                                    [[NCUtility sharedInstance] blinkWithCell:cell];
+                                    [[NCUtility shared] blinkWithCell:cell];
                                 }
                             });
                         }
@@ -2483,7 +2483,7 @@
                     
                     [self shouldPerformSegue:self.metadata selector:@""];
                     
-                } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility sharedInstance] isDirectEditingWithAccount:self.metadata.account contentType:self.metadata.contentType] != nil) {
+                } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility shared] isDirectEditingWithAccount:self.metadata.account contentType:self.metadata.contentType] != nil) {
                     
                     if (NCCommunication.shared.isNetworkReachable) {
                         [self shouldPerformSegue:self.metadata selector:@""];
@@ -2491,7 +2491,7 @@
                         [[NCContentPresenter shared] messageNotification:@"_info_" description:@"_go_online_" delay:k_dismissAfterSecond type:messageTypeInfo errorCode:k_CCErrorOffline forced:true];
                     }
                     
-                } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility sharedInstance] isRichDocument:self.metadata]) {
+                } else if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document] && [[NCUtility shared] isRichDocument:self.metadata]) {
                     
                     if (NCCommunication.shared.isNetworkReachable) {
                         [self shouldPerformSegue:self.metadata selector:@""];

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

@@ -45,7 +45,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
         
         self.init()
         
-        if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+        if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
             titleServerUrl = "/"
         } else {
             if let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, serverUrl)) {
@@ -306,7 +306,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
             
             self.serverUrl = serverUrl!
             
-            if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+            if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
                 self.titleServerUrl = "/"
             } else {
                 if let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account

+ 3 - 3
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -170,7 +170,7 @@ extension NCCreateFormUploadConflictDelegate {
             
                 let fileNameMOV = (metadata.fileNameView as NSString).deletingPathExtension + ".mov"
                 
-                let newFileName = NCUtility.sharedInstance.createFileName(metadata.fileNameView, serverUrl: metadata.serverUrl, account: metadata.account)
+                let newFileName = NCUtility.shared.createFileName(metadata.fileNameView, serverUrl: metadata.serverUrl, account: metadata.account)
                 metadata.ocId = UUID().uuidString
                 metadata.fileName = newFileName
                 metadata.fileNameView = newFileName
@@ -275,13 +275,13 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
 
             // -----> Already Existing File
             
-            guard let metadataAlreadyExists = NCUtility.sharedInstance.getMetadataConflict(account: metadataNewFile.account, serverUrl: metadataNewFile.serverUrl, fileName: metadataNewFile.fileNameView) else { return UITableViewCell() }
+            guard let metadataAlreadyExists = NCUtility.shared.getMetadataConflict(account: metadataNewFile.account, serverUrl: metadataNewFile.serverUrl, fileName: metadataNewFile.fileNameView) else { return UITableViewCell() }
             if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, etag: metadataAlreadyExists.etag)) {
                 cell.imageAlreadyExistingFile.image =  UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, etag: metadataAlreadyExists.etag))
             } else if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView)) && metadataAlreadyExists.contentType == "application/pdf" {
             
                 let url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView))
-                if let image = NCUtility.sharedInstance.pdfThumbnail(url: url) {
+                if let image = NCUtility.shared.pdfThumbnail(url: url) {
                     cell.imageAlreadyExistingFile.image = image
                 } else {
                     cell.imageAlreadyExistingFile.image = UIImage.init(named: metadataAlreadyExists.iconName)

+ 6 - 6
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -56,7 +56,7 @@ import NCCommunication
     override func viewDidLoad() {
         super.viewDidLoad()
         
-        if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+        if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
             fileNameFolder = "/"
         } else {
             fileNameFolder = (serverUrl as NSString).lastPathComponent
@@ -218,7 +218,7 @@ import NCCommunication
         }
         
         self.serverUrl = serverUrl
-        if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+        if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
             fileNameFolder = "/"
         } else {
             fileNameFolder = (serverUrl as NSString).lastPathComponent
@@ -268,11 +268,11 @@ import NCCommunication
         } else {
             
             let result = NCCommunicationCommon.shared.getInternalContenType(fileName: fileNameForm as! String, contentType: "", directory: false)
-            if NCUtility.sharedInstance.isDirectEditing(account: appDelegate.account, contentType: result.contentType) == nil {
+            if NCUtility.shared.isDirectEditing(account: appDelegate.account, contentType: result.contentType) == nil {
                 fileNameForm = (fileNameForm as! NSString).deletingPathExtension + "." + fileNameExtension
             }
             
-            if NCUtility.sharedInstance.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: String(describing: fileNameForm)) != nil {
+            if NCUtility.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: String(describing: fileNameForm)) != nil {
                 
                 let metadataForUpload = NCManageDatabase.sharedInstance.createMetadata(account: appDelegate.account, fileName: String(describing: fileNameForm), ocId: "", serverUrl: serverUrl, urlBase: appDelegate.urlBase, url: "", contentType: "", livePhoto: false)
                 
@@ -317,7 +317,7 @@ import NCCommunication
             var customUserAgent: String?
             
             if self.editorId == k_editor_onlyoffice {
-                customUserAgent = NCUtility.sharedInstance.getCustomUserAgentOnlyOffice()
+                customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
             }
             
             NCCommunication.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, customUserAgent: customUserAgent) { (account, url, errorCode, errorMessage) in
@@ -384,7 +384,7 @@ import NCCommunication
             var customUserAgent: String?
                        
             if self.editorId == k_editor_onlyoffice {
-                customUserAgent = NCUtility.sharedInstance.getCustomUserAgentOnlyOffice()
+                customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
             }
             
             NCCommunication.shared.NCTextGetListOfTemplates(customUserAgent: customUserAgent) { (account, templates, errorCode, errorMessage) in

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

@@ -49,7 +49,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
         
         self.init()
         
-        if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+        if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
             titleServerUrl = "/"
         } else {
             titleServerUrl = (serverUrl as NSString).lastPathComponent
@@ -378,7 +378,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
             CCUtility.setDirectoryScanDocuments(serverUrl!)
             self.serverUrl = serverUrl!
             
-            if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+            if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
                 self.titleServerUrl = "/"
             } else {
                 self.titleServerUrl = (serverUrl! as NSString).lastPathComponent
@@ -417,7 +417,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
         metadataForUpload.sessionSelector = selectorUploadFile
         metadataForUpload.status = Int(k_metadataStatusWaitUpload)
                 
-        if NCUtility.sharedInstance.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: fileNameSave) != nil {
+        if NCUtility.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: fileNameSave) != nil {
                         
             guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return }
             conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "")
@@ -429,7 +429,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
             
         } else {
                      
-            NCUtility.sharedInstance.startActivityIndicator(view: self.view)
+            NCUtility.shared.startActivityIndicator(view: self.view)
             
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                 self.dismissAndUpload(metadataForUpload)
@@ -441,7 +441,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
         
         if metadatas != nil && metadatas!.count > 0 {
                  
-            NCUtility.sharedInstance.startActivityIndicator(view: self.view)
+            NCUtility.shared.startActivityIndicator(view: self.view)
             
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                 self.dismissAndUpload(metadatas![0])
@@ -452,7 +452,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
     func dismissAndUpload(_ metadata: tableMetadata) {
         
         guard let fileNameGenerateExport = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView) else {
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: Int(k_CCErrorCreationFile), forced: true)
             return
         }
@@ -469,7 +469,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
                     
                     let request = VNRecognizeTextRequest { (request, error) in
                         guard let observations = request.results as? [VNRecognizedTextObservation] else {
-                            NCUtility.sharedInstance.stopActivityIndicator()
+                            NCUtility.shared.stopActivityIndicator()
                             return
                         }
                         for observation in observations {
@@ -491,7 +491,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
             do {
                 try textFile.write(to: NSURL(fileURLWithPath: fileNameGenerateExport) as URL  , atomically: true, encoding: .utf8)
             } catch {
-                NCUtility.sharedInstance.stopActivityIndicator()
+                NCUtility.shared.stopActivityIndicator()
                 NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: Int(k_CCErrorCreationFile), forced: true)
                 return
             }
@@ -528,7 +528,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
                         
                         let request = VNRecognizeTextRequest { (request, error) in
                             guard let observations = request.results as? [VNRecognizedTextObservation] else {
-                                NCUtility.sharedInstance.stopActivityIndicator()
+                                NCUtility.shared.stopActivityIndicator()
                                 return
                             }
                             for observation in observations {
@@ -580,7 +580,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
             let image =  changeImageFromQuality(self.arrayImages[0], dpiQuality: dpiQuality)
             
             guard let data = image.jpegData(compressionQuality: CGFloat(0.5)) else {
-                NCUtility.sharedInstance.stopActivityIndicator()
+                NCUtility.shared.stopActivityIndicator()
                 NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: Int(k_CCErrorCreationFile), forced: true)
                 return
             }
@@ -588,13 +588,13 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
             do {
                 try data.write(to: NSURL.fileURL(withPath: fileNameGenerateExport), options: .atomic)
             } catch {
-                NCUtility.sharedInstance.stopActivityIndicator()
+                NCUtility.shared.stopActivityIndicator()
                 NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: Int(k_CCErrorCreationFile), forced: true)
                 return
             }
         }
         
-        NCUtility.sharedInstance.stopActivityIndicator()
+        NCUtility.shared.stopActivityIndicator()
 
         NCManageDatabase.sharedInstance.addMetadata(metadata)
         

+ 5 - 5
iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift

@@ -45,7 +45,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
     
     public func setup(serverUrl: String, fileNamePath: String, fileName: String) {
     
-        if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+        if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
             titleServerUrl = "/"
         } else {
             titleServerUrl = (serverUrl as NSString).lastPathComponent
@@ -201,7 +201,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
             
             self.serverUrl = serverUrl!
             
-            if serverUrl == CCUtility.getHomeServer(appDelegate.urlBase) {
+            if serverUrl == NCUtility.shared.getHomeServer(appDelegate.urlBase) {
                 self.titleServerUrl = "/"
             } else {
                 self.titleServerUrl = (serverUrl! as NSString).lastPathComponent
@@ -235,7 +235,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
         metadataForUpload.sessionSelector = selectorUploadFile
         metadataForUpload.status = Int(k_metadataStatusWaitUpload)
         
-        if NCUtility.sharedInstance.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: fileNameSave) != nil {
+        if NCUtility.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: fileNameSave) != nil {
                         
             guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return }
             conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "")
@@ -302,8 +302,8 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
     //MARK: Player - Timer
 
     func updateTimerUI() {
-        labelTimer.text = NCUtility.sharedInstance.formatSecondsToString(counterSecondPlayer)
-        labelDuration.text = NCUtility.sharedInstance.formatSecondsToString(durationPlayer)
+        labelTimer.text = NCUtility.shared.formatSecondsToString(counterSecondPlayer)
+        labelDuration.text = NCUtility.shared.formatSecondsToString(durationPlayer)
         progressView.progress = Float(counterSecondPlayer / durationPlayer)
     }
     

+ 6 - 6
iOSClient/Main/NCDetailViewController.swift

@@ -481,12 +481,12 @@ class NCDetailViewController: UIViewController {
             }
             
             // DirectEditinf: Nextcloud Text - OnlyOffice
-            if NCUtility.sharedInstance.isDirectEditing(account: metadata.account, contentType: metadata.contentType) != nil &&  NCCommunication.shared.isNetworkReachable() {
+            if NCUtility.shared.isDirectEditing(account: metadata.account, contentType: metadata.contentType) != nil &&  NCCommunication.shared.isNetworkReachable() {
                 
-                guard let editor = NCUtility.sharedInstance.isDirectEditing(account: metadata.account, contentType: metadata.contentType) else { return }
+                guard let editor = NCUtility.shared.isDirectEditing(account: metadata.account, contentType: metadata.contentType) else { return }
                 if editor == k_editor_text || editor == k_editor_onlyoffice {
                     
-                    NCUtility.sharedInstance.startActivityIndicator(view: backgroundView)
+                    NCUtility.shared.startActivityIndicator(view: backgroundView)
 
                     if metadata.url == "" {
                         
@@ -494,7 +494,7 @@ class NCDetailViewController: UIViewController {
                         let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: appDelegate.urlBase)!
                         
                         if editor == k_editor_onlyoffice {
-                            customUserAgent = NCUtility.sharedInstance.getCustomUserAgentOnlyOffice()
+                            customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
                             self.navigationController?.navigationBar.topItem?.title = ""
                         }
                         
@@ -536,9 +536,9 @@ class NCDetailViewController: UIViewController {
             }
             
             // RichDocument: Collabora
-            if NCUtility.sharedInstance.isRichDocument(metadata) &&  NCCommunication.shared.isNetworkReachable() {
+            if NCUtility.shared.isRichDocument(metadata) &&  NCCommunication.shared.isNetworkReachable() {
                 
-                NCUtility.sharedInstance.startActivityIndicator(view: backgroundView)
+                NCUtility.shared.startActivityIndicator(view: backgroundView)
                 
                 if metadata.url == "" {
                     

+ 7 - 7
iOSClient/Main/NCMainCommon.swift

@@ -336,11 +336,11 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
                 if FileManager.default.fileExists(atPath: fileNameSourceAvatar) {
                     cell.shared.image = UIImage(contentsOfFile: fileNameSourceAvatar)
                 } else if FileManager.default.fileExists(atPath: fileNameSource) {
-                    cell.shared.image = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
+                    cell.shared.image = NCUtility.shared.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
                 } else {
                     NCCommunication.shared.downloadAvatar(userID: metadata.ownerId, fileNameLocalPath: fileNameSource, size: Int(k_avatar_size)) { (account, data, errorCode, errorMessage) in
                         if errorCode == 0 && account == appDelegate.account {
-                            cell.shared.image = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
+                            cell.shared.image = NCUtility.shared.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
                         }
                     }
                 }
@@ -352,7 +352,7 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
                 
                 if selectocId.contains(metadata.ocId) {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedYes"), to: CGSize(width: 50, height: 50), isAspectRation: true)
-                    cell.backgroundView = NCUtility.sharedInstance.cellBlurEffect(with: cell.bounds)
+                    cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedNo"), to: CGSize(width: 50, height: 50), isAspectRation: true)
                     cell.backgroundView = nil
@@ -442,7 +442,7 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
                 cell.imageSelect.isHidden = false
                 if selectocId.contains(metadata.ocId) {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedYes"), to: CGSize(width: 50, height: 50), isAspectRation: true)
-                    cell.backgroundView = NCUtility.sharedInstance.cellBlurEffect(with: cell.bounds)
+                    cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {
                     cell.imageSelect.isHidden = true
                     cell.backgroundView = nil
@@ -552,7 +552,7 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
                 
                 // Status image: encrypted
                 let tableE2eEncryption = NCManageDatabase.sharedInstance.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND fileNameIdentifier == %@", appDelegate.account, metadata.fileName))
-                if tableE2eEncryption != nil &&  NCUtility.sharedInstance.isEncryptedMetadata(metadata) {
+                if tableE2eEncryption != nil &&  NCUtility.shared.isEncryptedMetadata(metadata) {
                     cell.status.image = UIImage.init(named: "encrypted")
                 }
                 
@@ -591,13 +591,13 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
                             cell.shared.image = avatar
                         }
                     } else if FileManager.default.fileExists(atPath: fileNameSource) {
-                        if let avatar = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar) {
+                        if let avatar = NCUtility.shared.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar) {
                             cell.shared.image = avatar
                         }
                     } else {
                         NCCommunication.shared.downloadAvatar(userID: metadata.ownerId, fileNameLocalPath: fileNameSource, size: Int(k_avatar_size)) { (account, data, errorCode, errorMessage) in
                             if errorCode == 0 && account == appDelegate.account {
-                                cell.shared.image = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
+                                cell.shared.image = NCUtility.shared.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
                             }
                         }
                     }

+ 3 - 3
iOSClient/Media/NCMedia.swift

@@ -664,7 +664,7 @@ extension NCMedia {
         if let tableAccount = NCManageDatabase.sharedInstance.getAccountActive() {
             self.mediaPath = tableAccount.mediaPath
         }
-        let startServerUrl = CCUtility.getHomeServer(appDelegate.urlBase) + mediaPath
+        let startServerUrl = NCUtility.shared.getHomeServer(appDelegate.urlBase) + mediaPath
         
         predicateDefault = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (typeFile == %@ OR typeFile == %@) AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, k_metadataTypeFile_image, k_metadataTypeFile_video)
         
@@ -731,12 +731,12 @@ extension NCMedia {
         }
         
         let height = self.tabBarController?.tabBar.frame.size.height ?? 0
-        NCUtility.sharedInstance.startActivityIndicator(view: self.view, bottom: height + 50)
+        NCUtility.shared.startActivityIndicator(view: self.view, bottom: height + 50)
 
         NCCommunication.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), user: appDelegate.user) { (account, files, errorCode, errorDescription) in
             
             self.oldInProgress = false
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             self.collectionView.reloadData()
 
             if errorCode == 0 && account == self.appDelegate.account {

+ 5 - 5
iOSClient/Networking/NCNetworking.swift

@@ -620,7 +620,7 @@ import Queuer
         var fileNameFolder = CCUtility.removeForbiddenCharactersServer(fileName)!
         
         if (!overwrite) {
-            fileNameFolder = NCUtility.sharedInstance.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
+            fileNameFolder = NCUtility.shared.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
         }
         if fileNameFolder.count == 0 {
             self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": Int(0)], errorDescription: "", completion: completion)
@@ -725,7 +725,7 @@ import Queuer
     func deleteMetadataPlain(_ metadata: tableMetadata, addCustomHeaders: [String: String]?, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
         
         // verify permission
-        let permission = NCUtility.sharedInstance.permissionsContainsString(metadata.permissions, permissions: k_permission_can_delete)
+        let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: k_permission_can_delete)
         if metadata.permissions != "" && permission == false {
             
             self.NotificationPost(name: k_notificationCenter_deleteFile, userInfo: ["metadata": metadata, "errorCode": Int(k_CCErrorInternalError)], errorDescription: "_no_permission_delete_file_", completion: completion)
@@ -852,7 +852,7 @@ import Queuer
     
     private func renameMetadataPlain(_ metadata: tableMetadata, fileNameNew: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String?)->()) {
         
-        let permission = NCUtility.sharedInstance.permissionsContainsString(metadata.permissions, permissions: k_permission_can_rename)
+        let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: k_permission_can_rename)
         if !(metadata.permissions == "") && !permission {
             self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": Int(k_CCErrorInternalError)], errorDescription: "_no_permission_modify_file_", completion: completion)
             return
@@ -921,7 +921,7 @@ import Queuer
 
     @objc func moveMetadataPlain(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String?)->()) {
     
-        let permission = NCUtility.sharedInstance.permissionsContainsString(metadata.permissions, permissions: k_permission_can_rename)
+        let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: k_permission_can_rename)
         if !(metadata.permissions == "") && !permission {
             self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "serverUrlTo": serverUrlTo, "errorCode": Int(k_CCErrorInternalError)], errorDescription: "_no_permission_modify_file_", completion: completion)
             return
@@ -971,7 +971,7 @@ import Queuer
 
     @objc func copyMetadataPlain(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String?)->()) {
     
-        let permission = NCUtility.sharedInstance.permissionsContainsString(metadata.permissions, permissions: k_permission_can_rename)
+        let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: k_permission_can_rename)
         if !(metadata.permissions == "") && !permission {
             self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "serverUrlTo": serverUrlTo, "errorCode": Int(k_CCErrorInternalError)], errorDescription: "_no_permission_modify_file_", completion: completion)
             return

+ 1 - 1
iOSClient/Networking/NCNetworkingAutoUpload.swift

@@ -118,7 +118,7 @@ class NCNetworkingAutoUpload: NSObject {
          
         // verify delete Asset Local Identifiers in auto upload (DELETE Photos album)
         if (counterUpload == 0 && appDelegate.passcodeViewController == nil) {
-            NCUtility.sharedInstance.deleteAssetLocalIdentifiers(account: appDelegate.account, sessionSelector: selectorUploadAutoUpload) {
+            NCUtility.shared.deleteAssetLocalIdentifiers(account: appDelegate.account, sessionSelector: selectorUploadAutoUpload) {
                 self.startTimer()
             }
         } else {

+ 2 - 2
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -41,7 +41,7 @@ import Alamofire
         var key: NSString?
         var initializationVector: NSString?
         
-        fileNameFolder = NCUtility.sharedInstance.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
+        fileNameFolder = NCUtility.shared.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
         if fileNameFolder.count == 0 {
             self.NotificationPost(name: k_notificationCenter_createFolder, serverUrl: serverUrl, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": Int(0)], errorDescription: "", completion: completion)
             return
@@ -54,7 +54,7 @@ import Alamofire
                                
                 NCCommunication.shared.createFolder(fileNameFolderUrl, addCustomHeaders: ["e2e-token" : e2eToken!]) { (account, ocId, date, errorCode, errorDescription) in
                     if errorCode == 0 {
-                        guard let fileId = NCUtility.sharedInstance.ocIdToFileId(ocId: ocId) else {
+                        guard let fileId = NCUtility.shared.ocIdToFileId(ocId: ocId) else {
                             self.NotificationPost(name: k_notificationCenter_createFolder, serverUrl: serverUrl, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": k_CCErrorInternalError], errorDescription: "Error convert ocId", completion: completion)
                             return
                         }

+ 1 - 1
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -78,7 +78,7 @@ import Foundation
                     // open View File
                     if (selector == selectorLoadFileView || selector == selectorLoadFileViewFavorite) && UIApplication.shared.applicationState == UIApplication.State.active {
                     
-                        if metadata.contentType.contains("opendocument") && !NCUtility.sharedInstance.isRichDocument(metadata) {
+                        if metadata.contentType.contains("opendocument") && !NCUtility.shared.isRichDocument(metadata) {
                             metadata.typeFile = k_metadataTypeFile_unknown
                         }
                         

+ 3 - 3
iOSClient/Notification/NCNotification.swift

@@ -297,7 +297,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, DZNEmpt
     
     func getNetwokingNotification() {
     
-        NCUtility.sharedInstance.startActivityIndicator(view: self.navigationController?.view)
+        NCUtility.shared.startActivityIndicator(view: self.navigationController?.view)
 
         NCCommunication.shared.getNotifications() { (account, notifications, errorCode, errorDescription) in
          
@@ -308,7 +308,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, DZNEmpt
                     
                 for notification in sortedListOfNotifications {
                     if let icon = (notification as! NCCommunicationNotifications).icon {
-                        NCUtility.sharedInstance.convertSVGtoPNGWriteToUserData(svgUrlString: icon, fileName: nil, width: 25, rewrite: false, account: self.appDelegate.account, closure: { (imageNamePath) in })
+                        NCUtility.shared.convertSVGtoPNGWriteToUserData(svgUrlString: icon, fileName: nil, width: 25, rewrite: false, account: self.appDelegate.account, closure: { (imageNamePath) in })
                     }                    
                     self.notifications.append(notification as! NCCommunicationNotifications)
                 }
@@ -316,7 +316,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, DZNEmpt
                 self.reloadDatasource()
             }
             
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
         }
     }
 }

+ 5 - 5
iOSClient/Offline/NCOffline.swift

@@ -109,7 +109,7 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
 
         self.navigationItem.title = titleCurrentFolder
         
-        (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.sharedInstance.getLayoutForView(key: k_layout_view_offline)
+        (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.shared.getLayoutForView(key: k_layout_view_offline)
         
         // get auto upload folder
         autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
@@ -186,7 +186,7 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
                 })
             })
             typeLayout = k_layout_list
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
         } else {
             // grid layout
             UIView.animate(withDuration: 0.0, animations: {
@@ -197,7 +197,7 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
                 })
             })
             typeLayout = k_layout_grid
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
         }
     }
     
@@ -420,7 +420,7 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
                     default: ()
                     }
             
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
 
             loadDatasource()
         }
@@ -481,7 +481,7 @@ extension NCOffline: UIViewControllerPreviewingDelegate {
         }
         
         viewController.showOpenIn = true
-        viewController.showOpenQuickLook = NCUtility.sharedInstance.isQuickLookDisplayable(metadata: metadata)
+        viewController.showOpenQuickLook = NCUtility.shared.isQuickLookDisplayable(metadata: metadata)
         viewController.showShare = false
         
         return viewController

+ 4 - 4
iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift

@@ -37,12 +37,12 @@ import NCCommunication
         
         guard let directEditingCreator = NCManageDatabase.sharedInstance.getDirectEditingCreators(predicate: NSPredicate(format: "account == %@ AND editor == 'text'", appDelegate.account))?.first else { return }
         
-        NCUtility.sharedInstance.startActivityIndicator(view: viewController.view)
+        NCUtility.shared.startActivityIndicator(view: viewController.view)
         
         let fileNamePath = CCUtility.returnFileNamePath(fromFileName: k_fileNameRichWorkspace, serverUrl: serverUrl, urlBase: appDelegate.urlBase)!
         NCCommunication.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier ,templateId: "") { (account, url, errorCode, errorMessage) in
             
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             
             if errorCode == 0 && account == self.appDelegate.account {
                 
@@ -72,12 +72,12 @@ import NCCommunication
             
             if metadata.url == "" {
                 
-                NCUtility.sharedInstance.startActivityIndicator(view: viewController.view)
+                NCUtility.shared.startActivityIndicator(view: viewController.view)
                 
                 let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: appDelegate.urlBase)!
                 NCCommunication.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text") { (account, url, errorCode, errorMessage) in
                     
-                    NCUtility.sharedInstance.stopActivityIndicator()
+                    NCUtility.shared.stopActivityIndicator()
                     
                     if errorCode == 0 && account == self.appDelegate.account {
                         

+ 5 - 5
iOSClient/Select/NCSelect.swift

@@ -174,7 +174,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
             buttonCreateFolder.isHidden = true
         }
         
-        (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.sharedInstance.getLayoutForView(key: layoutViewSelect)
+        (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.shared.getLayoutForView(key: layoutViewSelect)
         
         // get auto upload folder
         autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
@@ -301,7 +301,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
                 })
             })
             typeLayout = k_layout_list
-            NCUtility.sharedInstance.setLayoutForView(key: layoutViewSelect, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: layoutViewSelect, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
         } else {
             // grid layout
             UIView.animate(withDuration: 0.0, animations: {
@@ -312,7 +312,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
                 })
             })
             typeLayout = k_layout_grid
-            NCUtility.sharedInstance.setLayoutForView(key: layoutViewSelect, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: layoutViewSelect, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
         }
     }
     
@@ -453,7 +453,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
                     default: ()
                     }
             
-            NCUtility.sharedInstance.setLayoutForView(key: layoutViewSelect, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: layoutViewSelect, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
             
             loadDatasource(withLoadFolder: false)
         }
@@ -660,7 +660,7 @@ extension NCSelect {
         
         if serverUrl == "" {
             
-            serverUrl = CCUtility.getHomeServer(appDelegate.urlBase)
+            serverUrl = NCUtility.shared.getHomeServer(appDelegate.urlBase)
         }
         
         if includeDirectoryE2EEncryption {

+ 1 - 1
iOSClient/Settings/CCManageAutoUpload.m

@@ -486,7 +486,7 @@
 {
     if (serverUrl != nil) {
         
-        if ([serverUrl isEqualToString:[CCUtility getHomeServer:appDelegate.urlBase]]) {
+        if ([serverUrl isEqualToString:[[NCUtility shared] getHomeServer:appDelegate.urlBase]]) {
             [[NCContentPresenter shared] messageNotification:@"_error_" description:@"_autoupload_error_select_folder_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError forced:true];
             return;
         }

+ 12 - 12
iOSClient/Share/NCShareNetworking.swift

@@ -44,10 +44,10 @@ class NCShareNetworking: NSObject {
     }
     
     func readShare() {
-        NCUtility.sharedInstance.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(view: view)
         let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase)!
         NCCommunication.shared.readShares(path: filenamePath) { (account, shares, errorCode, errorDescription) in
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
              if errorCode == 0 && shares != nil {
                 NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, urlBase: self.urlBase, shares: shares!)
                 self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
@@ -59,10 +59,10 @@ class NCShareNetworking: NSObject {
     }
     
     func createShareLink(password: String?) {
-        NCUtility.sharedInstance.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(view: view)
         let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase)!
         NCCommunication.shared.createShareLink(path: filenamePath, password: password) { (account, share, errorCode, errorDescription) in
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 && share != nil {
                 NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, urlBase: self.urlBase, shares: [share!])
                 self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
@@ -74,12 +74,12 @@ class NCShareNetworking: NSObject {
     }
     
     func createShare(shareWith: String, shareType: Int, metadata: tableMetadata) {
-        NCUtility.sharedInstance.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(view: view)
         let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase)!
         var permission: Int = 1
         if metadata.directory { permission = Int(k_max_folder_share_permission) } else { permission = Int(k_max_file_share_permission) }
         NCCommunication.shared.createShare(path: filenamePath, shareType: shareType, shareWith: shareWith, permissions: permission) { (account, share, errorCode, errorDescription) in
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 && share != nil {
                 NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, urlBase: self.urlBase, shares: [share!])
                 self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
@@ -91,9 +91,9 @@ class NCShareNetworking: NSObject {
     }
     
     func unShare(idShare: Int) {
-        NCUtility.sharedInstance.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(view: view)
         NCCommunication.shared.deleteShare(idShare: idShare) { (account, errorCode, errorDescription) in
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 {
                 NCManageDatabase.sharedInstance.deleteTableShare(account: account, idShare: idShare)
                 self.delegate?.unShareCompleted()
@@ -104,9 +104,9 @@ class NCShareNetworking: NSObject {
     }
     
     func updateShare(idShare: Int, password: String?, permission: Int, note: String?, expirationDate: String?, hideDownload: Bool) {
-        NCUtility.sharedInstance.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(view: view)
         NCCommunication.shared.updateShare(idShare: idShare, password: password, expireDate: expirationDate, permissions: permission, note: note, hideDownload: hideDownload) { (account, share, errorCode, errorDescription) in
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 && share != nil {
                 NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, urlBase: self.urlBase, shares: [share!])
                 self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
@@ -119,9 +119,9 @@ class NCShareNetworking: NSObject {
     }
     
     func getSharees(searchString: String) {
-        NCUtility.sharedInstance.startActivityIndicator(view: view)
+        NCUtility.shared.startActivityIndicator(view: view)
         NCCommunication.shared.searchSharees(search: searchString) { (account, sharees, errorCode, errorDescription) in
-            NCUtility.sharedInstance.stopActivityIndicator()
+            NCUtility.shared.stopActivityIndicator()
             if errorCode == 0 {
                 self.delegate?.getSharees(sharees: sharees)
             } else {

+ 2 - 2
iOSClient/Shares/NCShares.m

@@ -307,10 +307,10 @@
     
     cell.labelTitle.text = table.fileName;
     
-    if ([table.serverUrl isEqualToString:[CCUtility getHomeServer:appDelegate.urlBase]])
+    if ([table.serverUrl isEqualToString:[[NCUtility shared] getHomeServer:appDelegate.urlBase]])
         cell.labelInfoFile.text = @"/";
     else
-        cell.labelInfoFile.text = [table.serverUrl stringByReplacingOccurrencesOfString:[CCUtility getHomeServer:appDelegate.urlBase] withString:@""];
+        cell.labelInfoFile.text = [table.serverUrl stringByReplacingOccurrencesOfString:[[NCUtility shared] getHomeServer:appDelegate.urlBase] withString:@""];
     
     return cell;
 }

+ 7 - 7
iOSClient/Trash/NCTrash.swift

@@ -88,7 +88,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
         
         self.navigationItem.title = titleCurrentFolder
 
-        (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.sharedInstance.getLayoutForView(key: k_layout_view_trash)
+        (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.shared.getLayoutForView(key: k_layout_view_trash)
 
         if typeLayout == k_layout_list {
             collectionView.collectionViewLayout = listLayout
@@ -152,7 +152,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
     }
     
     func reloadSortOrder(){
-        NCUtility.sharedInstance.setLayoutForView(
+        NCUtility.shared.setLayoutForView(
             key: k_layout_view_trash,
             layout: self.typeLayout,
             sort: self.datasourceSorted,
@@ -176,7 +176,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
                 })
             })
             typeLayout = k_layout_list
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_trash, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: k_layout_view_trash, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
         } else {
             // grid layout
             UIView.animate(withDuration: 0.0, animations: {
@@ -187,7 +187,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
                 })
             })
             typeLayout = k_layout_grid
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_trash, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
+            NCUtility.shared.setLayoutForView(key: k_layout_view_trash, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
         }
     }
     
@@ -569,7 +569,7 @@ extension NCTrash: UICollectionViewDataSource {
                 
                 if selectocId.contains(tableTrash.fileId) {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedYes"), to: CGSize(width: 50, height: 50), isAspectRation: true)
-                    cell.backgroundView = NCUtility.sharedInstance.cellBlurEffect(with: cell.bounds)
+                    cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedNo"), to: CGSize(width: 50, height: 50), isAspectRation: true)
                     cell.backgroundView = nil
@@ -603,7 +603,7 @@ extension NCTrash: UICollectionViewDataSource {
                 cell.imageSelect.isHidden = false
                 if selectocId.contains(tableTrash.fileId) {
                     cell.imageSelect.image = CCGraphics.scale(UIImage.init(named: "checkedYes"), to: CGSize(width: 50, height: 50), isAspectRation: true)
-                    cell.backgroundView = NCUtility.sharedInstance.cellBlurEffect(with: cell.bounds)
+                    cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {
                     cell.imageSelect.isHidden = true
                     cell.backgroundView = nil
@@ -651,7 +651,7 @@ extension NCTrash {
                         self.collectionView.scrollToItem(at: indexPath, at: .top, animated: false)
                         DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
                             self.blinkocId = nil
-                            NCUtility.sharedInstance.blink(cell: self.collectionView.cellForItem(at: indexPath))
+                            NCUtility.shared.blink(cell: self.collectionView.cellForItem(at: indexPath))
                         }
                     }
                 }

+ 2 - 2
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.m

@@ -44,7 +44,7 @@
 
     self.title = NSLocalizedString(@"_upload_", nil);
     
-    serverUrlLocal= [CCUtility getHomeServer:appDelegate.urlBase];
+    serverUrlLocal= [[NCUtility shared] getHomeServer:appDelegate.urlBase];
     destinationTitle = NSLocalizedString(@"_home_", nil);
     
     // changeTheming
@@ -168,7 +168,7 @@
 
 -(void)upload
 {
-    NSString *fileName = [[NCUtility sharedInstance] createFileName:self.fileNameTextfield.text serverUrl:serverUrlLocal account:appDelegate.account];
+    NSString *fileName = [[NCUtility shared] createFileName:self.fileNameTextfield.text serverUrl:serverUrlLocal account:appDelegate.account];
     
     tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] createMetadataWithAccount:appDelegate.account fileName:fileName ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrlLocal urlBase:appDelegate.urlBase url:@"" contentType:@"" livePhoto:false];
     

+ 0 - 1
iOSClient/Utility/CCUtility.h

@@ -201,7 +201,6 @@
 + (void)createDirectoryStandard;
 
 + (NSURL *)getDirectoryGroup;
-+ (NSString *)getHomeServer:(NSString *)urlBase;
 + (NSString *)getStringUser:(NSString *)user urlBase:(NSString *)urlBase;
 + (NSString *)getDirectoryDocuments;
 + (NSString *)getDirectoryReaderMetadata;

+ 3 - 11
iOSClient/Utility/CCUtility.m

@@ -1060,14 +1060,6 @@
     return path;
 }
 
-+ (NSString *)getHomeServer:(NSString *)urlBase
-{
-    if (urlBase == nil)
-        return @"";
-    
-    return [urlBase stringByAppendingString:k_webDAV];
-}
-
 + (NSString *)getStringUser:(NSString *)user urlBase:(NSString *)urlBase
 {
     NSString *baseUrl = [urlBase lowercaseString];
@@ -1299,7 +1291,7 @@
     NSString *firstPath = serverUrl;
 
     NSURL *serverUrlURL = [NSURL URLWithString:[serverUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]];
-    NSURL *urlBaseURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/", [urlBase stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]], k_webDAV]];
+    NSURL *urlBaseURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/", [urlBase stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]], @"/remote.php/webdav"]];
     
     while ([[serverUrlURL absoluteString] isEqualToString:[urlBaseURL absoluteString]] == false) {
         firstPath = [serverUrlURL absoluteString];
@@ -1323,7 +1315,7 @@
 
 + (NSString *)returnPathfromServerUrl:(NSString *)serverUrl urlBase:(NSString *)urlBase
 {
-    NSString *path = [serverUrl stringByReplacingOccurrencesOfString:[urlBase stringByAppendingString:k_webDAV] withString:@""];
+    NSString *path = [serverUrl stringByReplacingOccurrencesOfString:[urlBase stringByAppendingString:@"/remote.php/webdav"] withString:@""];
     
     return path;
 }
@@ -1334,7 +1326,7 @@
         return @"";
     }
     
-    NSString *fileName = [NSString stringWithFormat:@"%@/%@", [serverUrl stringByReplacingOccurrencesOfString:[CCUtility getHomeServer:urlBase] withString:@""], metadataFileName];
+    NSString *fileName = [NSString stringWithFormat:@"%@/%@", [serverUrl stringByReplacingOccurrencesOfString:[[NCUtility shared] getHomeServer:urlBase] withString:@""], metadataFileName];
     
     if ([fileName hasPrefix:@"/"]) fileName = [fileName substringFromIndex:1];
     

+ 13 - 1
iOSClient/Utility/NCUtility.swift

@@ -28,13 +28,25 @@ import NCCommunication
 import PDFKit
 
 class NCUtility: NSObject {
-    @objc static let sharedInstance: NCUtility = {
+    @objc static let shared: NCUtility = {
         let instance = NCUtility()
         return instance
     }()
     
     let activityIndicator = UIActivityIndicatorView(style: .whiteLarge)
     
+    @objc func getWebDAV() -> String {
+        return "/remote.php/webdav"
+    }
+    
+    @objc func getDAV() -> String {
+        return "/remote.php/dav"
+    }
+    
+    @objc func getHomeServer(_ urlBase: String) -> String {
+        return urlBase + self.getWebDAV()
+    }
+    
     @objc func createFileName(_ fileName: String, serverUrl: String, account: String) -> String {
         
         var resultFileName = fileName

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

@@ -53,7 +53,7 @@ class NCViewerImageCommon: NSObject {
         } else if offLineDatasource {
             var datasourceSorted = ""
             var datasourceAscending = true
-            (_, datasourceSorted, datasourceAscending, _, _) = NCUtility.sharedInstance.getLayoutForView(key: k_layout_view_offline)
+            (_, datasourceSorted, datasourceAscending, _, _) = NCUtility.shared.getLayoutForView(key: k_layout_view_offline)
             let files = NCManageDatabase.sharedInstance.getTableLocalFiles(predicate: NSPredicate(format: "account == %@ AND offline == true", metadata.account), sorted: datasourceSorted, ascending: datasourceAscending)
             var ocIds: [String] = []
             for file: tableLocalFile in files {

+ 2 - 2
iOSClient/Viewer/NCViewerNextcloudText.swift

@@ -68,7 +68,7 @@ class NCViewerNextcloudText: WKWebView, WKNavigationDelegate, WKScriptMessageHan
         request.addValue(language, forHTTPHeaderField: "Accept-Language")
                 
         if editor == k_editor_onlyoffice {
-            customUserAgent = NCUtility.sharedInstance.getCustomUserAgentOnlyOffice()
+            customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
         } else {
             customUserAgent = CCUtility.getUserAgent()
         }
@@ -139,6 +139,6 @@ class NCViewerNextcloudText: WKWebView, WKNavigationDelegate, WKScriptMessageHan
     }
     
     public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
-        NCUtility.sharedInstance.stopActivityIndicator()
+        NCUtility.shared.stopActivityIndicator()
     }
 }

+ 3 - 3
iOSClient/Viewer/NCViewerRichdocument.swift

@@ -142,7 +142,7 @@ class NCViewerRichdocument: WKWebView, WKNavigationDelegate, WKScriptMessageHand
                         let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + filename
                     
                         if type == "print" {
-                            NCUtility.sharedInstance.startActivityIndicator(view: self)
+                            NCUtility.shared.startActivityIndicator(view: self)
                         }
                         
                         NCCommunication.shared.download(serverUrlFileName: urlString, fileNameLocalPath: fileNameLocalPath, requestHandler: { (_) in
@@ -153,7 +153,7 @@ class NCViewerRichdocument: WKWebView, WKNavigationDelegate, WKScriptMessageHand
                             
                             if errorCode == 0 && account == self.metadata.account {
                                 if type == "print" {
-                                    NCUtility.sharedInstance.stopActivityIndicator()
+                                    NCUtility.shared.stopActivityIndicator()
                                     let pic = UIPrintInteractionController.shared
                                     let printInfo = UIPrintInfo.printInfo()
                                     printInfo.outputType = UIPrintInfo.OutputType.general
@@ -259,6 +259,6 @@ class NCViewerRichdocument: WKWebView, WKNavigationDelegate, WKScriptMessageHand
     }
     
     public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
-        NCUtility.sharedInstance.stopActivityIndicator()
+        NCUtility.shared.stopActivityIndicator()
     }
 }