marinofaggiana 4 anos atrás
pai
commit
533b3cd9bf

+ 4 - 4
iOSClient/Main/CCMain.m

@@ -1092,7 +1092,7 @@
     tableMetadata *metadata = [[NCMainCommon shared] getMetadataFromSectionDataSourceIndexPath:indexPath sectionDataSource:sectionDataSource];
     
     if (metadata && ![CCUtility isFolderEncrypted:self.serverUrl e2eEncrypted:metadata.e2eEncrypted account:appDelegate.account urlBase: appDelegate.urlBase]) {
-        [[NCMainCommon shared] openShareWithViewController:self metadata:metadata indexPage:1];
+        [[NCNetworkingNotificationCenter shared] openShareWithViewController:self metadata:metadata indexPage:1];
     }
 }
 
@@ -1104,7 +1104,7 @@
     tableMetadata *metadata = [[NCMainCommon shared] getMetadataFromSectionDataSourceIndexPath:indexPath sectionDataSource:sectionDataSource];
     
     if (metadata && ![CCUtility isFolderEncrypted:self.serverUrl e2eEncrypted:metadata.e2eEncrypted account:appDelegate.account urlBase:appDelegate.urlBase]) {
-        [[NCMainCommon shared] openShareWithViewController:self metadata:metadata indexPage:2];
+        [[NCNetworkingNotificationCenter shared] openShareWithViewController:self metadata:metadata indexPage:2];
     }
 }
 
@@ -1343,14 +1343,14 @@
 
 - (void)openinTouchFile:(id)sender
 {
-    [[NCMainCommon shared] downloadOpenWithMetadata:self.metadata selector:selectorOpenIn];
+    [[NCNetworkingNotificationCenter shared] downloadOpenWithMetadata:self.metadata selector:selectorOpenIn];
 }
 
 /************************************ OPEN QUICK LOOK ******************************/
 
 - (void)openQuickLookTouch:(id)sender
 {
-    [[NCMainCommon shared] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileQuickLook];
+    [[NCNetworkingNotificationCenter shared] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileQuickLook];
 }
 
 /************************************ PASTE ************************************/

+ 1 - 1
iOSClient/Main/Collection/NCCollectionViewCommon.swift

@@ -637,7 +637,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     func tapShareListItem(with objectId: String, sender: Any) {
         
         guard let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(objectId) else { return }
-        NCMainCommon.shared.openShare(ViewController: self, metadata: metadata, indexPage: 2)
+        NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 2)
     }
         
     func tapMoreGridItem(with objectId: String, namedButtonMore: String, sender: Any) {

+ 3 - 3
iOSClient/Main/Menu/CCMain+Menu.swift

@@ -151,7 +151,7 @@ extension CCMain {
                         title: NSLocalizedString("_details_", comment: ""),
                         icon: CCGraphics.changeThemingColorImage(UIImage(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                         action: { menuAction in
-                            NCMainCommon.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
+                            NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
                         }
                     )
                 )
@@ -298,7 +298,7 @@ extension CCMain {
                         title: NSLocalizedString("_details_", comment: ""),
                         icon: CCGraphics.changeThemingColorImage(UIImage(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                         action: { menuAction in
-                            NCMainCommon.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
+                            NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
                         }
                     )
                 )
@@ -310,7 +310,7 @@ extension CCMain {
                         icon: CCGraphics.changeThemingColorImage(UIImage(named: "openFile"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                         action: { menuAction in
                             self.tableView.setEditing(false, animated: true)
-                            NCMainCommon.shared.downloadOpen(metadata: metadata, selector: selectorOpenIn)
+                            NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: selectorOpenIn)
                         }
                     )
                 )

+ 2 - 2
iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift

@@ -113,7 +113,7 @@ extension NCCollectionViewCommon {
                     title: NSLocalizedString("_details_", comment: ""),
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                     action: { menuAction in
-                        NCMainCommon.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
+                        NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
                     }
                 )
             )
@@ -128,7 +128,7 @@ extension NCCollectionViewCommon {
                     title: NSLocalizedString("_open_in_", comment: ""),
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "openFile"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                     action: { menuAction in
-                        NCMainCommon.shared.downloadOpen(metadata: metadata, selector: selectorOpenIn)
+                        NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: selectorOpenIn)
                     }
                 )
             )

+ 2 - 2
iOSClient/Main/Menu/NCDetailNavigationController+Menu.swift

@@ -94,7 +94,7 @@ extension NCDetailNavigationController {
                 title: NSLocalizedString("_details_", comment: ""),
                 icon: CCGraphics.changeThemingColorImage(UIImage(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                 action: { menuAction in
-                    NCMainCommon.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
+                    NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata, indexPage: 0)
                 }
             )
         )
@@ -104,7 +104,7 @@ extension NCDetailNavigationController {
                 NCMenuAction(title: NSLocalizedString("_open_in_", comment: ""),
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "openFile"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                     action: { menuAction in
-                        NCMainCommon.shared.downloadOpen(metadata: metadata, selector: selectorOpenInDetail)
+                        NCNetworkingNotificationCenter.shared.downloadOpen(metadata: metadata, selector: selectorOpenInDetail)
                     }
                 )
             )

+ 1 - 29
iOSClient/Main/NCMainCommon.swift

@@ -451,37 +451,9 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate {
         return true
     }
     
-    //MARK: - download Open Selector
     
-    @objc func downloadOpen(metadata: tableMetadata, selector: String) {
-        
-        if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
-            
-            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadedFile, userInfo: ["metadata": metadata, "selector": selector, "errorCode": 0, "errorDescription": "" ])
-                                    
-        } else {
-            
-            NCNetworking.shared.download(metadata: metadata, selector: selector) { (_) in }
-        }
-    }
 
-    //MARK: - OpenIn
-    
-    
-    
-    //MARK: - OpenShare
-    
-    @objc func openShare(ViewController: UIViewController, metadata: tableMetadata, indexPage: Int) {
-        
-        let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController
-        let shareViewController = shareNavigationController.topViewController as! NCSharePaging
-        
-        shareViewController.metadata = metadata
-        shareViewController.indexPage = indexPage
-        
-        shareNavigationController.modalPresentationStyle = .formSheet
-        ViewController.present(shareNavigationController, animated: true, completion: nil)
-    }
+   
     
     //MARK: - NCAudioRecorder
     

+ 24 - 0
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -160,6 +160,30 @@ import Foundation
         }
     }
     
+    @objc func openShare(ViewController: UIViewController, metadata: tableMetadata, indexPage: Int) {
+        
+        let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController
+        let shareViewController = shareNavigationController.topViewController as! NCSharePaging
+        
+        shareViewController.metadata = metadata
+        shareViewController.indexPage = indexPage
+        
+        shareNavigationController.modalPresentationStyle = .formSheet
+        ViewController.present(shareNavigationController, animated: true, completion: nil)
+    }
+        
+    @objc func downloadOpen(metadata: tableMetadata, selector: String) {
+        
+        if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
+            
+            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadedFile, userInfo: ["metadata": metadata, "selector": selector, "errorCode": 0, "errorDescription": "" ])
+                                    
+        } else {
+            
+            NCNetworking.shared.download(metadata: metadata, selector: selector) { (_) in }
+        }
+    }
+    
     //MARK: - Upload
 
     @objc func uploadedFile(_ notification: NSNotification) {

+ 3 - 3
iOSClient/PeekPop/CCPeekPop.m

@@ -73,21 +73,21 @@
  
     if (self.showOpenIn && !self.metadata.directory) {
         UIPreviewAction *item = [UIPreviewAction actionWithTitle:NSLocalizedString(@"_open_in_", nil) style:UIPreviewActionStyleDefault handler:^(UIPreviewAction *action,  UIViewController *previewViewController) {
-            [[NCMainCommon shared] downloadOpenWithMetadata:self.metadata selector:selectorOpenIn];
+            [[NCNetworkingNotificationCenter shared] downloadOpenWithMetadata:self.metadata selector:selectorOpenIn];
         }];
         [items addObject:item];
     }
     
     if (self.showOpenQuickLook) {
         UIPreviewAction *item = [UIPreviewAction actionWithTitle:NSLocalizedString(@"_open_quicklook_", nil) style:UIPreviewActionStyleDefault handler:^(UIPreviewAction *action,  UIViewController *previewViewController) {
-            [[NCMainCommon shared] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileQuickLook];
+            [[NCNetworkingNotificationCenter shared] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileQuickLook];
         }];
         [items addObject:item];
     }
     
     if (self.showShare) {
         UIPreviewAction *item = [UIPreviewAction actionWithTitle:NSLocalizedString(@"_share_", nil) style:UIPreviewActionStyleDefault handler:^(UIPreviewAction *action,  UIViewController *previewViewController) {
-            [[NCMainCommon shared] openShareWithViewController:appDelegate.activeMain metadata:self.metadata indexPage:2];
+            [[NCNetworkingNotificationCenter shared] openShareWithViewController:appDelegate.activeMain metadata:self.metadata indexPage:2];
         }];
         [items addObject:item];
     }

+ 1 - 1
iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift

@@ -80,7 +80,7 @@ class NCViewerRichWorkspaceWebView: UIViewController, WKNavigationDelegate, WKSc
             
             if message.body as? String == "share" {
                 if (metadata != nil) {
-                     NCMainCommon.shared.openShare(ViewController: self, metadata: metadata!, indexPage: 2)
+                    NCNetworkingNotificationCenter.shared.openShare(ViewController: self, metadata: metadata!, indexPage: 2)
                 }
             }
             

+ 1 - 1
iOSClient/Shares/NCShares.m

@@ -327,7 +327,7 @@
         
         metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileName == %@", appDelegate.account, table.serverUrl, table.fileName]];
         if (metadata) {
-            [[NCMainCommon shared] openShareWithViewController:self metadata:metadata indexPage:2];
+            [[NCNetworkingNotificationCenter shared] openShareWithViewController:self metadata:metadata indexPage:2];
         }
     }
 }

+ 1 - 1
iOSClient/Viewer/NCViewerNextcloudText.swift

@@ -102,7 +102,7 @@ class NCViewerNextcloudText: WKWebView, WKNavigationDelegate, WKScriptMessageHan
             }
             
             if message.body as? String == "share" {
-                NCMainCommon.shared.openShare(ViewController: viewController, metadata: metadata, indexPage: 2)
+                NCNetworkingNotificationCenter.shared.openShare(ViewController: viewController, metadata: metadata, indexPage: 2)
             }
             
             if message.body as? String == "loading" {

+ 1 - 1
iOSClient/Viewer/NCViewerRichdocument.swift

@@ -119,7 +119,7 @@ class NCViewerRichdocument: WKWebView, WKNavigationDelegate, WKScriptMessageHand
             }
             
             if message.body as? String == "share" {
-                NCMainCommon.shared.openShare(ViewController: viewController, metadata: metadata, indexPage: 2)
+                NCNetworkingNotificationCenter.shared.openShare(ViewController: viewController, metadata: metadata, indexPage: 2)
             }
             
             if let param = message.body as? Dictionary<AnyHashable,Any> {