marinofaggiana 4 роки тому
батько
коміт
bfe0471bbf

+ 35 - 35
iOSClient/CCGlobal.h

@@ -306,38 +306,38 @@
 #define k_notificationCenter_applicationDidEnterBackground  @"applicationDidEnterBackground"
 #define k_notificationCenter_applicationWillEnterForeground @"applicationWillEnterForeground"
 
-#define k_notificationCenter_initializeMain             @"initializeMain"
-#define k_notificationCenter_setTitleMain               @"setTitleMain"
-#define k_notificationCenter_changeTheming              @"changeTheming"
-#define k_notificationCenter_changeUserProfile          @"changeUserProfile"
-#define k_notificationCenter_richdocumentGrabFocus      @"richdocumentGrabFocus"
-#define k_notificationCenter_reloadDataNCShare          @"reloadDataNCShare"
-#define k_notificationCenter_closeRichWorkspaceWebView  @"closeRichWorkspaceWebView"
-
-#define k_notificationCenter_reloadDataSource           @"reloadDataSource"                 // userInfo: ocId?, serverUrl?
-#define k_notificationCenter_reloadDataSourceNetwork    @"reloadDataSourceNetwork"          // userInfo: serverUrl
-
-#define k_notificationCenter_mediaFileNotFound          @"mediaFileNotFound"                // userInfo: metadata
-#define k_notificationCenter_changeStatusFolderE2EE     @"changeStatusFolderE2EE"           // userInfo: serverUrl
-
-#define k_notificationCenter_downloadStartFile          @"downloadStartFile"                // userInfo: metadata
-#define k_notificationCenter_downloadedFile             @"downloadedFile"                   // userInfo: metadata, selector, errorCode, errorDescription
-#define k_notificationCenter_downloadCancelFile         @"downloadCancelFile"               // userInfo: metadata
-
-#define k_notificationCenter_uploadStartFile            @"uploadStartFile"                  // userInfo: metadata
-#define k_notificationCenter_uploadedFile               @"uploadedFile"                     // userInfo: metadata, ocIdTemp, errorCode, errorDescription
-#define k_notificationCenter_uploadCancelFile           @"uploadCancelFile"                 // userInfo: metadata
-
-#define k_notificationCenter_progressTask               @"progressTask"                     // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected
-
-#define k_notificationCenter_createFolder               @"createFolder"                     // userInfo: metadata
-#define k_notificationCenter_deleteFile                 @"deleteFile"                       // userInfo: metadata, onlyLocal
-#define k_notificationCenter_renameFile                 @"renameFile"                       // userInfo: metadata, errorCode, errorDescription
-#define k_notificationCenter_moveFile                   @"moveFile"                         // userInfo: metadata, metadataNew
-#define k_notificationCenter_copyFile                   @"copyFile"                         // userInfo: metadata, serverUrlTo
-#define k_notificationCenter_favoriteFile               @"favoriteFile"                     // userInfo: metadata
-
-#define k_notificationCenter_menuSearchTextPDF          @"menuSearchTextPDF"
-#define k_notificationCenter_menuDownloadImage          @"menuDownloadImage"                // userInfo: metadata
-#define k_notificationCenter_menuSaveLivePhoto          @"menuSaveLivePhoto"                // userInfo: metadata, metadataMov
-#define k_notificationCenter_menuDetailClose            @"menuDetailClose"
+#define k_notificationCenter_initializeMain                 @"initializeMain"
+#define k_notificationCenter_setTitleMain                   @"setTitleMain"
+#define k_notificationCenter_changeTheming                  @"changeTheming"
+#define k_notificationCenter_changeUserProfile              @"changeUserProfile"
+#define k_notificationCenter_richdocumentGrabFocus          @"richdocumentGrabFocus"
+#define k_notificationCenter_reloadDataNCShare              @"reloadDataNCShare"
+#define k_notificationCenter_closeRichWorkspaceWebView      @"closeRichWorkspaceWebView"
+
+#define k_notificationCenter_reloadDataSource               @"reloadDataSource"                 // userInfo: ocId?, serverUrl?
+#define k_notificationCenter_reloadDataSourceNetworkForced  @"reloadDataSourceNetworkForced"    // userInfo: serverUrl
+
+#define k_notificationCenter_mediaFileNotFound              @"mediaFileNotFound"                // userInfo: metadata
+#define k_notificationCenter_changeStatusFolderE2EE         @"changeStatusFolderE2EE"           // userInfo: serverUrl
+
+#define k_notificationCenter_downloadStartFile              @"downloadStartFile"                // userInfo: metadata
+#define k_notificationCenter_downloadedFile                 @"downloadedFile"                   // userInfo: metadata, selector, errorCode, errorDescription
+#define k_notificationCenter_downloadCancelFile             @"downloadCancelFile"               // userInfo: metadata
+
+#define k_notificationCenter_uploadStartFile                @"uploadStartFile"                  // userInfo: metadata
+#define k_notificationCenter_uploadedFile                   @"uploadedFile"                     // userInfo: metadata, ocIdTemp, errorCode, errorDescription
+#define k_notificationCenter_uploadCancelFile               @"uploadCancelFile"                 // userInfo: metadata
+
+#define k_notificationCenter_progressTask                   @"progressTask"                     // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected
+
+#define k_notificationCenter_createFolder                   @"createFolder"                     // userInfo: metadata
+#define k_notificationCenter_deleteFile                     @"deleteFile"                       // userInfo: metadata, onlyLocal
+#define k_notificationCenter_renameFile                     @"renameFile"                       // userInfo: metadata, errorCode, errorDescription
+#define k_notificationCenter_moveFile                       @"moveFile"                         // userInfo: metadata, metadataNew
+#define k_notificationCenter_copyFile                       @"copyFile"                         // userInfo: metadata, serverUrlTo
+#define k_notificationCenter_favoriteFile                   @"favoriteFile"                     // userInfo: metadata
+
+#define k_notificationCenter_menuSearchTextPDF              @"menuSearchTextPDF"
+#define k_notificationCenter_menuDownloadImage              @"menuDownloadImage"                // userInfo: metadata
+#define k_notificationCenter_menuSaveLivePhoto              @"menuSaveLivePhoto"                // userInfo: metadata, metadataMov
+#define k_notificationCenter_menuDetailClose                @"menuDetailClose"

+ 12 - 0
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -134,6 +134,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: k_notificationCenter_initializeMain), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_reloadDataSource), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSourceNetworkForced(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_reloadDataSourceNetworkForced), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(changeStatusFolderE2EE(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_changeStatusFolderE2EE), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(closeRichWorkspaceWebView), name: NSNotification.Name(rawValue: k_notificationCenter_closeRichWorkspaceWebView), object: nil)
 
@@ -265,6 +266,17 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         reloadDataSource()
     }
     
+    @objc func reloadDataSourceNetworkForced(_ notification: NSNotification) {
+        if self.view?.window == nil { return }
+        if let userInfo = notification.userInfo as NSDictionary? {
+            if let serverUrl = userInfo["serverUrl"] as? String {
+                if serverUrl == self.serverUrl {
+                    reloadDataSourceNetwork(forced: true)
+                }
+            }
+        }
+    }
+    
     @objc func changeStatusFolderE2EE(_ notification: NSNotification) {
         if self.view?.window == nil { return }
         

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

@@ -93,6 +93,7 @@ class NCViewerNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMes
     
     @objc func viewUnload() {
         
+        NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSourceNetworkForced, userInfo: ["serverUrl":metadata.serverUrl])
         navigationController?.popViewController(animated: true)
     }
     
@@ -157,7 +158,6 @@ class NCViewerNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMes
             
             if message.body as? String == "close" {
                                 
-                NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSourceNetwork, userInfo: ["serverUrl":metadata.serverUrl])
                 viewUnload()
             }