marinofaggiana 4 年之前
父節點
當前提交
b2cb96c740

+ 1 - 0
iOSClient/AppDelegate.h

@@ -106,6 +106,7 @@
 
 // Shares
 @property (nonatomic, strong) NSArray *shares;
+@property BOOL disableSharesView;
 
 // UserDefaults
 @property (nonatomic, strong) NSUserDefaults *ncUserDefaults;

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

@@ -1512,6 +1512,11 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
                 cell.selectMode(false)
             }
             
+            // Disable Share Button
+            if appDelegate.disableSharesView {
+                cell.hideButtonShare(true)
+            }
+            
             return cell
         }
         

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

@@ -124,7 +124,7 @@ extension NCCollectionViewCommon {
         //
         // DETAIL
         //
-        if !isFolderEncrypted {
+        if !isFolderEncrypted && !appDelegate.disableSharesView {
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_details_", comment: ""),

+ 10 - 8
iOSClient/Main/Menu/NCViewer+Menu.swift

@@ -84,15 +84,17 @@ extension NCViewer {
         //
         // DETAIL
         //
-        actions.append(
-            NCMenuAction(
-                title: NSLocalizedString("_details_", comment: ""),
-                icon: CCGraphics.changeThemingColorImage(UIImage(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                action: { menuAction in
-                    NCNetworkingNotificationCenter.shared.openShare(ViewController: viewController, metadata: metadata, indexPage: 0)
-                }
+        if !appDelegate.disableSharesView {
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_details_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        NCNetworkingNotificationCenter.shared.openShare(ViewController: viewController, metadata: metadata, indexPage: 0)
+                    }
+                )
             )
-        )
+        }
         
         //
         // OPEN IN

+ 9 - 1
iOSClient/Networking/NCService.swift

@@ -184,6 +184,15 @@ class NCService: NSObject {
                             }
                         }
                     }
+                    
+                    let comments = NCManageDatabase.sharedInstance.getCapabilitiesServerBool(account: account, elements: NCElementsJSON.shared.capabilitiesFilesComments, exists: false)
+                    let activity = NCManageDatabase.sharedInstance.getCapabilitiesServerArray(account: account, elements: NCElementsJSON.shared.capabilitiesActivity)
+                    
+                    if !isFilesSharingEnabled && !comments && activity == nil {
+                        self.appDelegate.disableSharesView = true
+                    } else {
+                        self.appDelegate.disableSharesView = false
+                    }
                 
                     // Text direct editor detail
                     let serverVersionMajor = NCManageDatabase.sharedInstance.getCapabilitiesServerInt(account: account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
@@ -239,7 +248,6 @@ class NCService: NSObject {
                     if (isHandwerkcloudEnabled) {
                         self.requestHC()
                     }
-                    
                 }
                 
             } else if errorCode != 0 {

+ 6 - 2
iOSClient/Share/NCShare.swift

@@ -46,8 +46,10 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
     
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
-    var metadata: tableMetadata?
+    public var metadata: tableMetadata?
+    public var sharingEnabled = true
     public var height: CGFloat = 0
+    
     private var shareLinkMenuView: NCShareLinkMenuView?
     private var shareUserMenuView: NCShareUserMenuView?
     private var shareMenuViewWindow: UIView?
@@ -106,7 +108,9 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
         reloadData()
         
         networking = NCShareNetworking.init(metadata: metadata!, urlBase: appDelegate.urlBase, view: self.view, delegate: self)
-        networking?.readShare()
+        if sharingEnabled {
+            networking?.readShare()
+        }
         
         // changeTheming
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)

+ 1 - 0
iOSClient/Share/NCSharePaging.swift

@@ -169,6 +169,7 @@ extension NCSharePaging: PagingViewControllerDataSource {
             return viewController
         case 2:
             let viewController = UIStoryboard(name: "NCShare", bundle: nil).instantiateViewController(withIdentifier: "sharing") as! NCShare
+            viewController.sharingEnabled = sharingEnabled
             viewController.metadata = metadata
             viewController.height = height
             return viewController