Browse Source

new share view

marinofaggiana 5 years ago
parent
commit
389d668699
2 changed files with 18 additions and 0 deletions
  1. 4 0
      iOSClient/Share/NCShare.swift
  2. 14 0
      iOSClient/Share/NCShareNetworking.swift

+ 4 - 0
iOSClient/Share/NCShare.swift

@@ -68,6 +68,7 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
         
         let networking = NCShareNetworking.init(account: metadata!.account, activeUrl: appDelegate.activeUrl, view: nil, delegate: self)
         networking.readShare()
+        networking.readShare(path: CCUtility.returnFileNamePath(fromFileName: metadata?.fileName, serverUrl: metadata?.serverUrl, activeUrl: appDelegate.activeUrl))
     }
     
     override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
@@ -296,6 +297,9 @@ extension NCShare: UITableViewDataSource {
                 if tableShare.uidOwner != self.appDelegate.activeUserID && tableShare.uidFileOwner != self.appDelegate.activeUserID {
                     cell.selectionStyle = .none
                     cell.isUserInteractionEnabled = false
+                    cell.switchCanEdit.isHidden = true
+                    cell.labelCanEdit.isHidden = true
+                    cell.buttonMenu.isHidden = true
                 }
                 
                 return cell

+ 14 - 0
iOSClient/Share/NCShareNetworking.swift

@@ -54,6 +54,20 @@ class NCShareNetworking: NSObject {
         })
     }
     
+    func readShare(path: String) {
+        NCUtility.sharedInstance.startActivityIndicator(view: view, bottom: 0)
+        OCNetworking.sharedManager()?.readShare(withAccount: self.account, path: path, completion: { (account, items, message, errorCode) in
+            NCUtility.sharedInstance.stopActivityIndicator()
+            if errorCode == 0 {
+                let itemsOCSharedDto = items as! [OCSharedDto]
+                NCManageDatabase.sharedInstance.addShare(account: self.account, activeUrl: self.activeUrl, items: itemsOCSharedDto)
+            } else {
+                self.appDelegate.messageNotification("_share_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            }
+            self.delegate?.readShareCompleted()
+        })
+    }
+    
     func share(metadata: tableMetadata, password: String, permission: Int, hideDownload: Bool) {
         NCUtility.sharedInstance.startActivityIndicator(view: view, bottom: 0)
         let fileName = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, activeUrl: activeUrl)!