From 69c9b5249115d515cd4ffe2672d3462064b8504a Mon Sep 17 00:00:00 2001 From: Shweta Waikar Date: Wed, 28 Jun 2023 12:11:45 +0530 Subject: [PATCH 1/7] NMC 2341 NCTrash Grid cell selection changes --- iOSClient/Trash/Cell/NCTrashGridCell.swift | 153 ++++++-------- iOSClient/Trash/Cell/NCTrashGridCell.xib | 206 +++++++++---------- iOSClient/Trash/NCTrash+CollectionView.swift | 52 +++-- 3 files changed, 183 insertions(+), 228 deletions(-) diff --git a/iOSClient/Trash/Cell/NCTrashGridCell.swift b/iOSClient/Trash/Cell/NCTrashGridCell.swift index 77427743c0..3110e2fbe7 100644 --- a/iOSClient/Trash/Cell/NCTrashGridCell.swift +++ b/iOSClient/Trash/Cell/NCTrashGridCell.swift @@ -2,47 +2,73 @@ // NCTrashGridCell.swift // Nextcloud // -// Created by Marino Faggiana on 19/03/2024. -// Copyright © 2024 Marino Faggiana. All rights reserved. -// -// Author Marino Faggiana -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . +// Created by A200073704 on 27/06/23. +// Copyright © 2023 Marino Faggiana. All rights reserved. // import UIKit -protocol NCTrashGridCellDelegate: AnyObject { - func tapMoreGridItem(with objectId: String, namedButtonMore: String, image: UIImage?, indexPath: IndexPath, sender: Any) -} - class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { + @IBOutlet weak var imageItem: UIImageView! @IBOutlet weak var imageSelect: UIImageView! + @IBOutlet weak var imageStatus: UIImageView! + @IBOutlet weak var imageFavorite: UIImageView! + @IBOutlet weak var imageLocal: UIImageView! @IBOutlet weak var labelTitle: UILabel! @IBOutlet weak var labelInfo: UILabel! - @IBOutlet weak var labelSubinfo: UILabel! @IBOutlet weak var buttonMore: UIButton! @IBOutlet weak var imageVisualEffect: UIVisualEffectView! + @IBOutlet weak var progressView: UIProgressView! - weak var delegate: NCTrashGridCellDelegate? - var objectId = "" - var indexPath = IndexPath() - var user = "" + internal var objectId = "" + private var user = "" + + weak var delegate: NCGridCellDelegate? var namedButtonMore = "" + var fileObjectId: String? { + get { return objectId } + set { objectId = newValue ?? "" } + } + var filePreviewImageView: UIImageView? { + get { return imageItem } + set { imageItem = newValue } + } + var fileUser: String? { + get { return user } + set { user = newValue ?? "" } + } + var fileTitleLabel: UILabel? { + get { return labelTitle } + set { labelTitle = newValue } + } + var fileInfoLabel: UILabel? { + get { return labelInfo } + set { labelInfo = newValue } + } + var fileProgressView: UIProgressView? { + get { return progressView } + set { progressView = newValue } + } + var fileSelectImage: UIImageView? { + get { return imageSelect } + set { imageSelect = newValue } + } + var fileStatusImage: UIImageView? { + get { return imageStatus } + set { imageStatus = newValue } + } + var fileLocalImage: UIImageView? { + get { return imageLocal } + set { imageLocal = newValue } + } + var fileFavoriteImage: UIImageView? { + get { return imageFavorite } + set { imageFavorite = newValue } + } + override func awakeFromNib() { super.awakeFromNib() @@ -59,9 +85,14 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { imageVisualEffect.clipsToBounds = true imageVisualEffect.alpha = 0.5 + progressView.tintColor = NCBrandColor.shared.brandElement + progressView.transform = CGAffineTransform(scaleX: 1.0, y: 0.5) + progressView.trackTintColor = .clear + labelTitle.text = "" labelInfo.text = "" - labelSubinfo.text = "" + labelTitle.textColor = .label + labelInfo.textColor = .systemGray } override func prepareForReuse() { @@ -77,12 +108,13 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { } @IBAction func touchUpInsideMore(_ sender: Any) { - delegate?.tapMoreGridItem(with: objectId, namedButtonMore: namedButtonMore, image: imageItem.image, indexPath: indexPath, sender: sender) + delegate?.tapMoreGridItem(with: objectId, namedButtonMore: namedButtonMore, image: imageItem.image, sender: sender) } + fileprivate func setA11yActions() { let moreName = namedButtonMore == NCGlobal.shared.buttonMoreStop ? "_cancel_" : "_more_" - + self.accessibilityCustomActions = [ UIAccessibilityCustomAction( name: NSLocalizedString(moreName, comment: ""), @@ -90,7 +122,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { selector: #selector(touchUpInsideMore)) ] } - + func setButtonMore(named: String, image: UIImage) { namedButtonMore = named buttonMore.setImage(image, for: .normal) @@ -123,7 +155,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { imageVisualEffect.effect = UIBlurEffect(style: .extraLight) imageVisualEffect.backgroundColor = .lightGray } - imageSelect.image = NCImageCache.images.checkedYes + imageSelect.image = NCBrandColor.cacheImages.checkedYes imageVisualEffect.isHidden = false } else { imageSelect.isHidden = true @@ -138,8 +170,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { dateFormatter.timeStyle = .none dateFormatter.locale = Locale.current - labelInfo.text = dateFormatter.string(from: date as Date) - labelSubinfo.text = NCUtilityFileSystem().transformedSize(size) + labelInfo.text = dateFormatter.string(from: date as Date) + " · " + CCUtility.transformedSize(size) } func setAccessibility(label: String, value: String) { @@ -147,59 +178,3 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { accessibilityValue = value } } - -// MARK: - Grid Layout - -class NCTrashGridLayout: UICollectionViewFlowLayout { - - var heightLabelPlusButton: CGFloat = 60 - var marginLeftRight: CGFloat = 10 - var itemForLine: CGFloat = 3 - var itemWidthDefault: CGFloat = 140 - - // MARK: - View Life Cycle - - override init() { - super.init() - - sectionHeadersPinToVisibleBounds = false - - minimumInteritemSpacing = 1 - minimumLineSpacing = marginLeftRight - - self.scrollDirection = .vertical - self.sectionInset = UIEdgeInsets(top: 10, left: marginLeftRight, bottom: 0, right: marginLeftRight) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override var itemSize: CGSize { - get { - if let collectionView = collectionView { - - if collectionView.frame.width < 400 { - itemForLine = 3 - } else { - itemForLine = collectionView.frame.width / itemWidthDefault - } - - let itemWidth: CGFloat = (collectionView.frame.width - marginLeftRight * 2 - marginLeftRight * (itemForLine - 1)) / itemForLine - let itemHeight: CGFloat = itemWidth + heightLabelPlusButton - - return CGSize(width: itemWidth, height: itemHeight) - } - - // Default fallback - return CGSize(width: itemWidthDefault, height: itemWidthDefault) - } - set { - super.itemSize = newValue - } - } - - override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint { - return proposedContentOffset - } -} diff --git a/iOSClient/Trash/Cell/NCTrashGridCell.xib b/iOSClient/Trash/Cell/NCTrashGridCell.xib index d95100298a..91bd5f805d 100644 --- a/iOSClient/Trash/Cell/NCTrashGridCell.xib +++ b/iOSClient/Trash/Cell/NCTrashGridCell.xib @@ -1,9 +1,9 @@ - - + + - + @@ -11,144 +11,130 @@ - - + + - + - - + + - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + - - - - - - - + + + + + + + + + + - + - - + - - - - - - diff --git a/iOSClient/Trash/NCTrash+CollectionView.swift b/iOSClient/Trash/NCTrash+CollectionView.swift index 8e401698ca..9acc4a109b 100644 --- a/iOSClient/Trash/NCTrash+CollectionView.swift +++ b/iOSClient/Trash/NCTrash+CollectionView.swift @@ -21,13 +21,15 @@ // along with this program. If not, see . // -import Realm -import UIKit +import Foundation // MARK: UICollectionViewDelegate extension NCTrash: UICollectionViewDelegate { + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + let tableTrash = datasource[indexPath.item] + guard !isEditMode else { if let index = selectOcId.firstIndex(of: tableTrash.fileId) { selectOcId.remove(at: index) @@ -35,15 +37,14 @@ extension NCTrash: UICollectionViewDelegate { selectOcId.append(tableTrash.fileId) } collectionView.reloadItems(at: [indexPath]) - tabBarSelect.update(selectOcId: selectOcId) + setNavigationRightItems() return } if tableTrash.directory, let ncTrash: NCTrash = UIStoryboard(name: "NCTrash", bundle: nil).instantiateInitialViewController() as? NCTrash { - ncTrash.filePath = tableTrash.filePath + tableTrash.fileName + ncTrash.trashPath = tableTrash.filePath + tableTrash.fileName ncTrash.titleCurrentFolder = tableTrash.trashbinFileName - ncTrash.filename = tableTrash.fileName self.navigationController?.pushViewController(ncTrash, animated: true) } } @@ -51,11 +52,15 @@ extension NCTrash: UICollectionViewDelegate { // MARK: UICollectionViewDataSource extension NCTrash: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + emptyDataSet?.numberOfItemsInSection(datasource.count, section: section) + setNavigationRightItems() return datasource.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let tableTrash = datasource[indexPath.item] var image: UIImage? @@ -76,12 +81,13 @@ extension NCTrash: UICollectionViewDataSource { var cell: NCTrashCellProtocol & UICollectionViewCell if layoutForView?.layout == NCGlobal.shared.layoutList { - guard let listCell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as? NCTrashListCell else { return NCTrashListCell() } + guard let listCell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as? NCTrashListCell else { return UICollectionViewCell() } listCell.delegate = self cell = listCell } else { - guard let gridCell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as? NCTrashGridCell else { return NCTrashGridCell() } - gridCell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCImageCache.images.buttonMore) + // GRID + guard let gridCell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as? NCTrashGridCell else { return UICollectionViewCell() } + gridCell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCBrandColor.cacheImages.buttonMore) gridCell.delegate = self cell = gridCell } @@ -97,6 +103,7 @@ extension NCTrash: UICollectionViewDataSource { } func setTextFooter(datasource: [tableTrash]) -> String { + var folders: Int = 0, foldersText = "" var files: Int = 0, filesText = "" var size: Int64 = 0 @@ -135,32 +142,19 @@ extension NCTrash: UICollectionViewDataSource { } func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { - if kind == UICollectionView.elementKindSectionHeader { - guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderEmptyData", for: indexPath) as? NCSectionHeaderEmptyData - else { return NCSectionHeaderEmptyData() } - header.emptyImage.image = UIImage(named: "trash")?.image(color: .gray, size: UIScreen.main.bounds.width) - header.emptyTitle.text = NSLocalizedString("_trash_no_trash_", comment: "") - header.emptyDescription.text = NSLocalizedString("_trash_no_trash_description_", comment: "") - return header - } else { - guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter - else { return NCSectionFooter() } - footer.setTitleLabel(setTextFooter(datasource: datasource)) - footer.separatorIsHidden(true) - return footer - } + + guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter + else { return UICollectionReusableView() } + + footer.setTitleLabel(setTextFooter(datasource: datasource)) + footer.separatorIsHidden(true) + + return footer } } // MARK: UICollectionViewDelegateFlowLayout extension NCTrash: UICollectionViewDelegateFlowLayout { - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { - var height: Double = 0 - if datasource.isEmpty { - height = NCGlobal.shared.getHeightHeaderEmptyData(view: view, portraitOffset: 0, landscapeOffset: 0) - } - return CGSize(width: collectionView.frame.width, height: height) - } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize { return CGSize(width: collectionView.frame.width, height: NCGlobal.shared.endHeightFooter) } From 9a52ef18704d9b27c2a55432605508adb1405e85 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Wed, 18 Oct 2023 15:33:54 +0530 Subject: [PATCH 2/7] NMC 2341 - Merging changes after 4.9.1 indexPath added in NCTrashCellProtocol --- iOSClient/Trash/Cell/NCTrashGridCell.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iOSClient/Trash/Cell/NCTrashGridCell.swift b/iOSClient/Trash/Cell/NCTrashGridCell.swift index 3110e2fbe7..f2794d90ca 100644 --- a/iOSClient/Trash/Cell/NCTrashGridCell.swift +++ b/iOSClient/Trash/Cell/NCTrashGridCell.swift @@ -23,6 +23,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { @IBOutlet weak var progressView: UIProgressView! internal var objectId = "" + var indexPath = IndexPath() private var user = "" weak var delegate: NCGridCellDelegate? @@ -108,7 +109,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { } @IBAction func touchUpInsideMore(_ sender: Any) { - delegate?.tapMoreGridItem(with: objectId, namedButtonMore: namedButtonMore, image: imageItem.image, sender: sender) + delegate?.tapMoreGridItem(with: objectId, namedButtonMore: namedButtonMore, image: imageItem.image, indexPath: indexPath, sender: sender) } From d074b873ff9a9780eb7be82deceb10dbed43fec4 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:37:58 +0530 Subject: [PATCH 3/7] NMC 2341 - Merging conflict resolve after NC release 4.9.2 --- iOSClient/Trash/Cell/NCTrashGridCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iOSClient/Trash/Cell/NCTrashGridCell.swift b/iOSClient/Trash/Cell/NCTrashGridCell.swift index f2794d90ca..e45c99b78c 100644 --- a/iOSClient/Trash/Cell/NCTrashGridCell.swift +++ b/iOSClient/Trash/Cell/NCTrashGridCell.swift @@ -156,7 +156,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { imageVisualEffect.effect = UIBlurEffect(style: .extraLight) imageVisualEffect.backgroundColor = .lightGray } - imageSelect.image = NCBrandColor.cacheImages.checkedYes + imageSelect.image = NCImageCache.images.checkedYes imageVisualEffect.isHidden = false } else { imageSelect.isHidden = true @@ -171,7 +171,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { dateFormatter.timeStyle = .none dateFormatter.locale = Locale.current - labelInfo.text = dateFormatter.string(from: date as Date) + " · " + CCUtility.transformedSize(size) + labelInfo.text = dateFormatter.string(from: date as Date) + " · " + NCUtilityFileSystem().transformedSize(size) } func setAccessibility(label: String, value: String) { From 593257c3672cd3b7c684827b4d12f7d806dc7605 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Wed, 6 Dec 2023 14:43:55 +0530 Subject: [PATCH 4/7] NMC 2341 - Merging conflicts resolve after Nextcloud 4.9.3 release --- iOSClient/Trash/NCTrash+CollectionView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOSClient/Trash/NCTrash+CollectionView.swift b/iOSClient/Trash/NCTrash+CollectionView.swift index 9acc4a109b..69d8318854 100644 --- a/iOSClient/Trash/NCTrash+CollectionView.swift +++ b/iOSClient/Trash/NCTrash+CollectionView.swift @@ -87,7 +87,7 @@ extension NCTrash: UICollectionViewDataSource { } else { // GRID guard let gridCell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as? NCTrashGridCell else { return UICollectionViewCell() } - gridCell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCBrandColor.cacheImages.buttonMore) + gridCell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCImageCache.images.buttonMore) gridCell.delegate = self cell = gridCell } From 891c2c8d5f7e4cb3b258b0a98e07f5fddee88b56 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:02:27 +0530 Subject: [PATCH 5/7] NMC 2341 - Selection icon added for grid view --- iOSClient/Trash/Cell/NCTrashGridCell.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOSClient/Trash/Cell/NCTrashGridCell.swift b/iOSClient/Trash/Cell/NCTrashGridCell.swift index e45c99b78c..77e798f02a 100644 --- a/iOSClient/Trash/Cell/NCTrashGridCell.swift +++ b/iOSClient/Trash/Cell/NCTrashGridCell.swift @@ -159,7 +159,7 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol { imageSelect.image = NCImageCache.images.checkedYes imageVisualEffect.isHidden = false } else { - imageSelect.isHidden = true + imageSelect.image = NCImageCache.images.checkedNo imageVisualEffect.isHidden = true } } From e85ce01752335b42405ea658f02cc1bc0c69a88b Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:24:01 +0530 Subject: [PATCH 6/7] NMC 2341 - Conflict resolved after NC 5.2.2 (Update UI Revert from NC) --- iOSClient/Trash/NCTrash+CollectionView.swift | 41 +++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/iOSClient/Trash/NCTrash+CollectionView.swift b/iOSClient/Trash/NCTrash+CollectionView.swift index 69d8318854..7ba09e1b07 100644 --- a/iOSClient/Trash/NCTrash+CollectionView.swift +++ b/iOSClient/Trash/NCTrash+CollectionView.swift @@ -142,19 +142,48 @@ extension NCTrash: UICollectionViewDataSource { } func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { + if kind == UICollectionView.elementKindSectionHeader { - guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter - else { return UICollectionReusableView() } + guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderMenu", for: indexPath) as? NCSectionHeaderMenu + else { return UICollectionReusableView() } - footer.setTitleLabel(setTextFooter(datasource: datasource)) - footer.separatorIsHidden(true) - - return footer + if layoutForView?.layout == NCGlobal.shared.layoutGrid { + header.setImageSwitchList() + header.buttonSwitch.accessibilityLabel = NSLocalizedString("_list_view_", comment: "") + } else { + header.setImageSwitchGrid() + header.buttonSwitch.accessibilityLabel = NSLocalizedString("_grid_view_", comment: "") + } + + header.delegate = self + header.setStatusButtonsView(enable: !datasource.isEmpty) + header.setSortedTitle(layoutForView?.titleButtonHeader ?? "") + header.setButtonsView(height: NCGlobal.shared.heightButtonsView) + header.setRichWorkspaceHeight(0) + header.setSectionHeight(0) + header.setViewTransfer(isHidden: true) + + return header + + } else { + guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter + else { return UICollectionReusableView() } + + footer.setTitleLabel(setTextFooter(datasource: datasource)) + footer.separatorIsHidden(true) + + return footer + } } } // MARK: UICollectionViewDelegateFlowLayout extension NCTrash: UICollectionViewDelegateFlowLayout { + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { + return CGSize(width: collectionView.frame.width, height: NCGlobal.shared.heightButtonsView) + } + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize { return CGSize(width: collectionView.frame.width, height: NCGlobal.shared.endHeightFooter) } From f9fa60aecdbc3fb79a4ba54b14015cd8e5001e03 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 8 Apr 2024 16:34:07 +0530 Subject: [PATCH 7/7] NMC 2341 - Theming changes --- iOSClient/Menu/NCTrash+Menu.swift | 2 +- iOSClient/Trash/Cell/NCTrashListCell.swift | 6 +++--- iOSClient/Trash/NCTrash.swift | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/iOSClient/Menu/NCTrash+Menu.swift b/iOSClient/Menu/NCTrash+Menu.swift index 5602619db9..d3f4973b9c 100644 --- a/iOSClient/Menu/NCTrash+Menu.swift +++ b/iOSClient/Menu/NCTrash+Menu.swift @@ -48,7 +48,7 @@ extension NCTrash { iconHeader = icon } else { if tableTrash.directory { - iconHeader = UIImage(named: "folder")!.image(color: UIColor.systemGray, size: 50) + iconHeader = UIImage(named: "folder") } else { iconHeader = UIImage(named: tableTrash.iconName) } diff --git a/iOSClient/Trash/Cell/NCTrashListCell.swift b/iOSClient/Trash/Cell/NCTrashListCell.swift index 42703c5e58..28bb650453 100644 --- a/iOSClient/Trash/Cell/NCTrashListCell.swift +++ b/iOSClient/Trash/Cell/NCTrashListCell.swift @@ -47,6 +47,7 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCellProtocol { weak var delegate: NCTrashListCellDelegate? var objectId = "" var indexPath = IndexPath() + let utility = NCUtility() override func awakeFromNib() { super.awakeFromNib() @@ -65,11 +66,10 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCellProtocol { ] - imageRestore.image = UIImage(systemName: "arrow.circlepath") - imageRestore.tintColor = .gray + imageRestore.image = utility.loadImage(named: "restore", color: NCBrandColor.shared.iconColor) imageMore.image = UIImage(systemName: "trash") - imageMore.tintColor = .red + imageMore.tintColor = NCBrandColor.shared.iconColor imageItem.layer.cornerRadius = 6 imageItem.layer.masksToBounds = true diff --git a/iOSClient/Trash/NCTrash.swift b/iOSClient/Trash/NCTrash.swift index b166e0748e..4642d15122 100644 --- a/iOSClient/Trash/NCTrash.swift +++ b/iOSClient/Trash/NCTrash.swift @@ -199,6 +199,20 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCTrashGridCellDelegat } } + func tapButtonSwitch(_ sender: Any) { + if layoutForView?.layout == NCGlobal.shared.layoutGrid { + onListSelected() + } else { + onGridSelected() + } + } + + func tapButtonOrder(_ sender: Any) { + + let sortMenu = NCSortMenu() + sortMenu.toggleMenu(viewController: self, account: appDelegate.account, key: layoutKey, sortButton: sender as? UIButton, serverUrl: serverUrl) + } + func longPressGridItem(with objectId: String, gestureRecognizer: UILongPressGestureRecognizer) { } func longPressMoreGridItem(with objectId: String, namedButtonMore: String, gestureRecognizer: UILongPressGestureRecognizer) { }