From 073601943138ef5308cbc6632513299c080b1aee Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Tue, 25 Jun 2024 18:22:22 +0200 Subject: [PATCH] cleaning Signed-off-by: Marino Faggiana --- .../Scan document/NCScan+CollectionView.swift | 11 +++++----- iOSClient/Scan document/NCScan.swift | 20 ------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/iOSClient/Scan document/NCScan+CollectionView.swift b/iOSClient/Scan document/NCScan+CollectionView.swift index bc72958e5e..8f8e5f3019 100644 --- a/iOSClient/Scan document/NCScan+CollectionView.swift +++ b/iOSClient/Scan document/NCScan+CollectionView.swift @@ -28,6 +28,11 @@ import NextcloudKit extension NCScan: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + if imagesDestination.isEmpty { + save.isEnabled = false + } else { + save.isEnabled = true + } return collectionView == collectionViewSource ? itemsSource.count : imagesDestination.count } @@ -195,11 +200,5 @@ extension NCScan: UICollectionViewDropDelegate { func collectionView(_ collectionView: UICollectionView, dropSessionDidEnd session: UIDropSession) { collectionViewDestination.reloadData() - // Save button - if imagesDestination.isEmpty { - save.isEnabled = false - } else { - save.isEnabled = true - } } } diff --git a/iOSClient/Scan document/NCScan.swift b/iOSClient/Scan document/NCScan.swift index 01874756ad..47985f1b0e 100755 --- a/iOSClient/Scan document/NCScan.swift +++ b/iOSClient/Scan document/NCScan.swift @@ -168,13 +168,6 @@ class NCScan: UIViewController, NCScanCellCellDelegate { imagesDestination.append(image) itemsDestination.append(fileName) } - // Save button - if imagesDestination.isEmpty { - save.isEnabled = false - } else { - save.isEnabled = true - } - collectionViewDestination.reloadData() } @@ -207,13 +200,6 @@ class NCScan: UIViewController, NCScanCellCellDelegate { itemsSource = itemsSource.sorted() collectionViewSource.reloadData() - - // Save button - if imagesDestination.isEmpty { - save.isEnabled = false - } else { - save.isEnabled = true - } } func filter(image: UIImage) -> UIImage? { @@ -324,12 +310,6 @@ class NCScan: UIViewController, NCScanCellCellDelegate { func delete(with imageIndex: Int, sender: Any) { imagesDestination.remove(at: imageIndex) itemsDestination.remove(at: imageIndex) - // Save button - if imagesDestination.isEmpty { - save.isEnabled = false - } else { - save.isEnabled = true - } collectionViewDestination.reloadData() }