diff --git a/MiniScanner.xcodeproj/project.pbxproj b/MiniScanner.xcodeproj/project.pbxproj index e12a7273305884e9c149be1fb2e895421d0b94d6..8d84442290ed3438c672ee64742fb323e2c5a519 100644 --- a/MiniScanner.xcodeproj/project.pbxproj +++ b/MiniScanner.xcodeproj/project.pbxproj @@ -126,6 +126,10 @@ 539D1C982C1713AC009DB24A /* LNExtensionExecutor in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 539D1C962C171344009DB24A /* LNExtensionExecutor */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 53BAE0ED2C15E0890072189E /* EditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53BAE0EB2C15E0890072189E /* EditViewController.swift */; }; 53BAE0EE2C15E0890072189E /* EditViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53BAE0EC2C15E0890072189E /* EditViewController.xib */; }; + 53BEB1422C2967E0005A3567 /* FoldersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53BEB1402C2967E0005A3567 /* FoldersViewController.swift */; }; + 53BEB1432C2967E0005A3567 /* FoldersViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53BEB1412C2967E0005A3567 /* FoldersViewController.xib */; }; + 53BEB1472C2968F8005A3567 /* FolderSelectCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53BEB1452C2968F8005A3567 /* FolderSelectCollectionViewCell.swift */; }; + 53BEB1482C2968F8005A3567 /* FolderSelectCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53BEB1462C2968F8005A3567 /* FolderSelectCollectionViewCell.xib */; }; 53CD5F532C15022E0010424B /* KNAlertViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53CD5F512C15022E0010424B /* KNAlertViewController.xib */; }; 53CD5F542C15022E0010424B /* KNAlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CD5F522C15022E0010424B /* KNAlertViewController.swift */; }; 53CD5F562C1503150010424B /* BMViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CD5F552C1503150010424B /* BMViewController.swift */; }; @@ -348,6 +352,10 @@ 539D1C8A2C16E97F009DB24A /* ShareSheetViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ShareSheetViewController.xib; sourceTree = "<group>"; }; 53BAE0EB2C15E0890072189E /* EditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditViewController.swift; sourceTree = "<group>"; }; 53BAE0EC2C15E0890072189E /* EditViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EditViewController.xib; sourceTree = "<group>"; }; + 53BEB1402C2967E0005A3567 /* FoldersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoldersViewController.swift; sourceTree = "<group>"; }; + 53BEB1412C2967E0005A3567 /* FoldersViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FoldersViewController.xib; sourceTree = "<group>"; }; + 53BEB1452C2968F8005A3567 /* FolderSelectCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderSelectCollectionViewCell.swift; sourceTree = "<group>"; }; + 53BEB1462C2968F8005A3567 /* FolderSelectCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FolderSelectCollectionViewCell.xib; sourceTree = "<group>"; }; 53CD5F512C15022E0010424B /* KNAlertViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KNAlertViewController.xib; sourceTree = "<group>"; }; 53CD5F522C15022E0010424B /* KNAlertViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KNAlertViewController.swift; sourceTree = "<group>"; }; 53CD5F552C1503150010424B /* BMViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMViewController.swift; sourceTree = "<group>"; }; @@ -745,6 +753,25 @@ path = EditViewController; sourceTree = "<group>"; }; + 53BEB13F2C2967CC005A3567 /* FoldersViewController */ = { + isa = PBXGroup; + children = ( + 53BEB1442C2968A0005A3567 /* CustomCells */, + 53BEB1402C2967E0005A3567 /* FoldersViewController.swift */, + 53BEB1412C2967E0005A3567 /* FoldersViewController.xib */, + ); + path = FoldersViewController; + sourceTree = "<group>"; + }; + 53BEB1442C2968A0005A3567 /* CustomCells */ = { + isa = PBXGroup; + children = ( + 53BEB1452C2968F8005A3567 /* FolderSelectCollectionViewCell.swift */, + 53BEB1462C2968F8005A3567 /* FolderSelectCollectionViewCell.xib */, + ); + path = CustomCells; + sourceTree = "<group>"; + }; 53CD5F502C15022E0010424B /* KNAlert */ = { isa = PBXGroup; children = ( @@ -920,6 +947,7 @@ EC8A9B06254DC2EE00F9AF99 /* Documents */ = { isa = PBXGroup; children = ( + 53BEB13F2C2967CC005A3567 /* FoldersViewController */, 5359841C2C14B816003EB6ED /* CustomViews */, 53F21F862C12468900172BFC /* CustomCells */, EC8A9B1C254DCEC600F9AF99 /* File.swift */, @@ -1105,6 +1133,7 @@ 53F21FA12C1377B900172BFC /* Tajawal-Black.ttf in Resources */, 53F21F8C2C1246AF00172BFC /* AllFolderTableViewCell.xib in Resources */, 53F21FA02C1377B900172BFC /* Tajawal-Medium.ttf in Resources */, + 53BEB1432C2967E0005A3567 /* FoldersViewController.xib in Resources */, 53014FAC2C11A8E80071CE39 /* rotate@3x.png in Resources */, 535984112C145083003EB6ED /* Poppins-Regular.ttf in Resources */, 53CD5F532C15022E0010424B /* KNAlertViewController.xib in Resources */, @@ -1125,6 +1154,7 @@ 53014FB22C11A8E80071CE39 /* flashUnavailable@3x.png in Resources */, 53BAE0EE2C15E0890072189E /* EditViewController.xib in Resources */, 53014FAF2C11A8E80071CE39 /* flash@2x.png in Resources */, + 53BEB1482C2968F8005A3567 /* FolderSelectCollectionViewCell.xib in Resources */, 53F21F9F2C1377B900172BFC /* Tajawal-Regular.ttf in Resources */, 53014FB12C11A8E80071CE39 /* flashUnavailable.png in Resources */, 53014F8D2C11A8E80071CE39 /* Localizable.strings in Resources */, @@ -1226,6 +1256,7 @@ 53E7D33B2C1B00880025A1D3 /* FSPagerViewObjcCompat.m in Sources */, EC702537254E1DE000BE1958 /* UIViewController+Extensions.swift in Sources */, 535983E92C1428D4003EB6ED /* UIColor+Extensions.swift in Sources */, + 53BEB1472C2968F8005A3567 /* FolderSelectCollectionViewCell.swift in Sources */, 539996972C27130000671340 /* ConstraintMakerEditable.swift in Sources */, 539996A02C27130000671340 /* LayoutConstraint.swift in Sources */, 53014F972C11A8E80071CE39 /* AVCaptureVideoOrientation+Utils.swift in Sources */, @@ -1235,6 +1266,7 @@ 539996902C27130000671340 /* UILayoutSupport+Extensions.swift in Sources */, 53014F992C11A8E80071CE39 /* CGPoint+Utils.swift in Sources */, 53E7D3392C1B00880025A1D3 /* FSPageViewLayout.swift in Sources */, + 53BEB1422C2967E0005A3567 /* FoldersViewController.swift in Sources */, 53014FA62C11A8E80071CE39 /* Error.swift in Sources */, 53014FA72C11A8E80071CE39 /* VisionRectangleDetector.swift in Sources */, 53BAE0ED2C15E0890072189E /* EditViewController.swift in Sources */, diff --git a/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate b/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate index 2d1d43ef753c3ff1fb811355bc21d6c8fc1fb1a5..4edfe2a03a66e009feb700d877ee697c4199ab6c 100644 Binary files a/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate and b/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 216ee44a169a423c337b1cc8c733a132117605a0..338e54539d97191c4c802184c4f7a9ce89dae6a6 100644 --- a/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -3,4 +3,38 @@ uuid = "270C854E-19C5-4254-A77F-7774BFB2FDA6" type = "0" version = "2.0"> + <Breakpoints> + <BreakpointProxy + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> + <BreakpointContent + uuid = "4E444672-FB4E-4DEC-B2D5-635B3D9E1DC5" + shouldBeEnabled = "Yes" + ignoreCount = "0" + continueAfterRunningActions = "No" + filePath = "MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.swift" + startingColumnNumber = "9223372036854775807" + endingColumnNumber = "9223372036854775807" + startingLineNumber = "47" + endingLineNumber = "47" + landmarkName = "collectionView(_:cellForItemAt:)" + landmarkType = "7"> + </BreakpointContent> + </BreakpointProxy> + <BreakpointProxy + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> + <BreakpointContent + uuid = "80A1F694-1CE3-4C25-8DC7-1DDB8615DBF4" + shouldBeEnabled = "Yes" + ignoreCount = "0" + continueAfterRunningActions = "No" + filePath = "MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.swift" + startingColumnNumber = "9223372036854775807" + endingColumnNumber = "9223372036854775807" + startingLineNumber = "48" + endingLineNumber = "48" + landmarkName = "collectionView(_:cellForItemAt:)" + landmarkType = "7"> + </BreakpointContent> + </BreakpointProxy> + </Breakpoints> </Bucket> diff --git a/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift b/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift index f13ef36d87ba70ed8427267854e7ba00626b8a14..64374608674881acdd940dbf2df2111ec09a76d0 100644 --- a/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift +++ b/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift @@ -108,8 +108,5 @@ extension AllFolderTableViewCell: UICollectionViewDelegate, UICollectionViewData } folders[indexPath.row].isSelected = true delegate?.cellTapped(folder: folders[indexPath.row]) - } - - } diff --git a/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/CustomCells/FolderCollectionViewCell.xib b/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/CustomCells/FolderCollectionViewCell.xib index e47425ebd62723e07983b268e2c93f4dd73e7fe8..9eddf76d07a537e8bd0516e2d6f7a98b773f61f6 100644 --- a/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/CustomCells/FolderCollectionViewCell.xib +++ b/MiniScanner/Modules/Documents/CustomViews/AllFolderTableView/CustomCells/FolderCollectionViewCell.xib @@ -12,23 +12,23 @@ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="FolderCollectionViewCell" id="gTV-IL-0wX" customClass="FolderCollectionViewCell" customModule="MiniScanner" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="218" height="51"/> + <rect key="frame" x="0.0" y="0.0" width="218" height="117"/> <autoresizingMask key="autoresizingMask"/> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="218" height="51"/> + <rect key="frame" x="0.0" y="0.0" width="218" height="117"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yLC-Fk-FwR"> - <rect key="frame" x="5" y="5" width="208" height="41"/> + <rect key="frame" x="5" y="5" width="208" height="107"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D7K-ZB-UlJ"> - <rect key="frame" x="50" y="5" width="153" height="31"/> + <rect key="frame" x="50" y="5" width="153" height="97"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="folder.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="Yfc-8h-AJQ"> - <rect key="frame" x="20" y="12.33333333333333" width="20" height="17.000000000000007"/> + <rect key="frame" x="20" y="45.333333333333329" width="20" height="17.000000000000007"/> <constraints> <constraint firstAttribute="width" constant="20" id="EHi-ns-gJn"/> <constraint firstAttribute="height" constant="20" id="coK-nt-C2h"/> @@ -55,12 +55,12 @@ <constraint firstItem="yLC-Fk-FwR" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="5" id="mKT-ym-FYc"/> <constraint firstAttribute="bottom" secondItem="yLC-Fk-FwR" secondAttribute="bottom" constant="5" id="xkr-S4-MSG"/> </constraints> - <size key="customSize" width="218" height="51"/> + <size key="customSize" width="218" height="117"/> <connections> <outlet property="boxView" destination="yLC-Fk-FwR" id="fP8-gO-B1P"/> <outlet property="titleLabel" destination="D7K-ZB-UlJ" id="ymJ-OO-6sG"/> </connections> - <point key="canvasLocation" x="174.04580152671755" y="61.619718309859159"/> + <point key="canvasLocation" x="174.04580152671755" y="84.859154929577471"/> </collectionViewCell> </objects> <resources> diff --git a/MiniScanner/Modules/Documents/CustomViews/KNAlert/KNAlertViewController.swift b/MiniScanner/Modules/Documents/CustomViews/KNAlert/KNAlertViewController.swift index 79ca6be93f50bd9e31c368fc987e6e69d12a3055..7c26b8bb18f4cd95f441dbd312866ba0f26dcc1b 100644 --- a/MiniScanner/Modules/Documents/CustomViews/KNAlert/KNAlertViewController.swift +++ b/MiniScanner/Modules/Documents/CustomViews/KNAlert/KNAlertViewController.swift @@ -150,10 +150,12 @@ extension KNAlertViewController { buttonsView_height.constant = 0 folderName.addTarget(self, action: #selector(textChanged), for: .editingChanged) + confirmationButton.isEnabled = folderName.text != "" ? true : false } @objc func textChanged() { folderNameText = folderName.text ?? "" + confirmationButton.isEnabled = folderName.text != "" ? true : false } private func updateHeight() { diff --git a/MiniScanner/Modules/Documents/DocumentsTableViewController.swift b/MiniScanner/Modules/Documents/DocumentsTableViewController.swift index d7ee0c3ca8ebb3830536e9247201e0eca45bc081..acab3a080f3fecc373d575a237258108f4858df2 100644 --- a/MiniScanner/Modules/Documents/DocumentsTableViewController.swift +++ b/MiniScanner/Modules/Documents/DocumentsTableViewController.swift @@ -235,7 +235,13 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, rename.backgroundColor = UIColor.black.withAlphaComponent(0.5) rename.image = UIImage(systemName: "square.and.pencil")?.tint(with: .white) - let configuration = UISwipeActionsConfiguration(actions: [trash, rename]) + let move = UIContextualAction(style: .normal, + title: "Move".localized) { [weak self] (_, _, completionHandler) in + self?.moveto() + completionHandler(true) + } + + let configuration = UISwipeActionsConfiguration(actions: [trash, rename, move]) configuration.performsFirstActionWithFullSwipe = true return configuration @@ -305,6 +311,11 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, present(renameAlertController!, animated: true) } + func moveto() { + let foldersViewController = FoldersViewController() + self.present(foldersViewController, animated: true) + } + private func deleteFile(at indexPath: IndexPath) { let viewModel = isSearching ? searchedViewModel[indexPath.row] : viewModels[indexPath.row] diff --git a/MiniScanner/Modules/Documents/FoldersViewController/CustomCells/FolderSelectCollectionViewCell.swift b/MiniScanner/Modules/Documents/FoldersViewController/CustomCells/FolderSelectCollectionViewCell.swift new file mode 100644 index 0000000000000000000000000000000000000000..ac954ed57d0ae3f5469709b7cc55fceb9d0e5061 --- /dev/null +++ b/MiniScanner/Modules/Documents/FoldersViewController/CustomCells/FolderSelectCollectionViewCell.swift @@ -0,0 +1,29 @@ +// +// FolderSelectCollectionViewCell.swift +// MiniScanner +// +// Created by George Makhoul on 24/06/2024. +// Copyright © 2024 AppsNectar. All rights reserved. +// + +import UIKit + +class FolderSelectCollectionViewCell: UICollectionViewCell { + // MARK: - Outlets + @IBOutlet weak var folderTitle: UILabel! + // MARK: - Properties + + // MARK: - LifeCycle + override func awakeFromNib() { + super.awakeFromNib() + setupUI() + } + + private func setupUI() { + folderTitle.set(text: "", color: .mainText, font: .bold(15)) + } + + func set(title: String) { + self.folderTitle.set(text: title) + } +} diff --git a/MiniScanner/Modules/Documents/FoldersViewController/CustomCells/FolderSelectCollectionViewCell.xib b/MiniScanner/Modules/Documents/FoldersViewController/CustomCells/FolderSelectCollectionViewCell.xib new file mode 100644 index 0000000000000000000000000000000000000000..ddda2b07ab8aee997c42ac10e88c650cb2ba5ca0 --- /dev/null +++ b/MiniScanner/Modules/Documents/FoldersViewController/CustomCells/FolderSelectCollectionViewCell.xib @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina6_12" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <objects> + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> + <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="FolderSelectCollectionViewCell" id="gTV-IL-0wX" customClass="FolderSelectCollectionViewCell" customModule="MiniScanner" customModuleProvider="target"> + <rect key="frame" x="0.0" y="0.0" width="175" height="157"/> + <autoresizingMask key="autoresizingMask"/> + <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> + <rect key="frame" x="0.0" y="0.0" width="175" height="157"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <subviews> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Folder" translatesAutoresizingMaskIntoConstraints="NO" id="LWq-0V-Ajl"> + <rect key="frame" x="37.666666666666657" y="10" width="100" height="100"/> + <constraints> + <constraint firstAttribute="height" constant="100" id="dmS-dQ-iu7"/> + <constraint firstAttribute="width" constant="100" id="pVm-3g-B17"/> + </constraints> + </imageView> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5h2-FW-ati"> + <rect key="frame" x="66.666666666666671" y="120" width="42" height="27"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </view> + <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/> + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <constraints> + <constraint firstAttribute="bottom" secondItem="5h2-FW-ati" secondAttribute="bottom" constant="10" id="8Kt-qg-wG3"/> + <constraint firstItem="LWq-0V-Ajl" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="ClW-f1-uPY"/> + <constraint firstItem="5h2-FW-ati" firstAttribute="top" secondItem="LWq-0V-Ajl" secondAttribute="bottom" constant="10" id="MHf-Zd-Hzd"/> + <constraint firstItem="5h2-FW-ati" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="kTT-RO-Bxm"/> + <constraint firstItem="LWq-0V-Ajl" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="10" id="xr3-9W-32L"/> + </constraints> + <size key="customSize" width="175" height="157"/> + <connections> + <outlet property="folderTitle" destination="5h2-FW-ati" id="X5n-aQ-wbd"/> + </connections> + <point key="canvasLocation" x="69.465648854961827" y="57.394366197183103"/> + </collectionViewCell> + </objects> + <resources> + <image name="Folder" width="108" height="108"/> + </resources> +</document> diff --git a/MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.swift b/MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..c9ac734bc43453af86e04b9b630722f0b730d43e --- /dev/null +++ b/MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.swift @@ -0,0 +1,61 @@ +// +// FoldersViewController.swift +// MiniScanner +// +// Created by George Makhoul on 24/06/2024. +// Copyright © 2024 AppsNectar. All rights reserved. +// + +import UIKit + +class FoldersViewController: UIViewController { + // MARK: - Outlets + @IBOutlet weak var searchBar: UISearchBar! + @IBOutlet weak var collectionView: UICollectionView! + // MARK: - Properties + var folders: [AppConfigurator.Folder] = [] + + // MARK: - LifeCycle + override func viewDidLoad() { + super.viewDidLoad() + setupUI() + } + + func setupUI() { + folders = AppConfigurator().getFolders() + + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .vertical + layout.minimumLineSpacing = 10 + layout.minimumInteritemSpacing = 10 + self.collectionView.collectionViewLayout = layout + self.collectionView.register(UINib(nibName: "FolderSelectCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "FolderSelectCollectionViewCell") + collectionView.delegate = self + collectionView.dataSource = self + collectionView.reloadData() + } + +} +// MARK: - UICollectionViewDelegate +extension FoldersViewController: UICollectionViewDataSource, UICollectionViewDelegate { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + folders.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FolderSelectCollectionViewCell", for: indexPath) as? FolderSelectCollectionViewCell { + cell.set(title: folders[indexPath.row].name) + return cell + } + return UICollectionViewCell() + } +} + +// MARK: - UICollectionViewDelegateFlowLayout +extension FoldersViewController: UICollectionViewDelegateFlowLayout { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let itemWidth = 125 + let itemHeight = 150 + return CGSize(width: itemWidth, height: itemHeight) + } +} diff --git a/MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.xib b/MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.xib new file mode 100644 index 0000000000000000000000000000000000000000..7bdec4b4cf34103b4e3148aefd191ea9aa04c1be --- /dev/null +++ b/MiniScanner/Modules/Documents/FoldersViewController/FoldersViewController.xib @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina6_12" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="System colors in document resources" minToolsVersion="11.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <objects> + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="FoldersViewController" customModule="MiniScanner" customModuleProvider="target"> + <connections> + <outlet property="collectionView" destination="xai-MU-NO0" id="AJ0-ea-hD1"/> + <outlet property="searchBar" destination="Vw9-tr-5Rv" id="mOh-n3-MlE"/> + <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> + </connections> + </placeholder> + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> + <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> + <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <searchBar contentMode="redraw" translatesAutoresizingMaskIntoConstraints="NO" id="Vw9-tr-5Rv"> + <rect key="frame" x="0.0" y="30" width="393" height="56"/> + <constraints> + <constraint firstAttribute="height" constant="56" id="LJ5-Df-Ouq"/> + </constraints> + <textInputTraits key="textInputTraits"/> + <connections> + <outlet property="delegate" destination="-1" id="i3L-HF-1Lu"/> + </connections> + </searchBar> + <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="xai-MU-NO0"> + <rect key="frame" x="30" y="116" width="333" height="672"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="H9g-xI-Rth"> + <size key="itemSize" width="128" height="128"/> + <size key="headerReferenceSize" width="0.0" height="0.0"/> + <size key="footerReferenceSize" width="0.0" height="0.0"/> + <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> + </collectionViewFlowLayout> + </collectionView> + </subviews> + <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="xai-MU-NO0" secondAttribute="trailing" constant="30" id="Qmd-Pl-yGg"/> + <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="xai-MU-NO0" secondAttribute="bottom" constant="30" id="ZCL-lv-z1N"/> + <constraint firstItem="Vw9-tr-5Rv" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="30" id="cLb-W2-9rG"/> + <constraint firstItem="Vw9-tr-5Rv" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="eBW-Q9-d5Z"/> + <constraint firstItem="xai-MU-NO0" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="30" id="ofy-5c-0LJ"/> + <constraint firstItem="xai-MU-NO0" firstAttribute="top" secondItem="Vw9-tr-5Rv" secondAttribute="bottom" constant="30" id="ozZ-aY-dBk"/> + <constraint firstItem="Vw9-tr-5Rv" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="rM9-I7-Bnn"/> + </constraints> + <point key="canvasLocation" x="140" y="20"/> + </view> + </objects> + <resources> + <systemColor name="systemBackgroundColor"> + <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </systemColor> + </resources> +</document> diff --git a/MiniScanner/Supporting Files/Info.plist b/MiniScanner/Supporting Files/Info.plist index 7648ba4f28faf911acce826c4c1f60d66ca46c07..4e28385494dcdfbc030f42916a3670714c2dd2f9 100644 --- a/MiniScanner/Supporting Files/Info.plist +++ b/MiniScanner/Supporting Files/Info.plist @@ -70,5 +70,7 @@ <array> <string>UIInterfaceOrientationPortrait</string> </array> + <key>UIUserInterfaceStyle</key> + <string>Light</string> </dict> </plist>