marinofaggiana 4 years ago
parent
commit
225b4306f7

+ 0 - 1
iOSClient/CCGlobal.h

@@ -175,7 +175,6 @@
 #define selectorReadFile                                @"readFile"
 #define selectorListingFavorite                         @"listingFavorite"
 #define selectorLoadFileView                            @"loadFileView"
-#define selectorLoadFileViewFavorite                    @"loadFileViewFavorite"
 #define selectorLoadFileQuickLook                       @"loadFileQuickLook"
 #define selectorLoadCopy                                @"loadCopy"
 #define selectorLoadOffline                             @"loadOffline"

+ 1 - 1
iOSClient/Favorites/NCFavorite.swift

@@ -83,7 +83,7 @@ class NCFavorite: NCCollectionViewCommon  {
             if CCUtility.fileProviderStorageExists(metadataPush?.ocId, fileNameView: metadataPush?.fileNameView) {
                 performSegue(withIdentifier: "segueDetail", sender: self)
             } else {
-                NCNetworking.shared.download(metadata: metadataPush!, selector: selectorLoadFileViewFavorite) { (_) in }
+                NCNetworking.shared.download(metadata: metadataPush!, selector: selectorLoadFileView) { (_) in }
             }
         }
     }

+ 12 - 4
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -330,8 +330,13 @@ import NCCommunication
                         self.dismiss(animated: true, completion: {
                             let metadata = NCManageDatabase.sharedInstance.createMetadata(account: self.appDelegate.account, fileName: fileName, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, urlBase: self.appDelegate.urlBase, url: url ?? "", contentType: result.contentType, livePhoto: false)
                             
-                            self.appDelegate.activeMain.readFileReloadFolder()
-                            self.appDelegate.activeMain.shouldPerformSegue(metadata, selector: "")
+                            if self.appDelegate.activeViewController is CCMain {
+                                (self.appDelegate.activeViewController as! CCMain).shouldPerformSegue(metadata, selector: "")
+                            } else if self.appDelegate.activeViewController is NCFavorite {
+                                (self.appDelegate.activeViewController as! NCFavorite).segue(metadata: metadata)
+                            } else if self.appDelegate.activeViewController is NCOffline {
+                                (self.appDelegate.activeViewController as! NCOffline).segue(metadata: metadata)
+                            }
                         })
                     }
                     
@@ -341,7 +346,6 @@ import NCCommunication
                    print("[LOG] It has been changed user during networking process, error.")
                 }
             }
-            
         }
         
         if self.editorId == k_editor_collabora {
@@ -354,8 +358,12 @@ import NCCommunication
                     
                         let metadata = NCManageDatabase.sharedInstance.createMetadata(account: self.appDelegate.account, fileName: (fileName as NSString).deletingPathExtension + "." + self.fileNameExtension, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, urlBase: self.appDelegate.urlBase, url: url!, contentType: "", livePhoto: false)
                     
-                        if self.appDelegate.activeViewController is NCFavorite {
+                        if self.appDelegate.activeViewController is CCMain {
+                            (self.appDelegate.activeViewController as! CCMain).shouldPerformSegue(metadata, selector: "")
+                        } else if self.appDelegate.activeViewController is NCFavorite {
                             (self.appDelegate.activeViewController as! NCFavorite).segue(metadata: metadata)
+                        } else if self.appDelegate.activeViewController is NCOffline {
+                            (self.appDelegate.activeViewController as! NCOffline).segue(metadata: metadata)
                         }
                    })
                    

+ 7 - 5
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -59,7 +59,7 @@ import Foundation
                         viewerQuickLook = NCViewerQuickLook.init()
                         viewerQuickLook?.quickLook(url: URL(fileURLWithPath: fileNamePath), viewController: appDelegate.activeMain)
                         
-                    case selectorLoadFileView, selectorLoadFileViewFavorite:
+                    case selectorLoadFileView:
                         
                         if UIApplication.shared.applicationState == UIApplication.State.active {
                                                         
@@ -77,10 +77,12 @@ import Foundation
                                 
                             } else {
                                 
-                                if appDelegate.activeMain.view.window != nil && selector == selectorLoadFileView{
-                                    appDelegate.activeMain.shouldPerformSegue(metadata, selector: selector)
-                                } else if appDelegate.activeFavorite.view.window != nil && selector == selectorLoadFileViewFavorite{
-                                    appDelegate.activeFavorite.segue(metadata: metadata)
+                                if self.appDelegate.activeViewController is CCMain {
+                                    (self.appDelegate.activeViewController as! CCMain).shouldPerformSegue(metadata, selector: "")
+                                } else if self.appDelegate.activeViewController is NCFavorite {
+                                    (self.appDelegate.activeViewController as! NCFavorite).segue(metadata: metadata)
+                                } else if self.appDelegate.activeViewController is NCOffline {
+                                    (self.appDelegate.activeViewController as! NCOffline).segue(metadata: metadata)
                                 }
                             }
                         }