From 11ca996c3d2e1d8228d23a1fb42567a8d4557276 Mon Sep 17 00:00:00 2001
From: Mustafa Merza <mustafa.merza95@gmail.com>
Date: Wed, 14 Aug 2024 19:15:44 +0300
Subject: [PATCH] - Removed redundant extra button.

- Changed design to match more with Figma.
---
 .../DocumentPreview.storyboard                | 26 +++++--------------
 .../DocumentPreviewViewController.swift       | 23 +---------------
 2 files changed, 8 insertions(+), 41 deletions(-)

diff --git a/MiniScanner/Modules/DocumentPreview/DocumentPreview.storyboard b/MiniScanner/Modules/DocumentPreview/DocumentPreview.storyboard
index de037bb..f142082 100644
--- a/MiniScanner/Modules/DocumentPreview/DocumentPreview.storyboard
+++ b/MiniScanner/Modules/DocumentPreview/DocumentPreview.storyboard
@@ -28,7 +28,7 @@
                                 <rect key="frame" x="16" y="104" width="382" height="34"/>
                                 <subviews>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="g4H-6z-yTr" userLabel="Layout Button">
-                                        <rect key="frame" x="31.5" y="4.5" width="25" height="25"/>
+                                        <rect key="frame" x="0.0" y="4.5" width="25" height="25"/>
                                         <constraints>
                                             <constraint firstAttribute="width" secondItem="g4H-6z-yTr" secondAttribute="height" multiplier="1:1" id="w1c-RR-goA"/>
                                         </constraints>
@@ -38,16 +38,8 @@
                                             <action selector="layoutTapped:" destination="lAb-mo-IO6" eventType="touchUpInside" id="0Kj-dY-bkQ"/>
                                         </connections>
                                     </button>
-                                    <button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="R2E-Ce-wdD">
-                                        <rect key="frame" x="0.0" y="5.5" width="23.5" height="23.5"/>
-                                        <constraints>
-                                            <constraint firstAttribute="width" secondItem="R2E-Ce-wdD" secondAttribute="height" id="4FN-TU-J5g"/>
-                                        </constraints>
-                                        <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                                        <state key="normal" image="ellipsis" catalog="system"/>
-                                    </button>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TqR-ZS-2Pv">
-                                        <rect key="frame" x="220.5" y="0.0" width="99.5" height="34"/>
+                                        <rect key="frame" x="282.5" y="0.0" width="99.5" height="34"/>
                                         <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="aMM-Hs-if2">
                                                 <rect key="frame" x="4" y="0.0" width="41.5" height="34"/>
@@ -93,18 +85,16 @@
                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <constraints>
                                     <constraint firstItem="Jpc-O0-8Id" firstAttribute="top" secondItem="YIu-mV-Xt3" secondAttribute="top" id="1mG-M0-gNq"/>
-                                    <constraint firstItem="R2E-Ce-wdD" firstAttribute="leading" secondItem="YIu-mV-Xt3" secondAttribute="leading" id="9we-Pv-599"/>
-                                    <constraint firstItem="g4H-6z-yTr" firstAttribute="leading" secondItem="R2E-Ce-wdD" secondAttribute="trailing" constant="8" id="GtU-Pb-Hxs"/>
+                                    <constraint firstItem="g4H-6z-yTr" firstAttribute="leading" secondItem="YIu-mV-Xt3" secondAttribute="leading" id="FTN-Yt-UYJ"/>
                                     <constraint firstAttribute="bottom" secondItem="TqR-ZS-2Pv" secondAttribute="bottom" id="ZUQ-Ag-eOW"/>
                                     <constraint firstItem="Jpc-O0-8Id" firstAttribute="centerX" secondItem="YIu-mV-Xt3" secondAttribute="centerX" id="att-Ib-oBi"/>
                                     <constraint firstItem="yWg-kQ-A5X" firstAttribute="centerY" secondItem="YIu-mV-Xt3" secondAttribute="centerY" id="cPj-8z-trd"/>
                                     <constraint firstItem="g4H-6z-yTr" firstAttribute="centerY" secondItem="YIu-mV-Xt3" secondAttribute="centerY" id="cVc-Gu-Hzk"/>
-                                    <constraint firstItem="R2E-Ce-wdD" firstAttribute="centerY" secondItem="YIu-mV-Xt3" secondAttribute="centerY" id="eQy-LQ-RwM"/>
                                     <constraint firstItem="TqR-ZS-2Pv" firstAttribute="top" secondItem="YIu-mV-Xt3" secondAttribute="top" id="g8Q-cU-fNM"/>
                                     <constraint firstItem="yWg-kQ-A5X" firstAttribute="trailing" secondItem="YIu-mV-Xt3" secondAttribute="trailing" id="h3Q-dw-S3L"/>
                                     <constraint firstItem="yWg-kQ-A5X" firstAttribute="top" secondItem="YIu-mV-Xt3" secondAttribute="top" id="kyG-zt-er0"/>
                                     <constraint firstAttribute="bottom" secondItem="Jpc-O0-8Id" secondAttribute="bottom" id="kzj-Z3-1lw"/>
-                                    <constraint firstItem="yWg-kQ-A5X" firstAttribute="leading" secondItem="TqR-ZS-2Pv" secondAttribute="trailing" constant="16" id="szf-Uv-3UE"/>
+                                    <constraint firstAttribute="trailing" secondItem="TqR-ZS-2Pv" secondAttribute="trailing" id="szf-Uv-3UE"/>
                                 </constraints>
                             </view>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HkK-Fc-Rgz" customClass="FSPagerView" customModule="MiniScanner" customModuleProvider="target">
@@ -179,16 +169,16 @@
                                 <rect key="frame" x="0.0" y="729" width="414" height="94"/>
                                 <subviews>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Isk-yU-XYz">
-                                        <rect key="frame" x="117.5" y="0.0" width="179" height="30"/>
+                                        <rect key="frame" x="122.5" y="0.0" width="169" height="30"/>
                                         <subviews>
                                             <label opaque="NO" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Direct Share" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GR8-HI-C1V">
-                                                <rect key="frame" x="0.0" y="0.0" width="98.5" height="30"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="88.5" height="30"/>
                                                 <fontDescription key="fontDescription" name="Poppins-Medium" family="Poppins" pointSize="16"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
                                             </label>
                                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TWq-yJ-U63" userLabel="Share Type View">
-                                                <rect key="frame" x="114.5" y="0.0" width="64.5" height="30"/>
+                                                <rect key="frame" x="104.5" y="0.0" width="64.5" height="30"/>
                                                 <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="TWg-Nz-N1E">
                                                         <rect key="frame" x="0.0" y="0.0" width="41.5" height="30"/>
@@ -375,7 +365,6 @@
                         <outlet property="collectionView" destination="jFy-zp-lQZ" id="IoW-dj-fcR"/>
                         <outlet property="currentPageLabel" destination="AEe-Tw-owM" id="iwi-YD-CJm"/>
                         <outlet property="directShareLabel" destination="GR8-HI-C1V" id="586-VP-rx9"/>
-                        <outlet property="extraButton" destination="R2E-Ce-wdD" id="gCe-Dd-88D"/>
                         <outlet property="layoutButton" destination="g4H-6z-yTr" id="eR3-5s-JPn"/>
                         <outlet property="nextPageButton" destination="cVY-eB-Oiw" id="anB-qz-F19"/>
                         <outlet property="pagerView" destination="HkK-Fc-Rgz" id="FYA-r7-Pxm"/>
@@ -417,7 +406,6 @@
         <image name="arrow.forward" catalog="system" width="128" height="95"/>
         <image name="chevron.down" catalog="system" width="128" height="70"/>
         <image name="edit-ic" width="24" height="23"/>
-        <image name="ellipsis" catalog="system" width="128" height="37"/>
         <image name="gmail" width="48" height="48"/>
         <image name="layout-grid-ic" width="24" height="25"/>
         <image name="more-img" width="48" height="48"/>
diff --git a/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift b/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift
index 6184bfc..9cf085e 100644
--- a/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift
+++ b/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift
@@ -47,7 +47,6 @@ final class DocumentPreviewViewController: UIViewController, ScanSessionSharable
     @IBOutlet weak var selectedPagesLabel: UILabel!
     
     @IBOutlet weak var clearSelectionButton: UIButton!
-    @IBOutlet weak var extraButton: UIButton!
     
     @Inject var updateScanSessionUseCase: UpdateScanSessionUseCase
     @Inject var moveScanSessionUseCase: MoveScanSessionUseCase
@@ -122,9 +121,6 @@ final class DocumentPreviewViewController: UIViewController, ScanSessionSharable
         
         clearSelectionButton.setTitle(.clear.localized, for: .normal)
         
-        extraButton.showsMenuAsPrimaryAction = true
-        extraButton.transform = extraButton.transform.rotated(by: .pi/2)
-        
         updateSelectedImagesLabel()
         
         updateCurrentPageLabel()
@@ -135,8 +131,6 @@ final class DocumentPreviewViewController: UIViewController, ScanSessionSharable
         
         setupMenu()
         
-        setupExtraButtonMenu()
-        
         setupPagerView()
         
         setupCollectionView()
@@ -159,7 +153,6 @@ final class DocumentPreviewViewController: UIViewController, ScanSessionSharable
         selectedPagesLabel.set(color: .primary)
         clearSelectionButton.customTint(.primary)
         
-        extraButton.customTint(.primary)
         shareTypeLabel.set(color: .gray600)
         layoutButton.customTint(.gray600)
     }
@@ -213,21 +206,6 @@ final class DocumentPreviewViewController: UIViewController, ScanSessionSharable
         collectionView.customBackground(.clear)
     }
     
-    private func setupExtraButtonMenu() {
-        
-        let move = UIAction(title: .move.localized) { [self] _ in
-            self.displayMoveScanSessionSheet()
-        }
-        
-        let rename = UIAction(title: .rename.localized, image: .squareAndPencil) { [self] _ in
-            displayRenameScanSessionDialog()
-        }
-        
-        let menu = UIMenu(title: "", children: [move, rename])
-        
-        extraButton.menu = menu
-    }
-    
     private func dismiss() {
         session.scannedItems.forEach { $0.isSelected = false }
         self.dismiss(animated: true)
@@ -263,6 +241,7 @@ final class DocumentPreviewViewController: UIViewController, ScanSessionSharable
     private func updateSelectedImagesLabel() {
         
         selectedPagesView.isHidden = selectedPagesCount == 0
+        closeButton.isHidden = selectedPagesCount != 0
         
         selectedPagesLabel.set(text: String(selectedPagesCount))
     }
-- 
GitLab