marinofaggiana 5 жил өмнө
parent
commit
5b7601f612

+ 4 - 0
iOSClient/Activity/NCActivity.swift

@@ -79,6 +79,10 @@ class NCActivity: UIViewController, DZNEmptyDataSetSource, DZNEmptyDataSetDelega
     
     // MARK: DZNEmpty
     
+    func verticalOffset(forEmptyDataSet scrollView: UIScrollView!) -> CGFloat {
+        return insets.top/2
+    }
+    
     func backgroundColor(forEmptyDataSet scrollView: UIScrollView) -> UIColor? {
         return NCBrandColor.sharedInstance.backgroundView
     }

+ 1 - 9
iOSClient/Share/NCShare.swift

@@ -75,15 +75,7 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
         networking = NCShareNetworking.init(metadata: metadata!, activeUrl: appDelegate.activeUrl, view: self.view, delegate: self)
         networking?.readShare()
     }
-    
-    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
-//        shareLinkMenuView?.unLoad()
-//        shareLinkMenuView = nil
-//        shareUserMenuView?.unLoad()
-//        shareUserMenuView = nil
-//        dropDown.hide()
-    }
-    
+        
     @objc func reloadData() {
         let shares = NCManageDatabase.sharedInstance.getTableShares(metadata: metadata!)
         if shares.firstShareLink == nil {

+ 1 - 0
iOSClient/Share/NCShareComments.swift

@@ -105,6 +105,7 @@ class NCShareComments: UIViewController, NCShareCommentsCellDelegate {
         
         guard let message = textField.text else { return }
         guard let metadata = self.metadata else { return }
+        if message.count == 0 { return }
 
         OCNetworking.sharedManager()?.putComments(withAccount: appDelegate.activeAccount, fileID: metadata.fileID, message: message, completion: { (account, message, errorCode) in
             if errorCode == 0 {

+ 3 - 0
iOSClient/Share/NCShareHeaderView.xib

@@ -37,6 +37,9 @@
                         <constraint firstAttribute="width" constant="15" id="cU5-4t-7Qf"/>
                     </constraints>
                     <state key="normal" image="favorite"/>
+                    <connections>
+                        <action selector="touchUpInsideFavorite:" destination="iN0-l3-epB" eventType="touchUpInside" id="r4F-nS-R08"/>
+                    </connections>
                 </button>
             </subviews>
             <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

+ 0 - 1
iOSClient/Share/NCShareLinkMenuView.swift

@@ -369,7 +369,6 @@ class NCShareLinkMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkin
             viewWindowCalendar?.removeFromSuperview()
             
             guard let tableShare = self.tableShare else { return }
-            guard let metadata = self.metadata else { return }
 
             dateFormatter.dateFormat = "YYYY-MM-dd"
             let expirationTime = dateFormatter.string(from: date)

+ 19 - 0
iOSClient/Share/NCSharePaging.swift

@@ -157,6 +157,7 @@ class NCSharePagingView: PagingView {
     override func setupConstraints() {
         
         let headerView = Bundle.main.loadNibNamed("NCShareHeaderView", owner: self, options: nil)?.first as! NCShareHeaderView
+        headerView.fileID = metadata!.fileID
         
         if FileManager.default.fileExists(atPath: CCUtility.getDirectoryProviderStorageIconFileID(metadata!.fileID, fileNameView: metadata!.fileNameView)) {
             headerView.imageView.image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(metadata!.fileID, fileNameView: metadata!.fileNameView))
@@ -212,4 +213,22 @@ class NCShareHeaderView: UIView {
     @IBOutlet weak var fileName: UILabel!
     @IBOutlet weak var info: UILabel!
     @IBOutlet weak var favorite: UIButton!
+    
+    var fileID = ""
+
+    @IBAction func touchUpInsideFavorite(_ sender: UIButton) {
+        
+        if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", fileID)) {
+            OCNetworking.sharedManager()?.settingFavorite(withAccount: metadata.account, fileName: metadata.fileName, favorite: !metadata.favorite, completion: { (account, message, errorCode) in
+                if errorCode == 0 {
+                    NCManageDatabase.sharedInstance.setMetadataFavorite(fileID: metadata.fileID, favorite: !metadata.favorite)
+                    if !metadata.favorite {
+                        self.favorite.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 40, height: 40, color: NCBrandColor.sharedInstance.yellowFavorite), for: .normal)
+                    } else {
+                        self.favorite.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 40, height: 40, color: NCBrandColor.sharedInstance.textInfo), for: .normal)
+                    }
+                }
+            })
+        }
+    }
 }