Marino Faggiana 6 years ago
parent
commit
b68a39de0f

+ 0 - 21
iOSClient/Images.xcassets/deleteImagePage.imageset/Contents.json

@@ -1,21 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "deleteImagePage@2x.png",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
iOSClient/Images.xcassets/deleteImagePage.imageset/deleteImagePage@2x.png


+ 3 - 3
iOSClient/Scan/Scan.storyboard

@@ -44,7 +44,7 @@
                                                 <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="06r-jm-ARX">
                                                     <rect key="frame" x="0.0" y="0.0" width="25" height="25"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                                    <state key="normal" backgroundImage="deleteImagePage"/>
+                                                    <state key="normal" backgroundImage="no_red"/>
                                                 </button>
                                             </subviews>
                                         </view>
@@ -98,7 +98,7 @@
                                                 <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wSg-Gm-0s3">
                                                     <rect key="frame" x="0.0" y="0.0" width="25" height="25"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                                    <state key="normal" backgroundImage="deleteImagePage"/>
+                                                    <state key="normal" backgroundImage="no_red"/>
                                                 </button>
                                             </subviews>
                                         </view>
@@ -212,6 +212,6 @@
     </scenes>
     <resources>
         <image name="add" width="25" height="25"/>
-        <image name="deleteImagePage" width="25" height="25"/>
+        <image name="no_red" width="25" height="25"/>
     </resources>
 </document>

+ 6 - 0
iOSClient/Scan/ScanCollectionView.swift

@@ -73,6 +73,8 @@ class DragDropViewController: UIViewController {
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
         
+        itemsSource.removeAll()
+
         appDelegate.aspectNavigationControllerBar(self.navigationController?.navigationBar, online: appDelegate.reachability.isReachable(), hidden: false)
         appDelegate.aspectTabBar(self.tabBarController?.tabBar, hidden: false)
         
@@ -247,6 +249,7 @@ extension DragDropViewController : UICollectionViewDataSource {
             }
             
             cell.customImageView?.image = UIImage(data: data)
+            cell.delete.setImage(CCGraphics.changeThemingColorImage(UIImage(named: "no_red"), multiplier:2, color: NCBrandColor.sharedInstance.icon).withRenderingMode(.alwaysOriginal), for: .normal)
             cell.delete.addTarget(self, action: #selector(deleteSource(_:)), for: .touchUpInside)
 
             return cell
@@ -267,6 +270,7 @@ extension DragDropViewController : UICollectionViewDataSource {
             
             cell.customImageView?.image = self.filter(image: image)
             cell.customLabel.text = NSLocalizedString("_scan_document_pdf_page_", comment: "") + " " + "\(indexPath.row+1)"
+            cell.delete.setImage(CCGraphics.changeThemingColorImage(UIImage(named: "no_red"), multiplier:2, color: NCBrandColor.sharedInstance.icon).withRenderingMode(.alwaysOriginal), for: .normal)
             cell.delete.addTarget(self, action: #selector(deleteDestination(_:)), for: .touchUpInside)
             
             return cell
@@ -278,6 +282,8 @@ extension DragDropViewController : UICollectionViewDataSource {
         let buttonPosition:CGPoint =  sender.convert(.zero, to: self.collectionViewSource)
         let indexPath:IndexPath = self.collectionViewSource.indexPathForItem(at: buttonPosition)!
         
+        let fileNameAtPath = CCUtility.getDirectoryScan() + "/" + self.itemsSource[indexPath.row]
+        CCUtility.removeFile(atPath: fileNameAtPath)
         self.itemsSource.remove(at: indexPath.row)
         
         self.collectionViewSource.reloadData()