Browse Source

fix share_reshare_restricted

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
fffc007eab
1 changed files with 11 additions and 6 deletions
  1. 11 6
      iOSClient/Main/NCFunctionCenter.swift

+ 11 - 6
iOSClient/Main/NCFunctionCenter.swift

@@ -178,14 +178,19 @@ import Photos
 
     func openShare(viewController: UIViewController, metadata: tableMetadata, indexPage: NCGlobal.NCSharePagingIndex) {
 
-        let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController
-        let shareViewController = shareNavigationController.topViewController as! NCSharePaging
+        let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
+        NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, queue: .main) { account, metadata, errorCode, errorDescription in
+            if let metadata = metadata, errorCode == 0 {
+                let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController
+                let shareViewController = shareNavigationController.topViewController as! NCSharePaging
 
-        shareViewController.metadata = metadata
-        shareViewController.indexPage = indexPage
+                shareViewController.metadata = metadata
+                shareViewController.indexPage = indexPage
 
-        shareNavigationController.modalPresentationStyle = .formSheet
-        viewController.present(shareNavigationController, animated: true, completion: nil)
+                shareNavigationController.modalPresentationStyle = .formSheet
+                viewController.present(shareNavigationController, animated: true, completion: nil)
+            }
+        }
     }
 
     // MARK: -