marinofaggiana vor 5 Jahren
Ursprung
Commit
2ba96bb364

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

@@ -107,6 +107,9 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
             
             let metadata = metadatasConflict[indexPath.row]
             
+            cell.fileId = metadata.fileId
+            cell.delegate = self
+            
             if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: metadata.fileName)) {
                 NCUtility.sharedInstance.loadImage(ocId: metadata.ocId, fileNameView: metadata.fileNameView) { (image) in
                     cell.imageFile.image = image
@@ -130,3 +133,16 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
         return UITableViewCell()
     }
 }
+
+// MARK: - NCCreateFormUploadConflictCellDelegate
+
+extension NCCreateFormUploadConflict: NCCreateFormUploadConflictCellDelegate {
+    func valueChangedSwitchNewFile(with fileId: String, sender: Any) {
+        
+    }
+    
+    func valueChangedSwitchAlreadyExistingFile(with fileId: String, sender: Any) {
+        
+    }
+}
+

+ 19 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadConflictCell.swift

@@ -32,4 +32,23 @@ class NCCreateFormUploadConflictCell: UITableViewCell {
 
     @IBOutlet weak var switchNewFile: UISwitch!
     @IBOutlet weak var switchAlreadyExistingFile: UISwitch!
+    
+    var delegate: NCCreateFormUploadConflictCellDelegate?
+    var fileId: String = ""
+
+    @IBAction func valueChangedSwitchNewFile(_ sender: Any) {
+        delegate?.valueChangedSwitchNewFile(with: fileId, sender: sender)
+    }
+    
+    @IBAction func valueChangedSwitchAlreadyExistingFile(_ sender: Any) {
+        delegate?.valueChangedSwitchAlreadyExistingFile(with: fileId, sender: sender)
+    }
+    
+}
+
+protocol NCCreateFormUploadConflictCellDelegate {
+    
+    func valueChangedSwitchNewFile(with fileId: String, sender: Any)
+    func valueChangedSwitchAlreadyExistingFile(with fileId: String, sender: Any)
+
 }

+ 6 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadConflictCell.xib

@@ -31,9 +31,15 @@
                     </label>
                     <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FUL-4V-OgL">
                         <rect key="frame" x="5" y="96" width="51" height="31"/>
+                        <connections>
+                            <action selector="valueChangedSwitchNewFile:" destination="eGO-5i-ez1" eventType="valueChanged" id="s5p-Ao-3Ty"/>
+                        </connections>
                     </switch>
                     <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jBi-8r-tc5">
                         <rect key="frame" x="587" y="96" width="51" height="31"/>
+                        <connections>
+                            <action selector="valueChangedSwitchAlreadyExistingFile:" destination="eGO-5i-ez1" eventType="valueChanged" id="MVS-Uv-X6e"/>
+                        </connections>
                     </switch>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0hq-re-YVn">
                         <rect key="frame" x="65" y="34.5" width="571" height="18"/>