marinofaggiana 4 vuotta sitten
vanhempi
commit
15ea39ef14

+ 2 - 0
iOSClient/CCGlobal.h

@@ -313,6 +313,8 @@
 #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_mediaFileNotFound          @"mediaFileNotFound"                // userInfo: metadata
 #define k_notificationCenter_changeStatusFolderE2EE     @"changeStatusFolderE2EE"           // userInfo: serverUrl

+ 9 - 2
iOSClient/Main/NCCollectionViewCommon.swift

@@ -136,6 +136,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         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(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)
 
         NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
@@ -256,6 +257,12 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         reloadDataSource()
     }
     
+    @objc func closeRichWorkspaceWebView(_ notification: NSNotification) {
+        if self.view?.window == nil { return }
+        
+        reloadDataSourceNetwork()
+    }
+    
     @objc func deleteFile(_ notification: NSNotification) {
         if self.view?.window == nil { return }
         
@@ -263,9 +270,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             if let metadata = userInfo["metadata"] as? tableMetadata, let onlyLocal = userInfo["onlyLocal"] as? Bool {
                 
                 if onlyLocal {
-                   reloadDataSource()
+                    reloadDataSource()
                 } else if metadata.fileNameView.lowercased() == k_fileNameRichWorkspace.lowercased() {
-                    self.reloadDataSourceNetwork(forced: true)
+                    reloadDataSourceNetwork()
                 } else {
                     if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
                         let indexPath = IndexPath(row: row, section: 0)

+ 4 - 1
iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift

@@ -75,7 +75,10 @@ class NCViewerRichWorkspaceWebView: UIViewController, WKNavigationDelegate, WKSc
                 if #available(iOS 13.0, *) {
                     self.presentationController?.delegate?.presentationControllerWillDismiss?(self.presentationController!)
                 }
-                dismiss(animated: true)
+                
+                dismiss(animated: true) {
+                    NotificationCenter.default.postOnMainThread(name: k_notificationCenter_closeRichWorkspaceWebView, userInfo: nil)
+                }
             }
             
             if message.body as? String == "share" {