marinofaggiana 4 years ago
parent
commit
e5ad0dbd42

+ 9 - 5
iOSClient/CCGlobal.h

@@ -125,16 +125,20 @@
 //
 #define k_metadataStatusNormal                          0
 
+#define k_metadataStatustypeDownload                    1
+
 #define k_metadataStatusWaitDownload                    2
 #define k_metadataStatusInDownload                      3
 #define k_metadataStatusDownloading                     4
 #define k_metadataStatusDownloadError                   5
 
-#define k_metadataStatusWaitUpload                      6
-#define k_metadataStatusInUpload                        7
-#define k_metadataStatusUploading                       8
-#define k_metadataStatusUploadError                     9
-#define k_metadataStatusUploadForcedStart               10
+#define k_metadataStatusTypeUpload                      6
+
+#define k_metadataStatusWaitUpload                      7
+#define k_metadataStatusInUpload                        8
+#define k_metadataStatusUploading                       9
+#define k_metadataStatusUploadError                     10
+#define k_metadataStatusUploadForcedStart               11
 
 // Timer
 #define k_timerAutoUpload                               5

+ 7 - 3
iOSClient/Favorites/NCFavorite.swift

@@ -496,22 +496,26 @@ extension NCFavorite: UICollectionViewDataSource {
             
             cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
             
-            if metadata.status == k_metadataStatusInDownload  ||  metadata.status == k_metadataStatusInUpload {
+            if metadata.status == k_metadataStatusInDownload  ||  metadata.status >= k_metadataStatusTypeUpload {
                 (cell as! NCGridCell).progressView.isHidden = false
+                (cell as! NCGridCell).setButtonMore(named: "stop")
             } else {
                 (cell as! NCGridCell).progressView.isHidden = true
                 (cell as! NCGridCell).progressView.progress = 0.0
+                (cell as! NCGridCell).setButtonMore(named: "more")
             }
-            
+                        
         } else {
             
             cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
             
-            if metadata.status == k_metadataStatusInDownload  ||  metadata.status == k_metadataStatusInUpload {
+            if metadata.status == k_metadataStatusInDownload  ||  metadata.status >= k_metadataStatusTypeUpload {
                 (cell as! NCListCell).progressView.isHidden = false
+                (cell as! NCGridCell).setButtonMore(named: "stop")
             } else {
                 (cell as! NCListCell).progressView.isHidden = true
                 (cell as! NCListCell).progressView.progress = 0.0
+                (cell as! NCGridCell).setButtonMore(named: "more")
             }
         }
         

+ 9 - 4
iOSClient/Main/Cell/NCGridCell.swift

@@ -43,22 +43,22 @@ class NCGridCell: UICollectionViewCell, NCImageCellProtocol {
          return imageItem
         }
     }
-
     
     var delegate: NCGridCellDelegate?
-    
     var objectId = ""
     var indexPath = IndexPath()
+    var namedButtonMore = ""
     
     override func awakeFromNib() {
         super.awakeFromNib()
-       
-        buttonMore.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), width: 50, height: 50, color: NCBrandColor.sharedInstance.optionItem), for: UIControl.State.normal)
+        
         imageItem.layer.cornerRadius = 6
         imageItem.layer.masksToBounds = true
         
         progressView.tintColor = NCBrandColor.sharedInstance.brandElement
         progressView.transform = CGAffineTransform(scaleX: 1, y: 1)
+        
+        setButtonMore(named: "more")
     }
     
     override func prepareForReuse() {
@@ -69,6 +69,11 @@ class NCGridCell: UICollectionViewCell, NCImageCellProtocol {
     @IBAction func touchUpInsideMore(_ sender: Any) {
         delegate?.tapMoreGridItem(with: objectId, sender: sender)
     }
+    
+    func setButtonMore(named: String) {
+        namedButtonMore = named
+        buttonMore.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: named), width: 50, height: 50, color: NCBrandColor.sharedInstance.optionItem), for: UIControl.State.normal)
+    }
 }
 
 protocol NCGridCellDelegate {

+ 8 - 2
iOSClient/Main/Cell/NCListCell.swift

@@ -55,14 +55,13 @@ class NCListCell: UICollectionViewCell, NCImageCellProtocol {
     }
 
     var delegate: NCListCellDelegate?
-    
     var objectId = ""
     var indexPath = IndexPath()
+    var namedButtonMore = ""
 
     override func awakeFromNib() {
         super.awakeFromNib()
        
-        imageMore.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), width: 50, height: 50, color: NCBrandColor.sharedInstance.optionItem)
         separator.backgroundColor = NCBrandColor.sharedInstance.separator
         imageItem.layer.cornerRadius = 6
         imageItem.layer.masksToBounds = true
@@ -70,6 +69,8 @@ class NCListCell: UICollectionViewCell, NCImageCellProtocol {
         progressView.tintColor = NCBrandColor.sharedInstance.brandElement
         progressView.transform = CGAffineTransform(scaleX: 1, y: 1)
         separator.backgroundColor = NCBrandColor.sharedInstance.separator
+        
+        setButtonMore(named: "more")
     }
     
     override func prepareForReuse() {
@@ -84,6 +85,11 @@ class NCListCell: UICollectionViewCell, NCImageCellProtocol {
     @IBAction func touchUpInsideMore(_ sender: Any) {
         delegate?.tapMoreListItem(with: objectId, sender: sender)
     }
+    
+    func setButtonMore(named: String) {
+        namedButtonMore = named
+        buttonMore.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: named), width: 50, height: 50, color: NCBrandColor.sharedInstance.optionItem), for: UIControl.State.normal)
+    }
 }
 
 protocol NCListCellDelegate {