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

+ 6 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.storyboard

@@ -93,6 +93,9 @@
                                         <state key="normal" title="Cancel">
                                             <color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         </state>
+                                        <connections>
+                                            <action selector="buttonCancelTouch:" destination="30l-Wp-khL" eventType="touchUpInside" id="k3H-hT-Lbm"/>
+                                        </connections>
                                     </button>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RU9-v6-zSl">
                                         <rect key="frame" x="264" y="5" width="120" height="40"/>
@@ -103,6 +106,9 @@
                                         <state key="normal" title="Continue">
                                             <color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         </state>
+                                        <connections>
+                                            <action selector="buttonContinueTouch:" destination="30l-Wp-khL" eventType="touchUpInside" id="iQq-LC-PSc"/>
+                                        </connections>
                                     </button>
                                 </subviews>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>

+ 34 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -80,6 +80,7 @@ import Foundation
         buttonContinue.layer.masksToBounds = true
         buttonContinue.setTitle(NSLocalizedString("_continue_", comment: ""), for: .normal)
         buttonContinue.isEnabled = false
+        buttonContinue.setTitleColor(.lightGray, for: .normal)
         buttonContinue.layer.backgroundColor = NCBrandColor.sharedInstance.graySoft.withAlphaComponent(0.5).cgColor
     }
     
@@ -93,6 +94,8 @@ import Foundation
         }
         
         tableView.reloadData()
+        
+        canContinue()
     }
     
     @IBAction func valueChangedSwitchAlreadyExistingFiles(_ sender: Any) {
@@ -105,6 +108,16 @@ import Foundation
         }
         
         tableView.reloadData()
+        
+        canContinue()
+    }
+    
+    @IBAction func buttonCancelTouch(_ sender: Any) {
+        dismiss(animated: true)
+    }
+    
+    @IBAction func buttonContinueTouch(_ sender: Any) {
+        
     }
 }
 
@@ -188,6 +201,8 @@ extension NCCreateFormUploadConflict: NCCreateFormUploadConflictCellDelegate {
         } else {
             switchNewFiles.isOn = false
         }
+        
+        canContinue()
     }
     
     func valueChangedSwitchAlreadyExistingFile(with ocId: String, isOn: Bool) {
@@ -202,6 +217,25 @@ extension NCCreateFormUploadConflict: NCCreateFormUploadConflictCellDelegate {
         } else {
             switchAlreadyExistingFiles.isOn = false
         }
+        
+        canContinue()
+    }
+    
+    func canContinue() {
+        var result = true
+        for metadata in metadatasConflict {
+            if metadatasConflictNewFiles.contains(metadata.ocId) == false && metadatasConflictAlreadyExistingFiles.contains(metadata.ocId) {
+                result = false
+            }
+        }
+        
+        if result {
+            buttonContinue.isEnabled = true
+            buttonContinue.setTitleColor(.black, for: .normal)
+        } else {
+            buttonContinue.isEnabled = false
+            buttonContinue.setTitleColor(.lightGray, for: .normal)
+        }
     }
 }