Marino Faggiana 6 年之前
父节点
当前提交
5609741af9
共有 3 个文件被更改,包括 19 次插入15 次删除
  1. 5 1
      iOSClient/Create/CCCreateCloud.swift
  2. 4 3
      iOSClient/Scan/Scan.storyboard
  3. 10 11
      iOSClient/Scan/ScanCollectionView.swift

+ 5 - 1
iOSClient/Create/CCCreateCloud.swift

@@ -704,13 +704,17 @@ class NCCreateScanDocument : NSObject, ImageScannerControllerDelegate {
             return
         }
         
-        let fileName = CCUtility.createFileName("scan", fileDate: Date(), fileType: PHAssetMediaType.image, keyFileName: k_keyFileNameMask, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)!
+        let fileName = CCUtility.createFileName("scan.png", fileDate: Date(), fileType: PHAssetMediaType.image, keyFileName: k_keyFileNameMask, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)!
         let fileNamePath = CCUtility.getDirectoryPDFGenerator() + "/" + fileName
         
         do {
             try UIImagePNGRepresentation(image)?.write(to: NSURL.fileURL(withPath: fileNamePath), options: .atomic)
         } catch { }
         
+        let storyboard = UIStoryboard(name: "Scan", bundle: nil)
+        let controller = storyboard.instantiateInitialViewController()! //(withIdentifier: "ScanNC")
+        controller.modalPresentationStyle = UIModalPresentationStyle.pageSheet
+        appDelegate.activeMain.present(controller, animated: true, completion: nil)
         
         
         //        let imageData = UIImageJPEGRepresentation(imageBN, 0.8)!

+ 4 - 3
iOSClient/Scan/Scan.storyboard

@@ -31,7 +31,7 @@
                                     <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
                                 </collectionViewFlowLayout>
                                 <cells>
-                                    <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell1" id="Lca-vD-NY2" customClass="DragDropCollectionViewCell" customModule="Nextcloud" customModuleProvider="target">
+                                    <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell1" id="Lca-vD-NY2" customClass="ScanCell" customModule="Nextcloud" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="2" width="171" height="171"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
@@ -105,14 +105,14 @@
                                     <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
                                 </collectionViewFlowLayout>
                                 <cells>
-                                    <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell2" id="Pph-tY-PGX" customClass="DragDropCollectionViewCell" customModule="Nextcloud" customModuleProvider="target">
+                                    <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell2" id="Pph-tY-PGX" customClass="ScanCell" customModule="Nextcloud" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
                                             <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
-                                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sdV-W7-Hkd">
+                                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chrome" translatesAutoresizingMaskIntoConstraints="NO" id="sdV-W7-Hkd">
                                                     <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
                                                 </imageView>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="False Color" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wcM-U8-GLh">
@@ -206,6 +206,7 @@
         </scene>
     </scenes>
     <resources>
+        <image name="chrome" width="738" height="738"/>
         <image name="pin" width="600" height="564"/>
     </resources>
 </document>

+ 10 - 11
iOSClient/Scan/ScanCollectionView.swift

@@ -1,10 +1,4 @@
 //
-//  DragDropViewController.swift
-//  DragAndDropInCollectionView
-//
-//  Created by Payal Gupta on 06/11/17.
-//  Copyright © 2017 Payal Gupta. All rights reserved.
-//
 
 import UIKit
 
@@ -45,8 +39,8 @@ class DragDropViewController: UIViewController
     private func loadImage() {
         do {
             let directoryContents = try FileManager.default.contentsOfDirectory(atPath: CCUtility.getDirectoryPDFGenerator()!)
-            for x in directoryContents {
-                
+            for fileName in directoryContents {
+                items1.append(fileName)
             }
         }
         catch {
@@ -54,7 +48,6 @@ class DragDropViewController: UIViewController
         }
     }
     
-    
     //MARK: Private Methods
     
     /// This method moves a cell from source indexPath to destination indexPath within the same collection view. It works for only 1 item. If multiple items selected, no reordering happens.
@@ -135,14 +128,20 @@ extension DragDropViewController : UICollectionViewDataSource
         if collectionView == self.collectionView1
         {
             let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell1", for: indexPath) as! ScanCell
-            cell.customImageView?.image = UIImage(named: self.items1[indexPath.row])
+            
+            let fileNamePath = CCUtility.getDirectoryPDFGenerator() + "/" + self.items1[indexPath.row]
+            let data = try? Data(contentsOf: fileNamePath.url)
+            cell.customImageView?.image = UIImage(data: data!)
             cell.customLabel.text = self.items1[indexPath.row].capitalized
             return cell
         }
         else
         {
             let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell2", for: indexPath) as! ScanCell
-            cell.customImageView?.image = UIImage(named: self.items2[indexPath.row])
+            
+            let fileNamePath = CCUtility.getDirectoryPDFGenerator() + "/" + self.items2[indexPath.row]
+            let data = try? Data(contentsOf: fileNamePath.url)
+            cell.customImageView?.image = UIImage(data: data!)
             cell.customLabel.text = self.items2[indexPath.row].capitalized
             return cell
         }