|
@@ -30,7 +30,7 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
var blinkFileId: String?
|
|
var blinkFileId: String?
|
|
|
|
|
|
var datasource: [tableTrash] = []
|
|
var datasource: [tableTrash] = []
|
|
- private let highHeader: CGFloat = 50
|
|
|
|
|
|
+ let highHeader: CGFloat = 50
|
|
|
|
|
|
// MARK: - View Life Cycle
|
|
// MARK: - View Life Cycle
|
|
|
|
|
|
@@ -83,7 +83,7 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
collectionView.collectionViewLayout = gridLayout
|
|
collectionView.collectionViewLayout = gridLayout
|
|
}
|
|
}
|
|
|
|
|
|
- if trashPath == "" {
|
|
|
|
|
|
+ if trashPath.isEmpty {
|
|
guard let userId = (appDelegate.userId as NSString).addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlFragmentAllowed) else { return }
|
|
guard let userId = (appDelegate.userId as NSString).addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlFragmentAllowed) else { return }
|
|
trashPath = appDelegate.urlBase + "/" + NCUtilityFileSystem.shared.getWebDAV(account: appDelegate.account) + "/trashbin/" + userId + "/trash/"
|
|
trashPath = appDelegate.urlBase + "/" + NCUtilityFileSystem.shared.getWebDAV(account: appDelegate.account) + "/trashbin/" + userId + "/trash/"
|
|
}
|
|
}
|
|
@@ -93,7 +93,6 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
|
|
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
super.viewDidAppear(animated)
|
|
super.viewDidAppear(animated)
|
|
-
|
|
|
|
loadListingTrash()
|
|
loadListingTrash()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -112,7 +111,6 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
// MARK: - Empty
|
|
// MARK: - Empty
|
|
|
|
|
|
override func emptyDataSetView(_ view: NCEmptyView) {
|
|
override func emptyDataSetView(_ view: NCEmptyView) {
|
|
-
|
|
|
|
view.emptyImage.image = UIImage(named: "trash")?.image(color: .gray, size: UIScreen.main.bounds.width)
|
|
view.emptyImage.image = UIImage(named: "trash")?.image(color: .gray, size: UIScreen.main.bounds.width)
|
|
view.emptyTitle.text = NSLocalizedString("_trash_no_trash_", comment: "")
|
|
view.emptyTitle.text = NSLocalizedString("_trash_no_trash_", comment: "")
|
|
view.emptyDescription.text = NSLocalizedString("_trash_no_trash_description_", comment: "")
|
|
view.emptyDescription.text = NSLocalizedString("_trash_no_trash_description_", comment: "")
|
|
@@ -146,13 +144,11 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
}
|
|
}
|
|
|
|
|
|
func tapOrderHeaderMenu(sender: Any) {
|
|
func tapOrderHeaderMenu(sender: Any) {
|
|
-
|
|
|
|
let sortMenu = NCSortMenu()
|
|
let sortMenu = NCSortMenu()
|
|
sortMenu.toggleMenu(viewController: self, key: NCGlobal.shared.layoutViewTrash, sortButton: sender as? UIButton, serverUrl: "", hideDirectoryOnTop: true)
|
|
sortMenu.toggleMenu(viewController: self, key: NCGlobal.shared.layoutViewTrash, sortButton: sender as? UIButton, serverUrl: "", hideDirectoryOnTop: true)
|
|
}
|
|
}
|
|
|
|
|
|
func tapMoreHeaderMenu(sender: Any) {
|
|
func tapMoreHeaderMenu(sender: Any) {
|
|
-
|
|
|
|
toggleMenuMoreHeader()
|
|
toggleMenuMoreHeader()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -160,33 +156,33 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
|
|
|
|
if !isEditMode {
|
|
if !isEditMode {
|
|
restoreItem(with: ocId)
|
|
restoreItem(with: ocId)
|
|
- } else {
|
|
|
|
- let buttonPosition: CGPoint = (sender as! UIButton).convert(CGPoint.zero, to: collectionView)
|
|
|
|
|
|
+ } else if let button = sender as? UIView {
|
|
|
|
+ let buttonPosition = button.convert(CGPoint.zero, to: collectionView)
|
|
let indexPath = collectionView.indexPathForItem(at: buttonPosition)
|
|
let indexPath = collectionView.indexPathForItem(at: buttonPosition)
|
|
collectionView(self.collectionView, didSelectItemAt: indexPath!)
|
|
collectionView(self.collectionView, didSelectItemAt: indexPath!)
|
|
- }
|
|
|
|
|
|
+ } // else: undefined sender
|
|
}
|
|
}
|
|
|
|
|
|
func tapMoreListItem(with objectId: String, image: UIImage?, sender: Any) {
|
|
func tapMoreListItem(with objectId: String, image: UIImage?, sender: Any) {
|
|
|
|
|
|
if !isEditMode {
|
|
if !isEditMode {
|
|
toggleMenuMoreList(with: objectId, image: image)
|
|
toggleMenuMoreList(with: objectId, image: image)
|
|
- } else {
|
|
|
|
- let buttonPosition: CGPoint = (sender as! UIButton).convert(CGPoint.zero, to: collectionView)
|
|
|
|
|
|
+ } else if let button = sender as? UIView {
|
|
|
|
+ let buttonPosition = button.convert(CGPoint.zero, to: collectionView)
|
|
let indexPath = collectionView.indexPathForItem(at: buttonPosition)
|
|
let indexPath = collectionView.indexPathForItem(at: buttonPosition)
|
|
collectionView(self.collectionView, didSelectItemAt: indexPath!)
|
|
collectionView(self.collectionView, didSelectItemAt: indexPath!)
|
|
- }
|
|
|
|
|
|
+ } // else: undefined sender
|
|
}
|
|
}
|
|
|
|
|
|
override func tapMoreGridItem(with objectId: String, namedButtonMore: String, image: UIImage?, sender: Any) {
|
|
override func tapMoreGridItem(with objectId: String, namedButtonMore: String, image: UIImage?, sender: Any) {
|
|
|
|
|
|
if !isEditMode {
|
|
if !isEditMode {
|
|
toggleMenuMoreGrid(with: objectId, namedButtonMore: namedButtonMore, image: image)
|
|
toggleMenuMoreGrid(with: objectId, namedButtonMore: namedButtonMore, image: image)
|
|
- } else {
|
|
|
|
- let buttonPosition: CGPoint = (sender as! UIButton).convert(CGPoint.zero, to: collectionView)
|
|
|
|
|
|
+ } else if let button = sender as? UIView {
|
|
|
|
+ let buttonPosition = button.convert(CGPoint.zero, to: collectionView)
|
|
let indexPath = collectionView.indexPathForItem(at: buttonPosition)
|
|
let indexPath = collectionView.indexPathForItem(at: buttonPosition)
|
|
collectionView(self.collectionView, didSelectItemAt: indexPath!)
|
|
collectionView(self.collectionView, didSelectItemAt: indexPath!)
|
|
- }
|
|
|
|
|
|
+ } // else: undefined sender
|
|
}
|
|
}
|
|
|
|
|
|
override func longPressGridItem(with objectId: String, gestureRecognizer: UILongPressGestureRecognizer) {
|
|
override func longPressGridItem(with objectId: String, gestureRecognizer: UILongPressGestureRecognizer) {
|
|
@@ -202,7 +198,7 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
}
|
|
}
|
|
|
|
|
|
@objc func reloadTrashDataSource() { self.reloadDataSource() }
|
|
@objc func reloadTrashDataSource() { self.reloadDataSource() }
|
|
-
|
|
|
|
|
|
+
|
|
@objc override func reloadDataSource() {
|
|
@objc override func reloadDataSource() {
|
|
|
|
|
|
layoutForView = NCUtility.shared.getLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "")
|
|
layoutForView = NCUtility.shared.getLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "")
|
|
@@ -215,23 +211,18 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
|
|
|
|
datasource = tashItems
|
|
datasource = tashItems
|
|
collectionView.reloadData()
|
|
collectionView.reloadData()
|
|
-
|
|
|
|
- if self.blinkFileId != nil {
|
|
|
|
- for item in 0...self.datasource.count-1 {
|
|
|
|
- if self.datasource[item].fileId.contains(self.blinkFileId!) {
|
|
|
|
- let indexPath = IndexPath(item: item, section: 0)
|
|
|
|
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
|
|
|
- UIView.animate(withDuration: 0.3) {
|
|
|
|
- self.collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: false)
|
|
|
|
- } completion: { _ in
|
|
|
|
- if let cell = self.collectionView.cellForItem(at: indexPath) {
|
|
|
|
- cell.backgroundColor = .darkGray
|
|
|
|
- UIView.animate(withDuration: 2) {
|
|
|
|
- cell.backgroundColor = .clear
|
|
|
|
- self.blinkFileId = nil
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ guard let blinkFileId = blinkFileId else { return }
|
|
|
|
+ for itemIx in 0..<self.datasource.count where self.datasource[itemIx].fileId.contains(blinkFileId) {
|
|
|
|
+ let indexPath = IndexPath(item: itemIx, section: 0)
|
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
|
|
|
+ UIView.animate(withDuration: 0.3) {
|
|
|
|
+ self.collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: false)
|
|
|
|
+ } completion: { _ in
|
|
|
|
+ guard let cell = self.collectionView.cellForItem(at: indexPath) else { return }
|
|
|
|
+ cell.backgroundColor = .darkGray
|
|
|
|
+ UIView.animate(withDuration: 2) {
|
|
|
|
+ cell.backgroundColor = .clear
|
|
|
|
+ self.blinkFileId = nil
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -239,168 +230,6 @@ class NCTrash: NCCollectionViewCommon, NCTrashListCellDelegate, NCTrashSectionHe
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// MARK: - Collection View
|
|
|
|
-
|
|
|
|
-extension NCTrash {
|
|
|
|
-
|
|
|
|
- override 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)
|
|
|
|
- } else {
|
|
|
|
- selectOcId.append(tableTrash.fileId)
|
|
|
|
- }
|
|
|
|
- collectionView.reloadItems(at: [indexPath])
|
|
|
|
- self.navigationItem.title = NSLocalizedString("_selected_", comment: "") + " : \(selectOcId.count)" + " / \(datasource.count)"
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if tableTrash.directory {
|
|
|
|
-
|
|
|
|
- let ncTrash: NCTrash = UIStoryboard(name: "NCTrash", bundle: nil).instantiateInitialViewController() as! NCTrash
|
|
|
|
-
|
|
|
|
- ncTrash.trashPath = tableTrash.filePath + tableTrash.fileName
|
|
|
|
- ncTrash.titleCurrentFolder = tableTrash.trashbinFileName
|
|
|
|
-
|
|
|
|
- self.navigationController?.pushViewController(ncTrash, animated: true)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-extension NCTrash {
|
|
|
|
-
|
|
|
|
- override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
|
|
|
|
-
|
|
|
|
- if kind == UICollectionView.elementKindSectionHeader {
|
|
|
|
-
|
|
|
|
- let trashHeader = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderMenu", for: indexPath) as! NCTrashSectionHeaderMenu
|
|
|
|
-
|
|
|
|
- if collectionView.collectionViewLayout == gridLayout {
|
|
|
|
- trashHeader.buttonSwitch.setImage(UIImage(named: "switchList")?.image(color: NCBrandColor.shared.gray, size: 25), for: .normal)
|
|
|
|
- } else {
|
|
|
|
- trashHeader.buttonSwitch.setImage(UIImage(named: "switchGrid")?.image(color: NCBrandColor.shared.gray, size: 25), for: .normal)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- trashHeader.delegate = self
|
|
|
|
- trashHeader.backgroundColor = NCBrandColor.shared.systemBackground
|
|
|
|
- trashHeader.separator.backgroundColor = NCBrandColor.shared.separator
|
|
|
|
- trashHeader.setStatusButton(datasource: datasource)
|
|
|
|
- trashHeader.setTitleSorted(datasourceTitleButton: layoutForView?.titleButtonHeader ?? "")
|
|
|
|
-
|
|
|
|
- return trashHeader
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- let trashFooter = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCTrashSectionFooter
|
|
|
|
-
|
|
|
|
- trashFooter.setTitleLabelFooter(datasource: datasource)
|
|
|
|
-
|
|
|
|
- return trashFooter
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
|
|
- emptyDataSet?.numberOfItemsInSection(datasource.count, section: section)
|
|
|
|
- return datasource.count
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
|
|
-
|
|
|
|
- let tableTrash = datasource[indexPath.item]
|
|
|
|
- var image: UIImage?
|
|
|
|
-
|
|
|
|
- if tableTrash.iconName.count > 0 {
|
|
|
|
- image = UIImage(named: tableTrash.iconName)
|
|
|
|
- } else {
|
|
|
|
- image = UIImage(named: "file")
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName)) {
|
|
|
|
- image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName))
|
|
|
|
- } else {
|
|
|
|
- if tableTrash.hasPreview && !CCUtility.fileProviderStoragePreviewIconExists(tableTrash.fileId, etag: tableTrash.fileName) {
|
|
|
|
- downloadThumbnail(with: tableTrash, indexPath: indexPath)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if collectionView.collectionViewLayout == listLayout {
|
|
|
|
-
|
|
|
|
- // LIST
|
|
|
|
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCTrashListCell
|
|
|
|
- cell.delegate = self
|
|
|
|
-
|
|
|
|
- cell.objectId = tableTrash.fileId
|
|
|
|
- cell.labelTitle.text = tableTrash.trashbinFileName
|
|
|
|
- cell.labelTitle.textColor = NCBrandColor.shared.label
|
|
|
|
-
|
|
|
|
- if tableTrash.directory {
|
|
|
|
- cell.imageItem.image = NCBrandColor.cacheImages.folder
|
|
|
|
- cell.labelInfo.text = CCUtility.dateDiff(tableTrash.date as Date)
|
|
|
|
- } else {
|
|
|
|
- cell.imageItem.image = image
|
|
|
|
- cell.labelInfo.text = CCUtility.dateDiff(tableTrash.date as Date) + ", " + CCUtility.transformedSize(tableTrash.size)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if isEditMode {
|
|
|
|
- cell.selectMode(true)
|
|
|
|
- if selectOcId.contains(tableTrash.fileId) {
|
|
|
|
- cell.selected(true)
|
|
|
|
- } else {
|
|
|
|
- cell.selected(false)
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- cell.selectMode(false)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return cell
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- // GRID
|
|
|
|
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
|
|
|
|
- cell.delegate = self
|
|
|
|
-
|
|
|
|
- cell.fileObjectId = tableTrash.fileId
|
|
|
|
- cell.labelTitle.text = tableTrash.trashbinFileName
|
|
|
|
- cell.labelTitle.textColor = NCBrandColor.shared.label
|
|
|
|
- cell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCBrandColor.cacheImages.buttonMore)
|
|
|
|
-
|
|
|
|
- if tableTrash.directory {
|
|
|
|
- cell.imageItem.image = NCBrandColor.cacheImages.folder
|
|
|
|
- } else {
|
|
|
|
- cell.imageItem.image = image
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if isEditMode {
|
|
|
|
- cell.imageSelect.isHidden = false
|
|
|
|
- if selectOcId.contains(tableTrash.fileId) {
|
|
|
|
- cell.selected(true)
|
|
|
|
- } else {
|
|
|
|
- cell.selected(false)
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- cell.imageSelect.isHidden = true
|
|
|
|
- cell.backgroundView = nil
|
|
|
|
- }
|
|
|
|
- return cell
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-extension NCTrash {
|
|
|
|
-
|
|
|
|
- override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
|
|
|
|
- return CGSize(width: collectionView.frame.width, height: highHeader)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
|
|
|
|
- return CGSize(width: collectionView.frame.width, height: highHeader)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// MARK: - NC API & Algorithm
|
|
// MARK: - NC API & Algorithm
|
|
|
|
|
|
extension NCTrash {
|
|
extension NCTrash {
|
|
@@ -413,7 +242,7 @@ extension NCTrash {
|
|
NCManageDatabase.shared.deleteTrash(filePath: self.trashPath, account: self.appDelegate.account)
|
|
NCManageDatabase.shared.deleteTrash(filePath: self.trashPath, account: self.appDelegate.account)
|
|
NCManageDatabase.shared.addTrash(account: account, items: items)
|
|
NCManageDatabase.shared.addTrash(account: account, items: items)
|
|
} else if errorCode != 0 {
|
|
} else if errorCode != 0 {
|
|
- NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
|
|
|
+ NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode)
|
|
} else {
|
|
} else {
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
}
|
|
}
|
|
@@ -439,7 +268,7 @@ extension NCTrash {
|
|
NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account)
|
|
NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account)
|
|
self.reloadDataSource()
|
|
self.reloadDataSource()
|
|
} else if errorCode != 0 {
|
|
} else if errorCode != 0 {
|
|
- NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
|
|
|
+ NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode)
|
|
} else {
|
|
} else {
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
}
|
|
}
|
|
@@ -454,7 +283,7 @@ extension NCTrash {
|
|
if errorCode == 0 && account == self.appDelegate.account {
|
|
if errorCode == 0 && account == self.appDelegate.account {
|
|
NCManageDatabase.shared.deleteTrash(fileId: nil, account: self.appDelegate.account)
|
|
NCManageDatabase.shared.deleteTrash(fileId: nil, account: self.appDelegate.account)
|
|
} else if errorCode != 0 {
|
|
} else if errorCode != 0 {
|
|
- NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
|
|
|
+ NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode)
|
|
} else {
|
|
} else {
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
}
|
|
}
|
|
@@ -475,7 +304,7 @@ extension NCTrash {
|
|
NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account)
|
|
NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account)
|
|
self.reloadDataSource()
|
|
self.reloadDataSource()
|
|
} else if errorCode != 0 {
|
|
} else if errorCode != 0 {
|
|
- NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
|
|
|
+ NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode)
|
|
} else {
|
|
} else {
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
print("[LOG] It has been changed user during networking process, error.")
|
|
}
|
|
}
|
|
@@ -487,17 +316,22 @@ extension NCTrash {
|
|
let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(tableTrash.fileId, etag: tableTrash.fileName)!
|
|
let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(tableTrash.fileId, etag: tableTrash.fileName)!
|
|
let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName)!
|
|
let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName)!
|
|
|
|
|
|
- NCCommunication.shared.downloadPreview(fileNamePathOrFileId: tableTrash.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, heightPreview: NCGlobal.shared.sizePreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon, etag: nil, endpointTrashbin: true) { account, _, imageIcon, _, _, errorCode, _ in
|
|
|
|
-
|
|
|
|
- if errorCode == 0 && imageIcon != nil && account == self.appDelegate.account {
|
|
|
|
- if let cell = self.collectionView.cellForItem(at: indexPath) {
|
|
|
|
- if cell is NCTrashListCell {
|
|
|
|
- (cell as! NCTrashListCell).imageItem.image = imageIcon
|
|
|
|
- } else if cell is NCGridCell {
|
|
|
|
- (cell as! NCGridCell).imageItem.image = imageIcon
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ NCCommunication.shared.downloadPreview(
|
|
|
|
+ fileNamePathOrFileId: tableTrash.fileId,
|
|
|
|
+ fileNamePreviewLocalPath: fileNamePreviewLocalPath,
|
|
|
|
+ widthPreview: NCGlobal.shared.sizePreview,
|
|
|
|
+ heightPreview: NCGlobal.shared.sizePreview,
|
|
|
|
+ fileNameIconLocalPath: fileNameIconLocalPath,
|
|
|
|
+ sizeIcon: NCGlobal.shared.sizeIcon,
|
|
|
|
+ etag: nil,
|
|
|
|
+ endpointTrashbin: true) { account, _, imageIcon, _, _, errorCode, _ in
|
|
|
|
+ guard errorCode == 0, let imageIcon = imageIcon, account == self.appDelegate.account,
|
|
|
|
+ let cell = self.collectionView.cellForItem(at: indexPath) else { return }
|
|
|
|
+ if let cell = cell as? NCTrashListCell {
|
|
|
|
+ cell.imageItem.image = imageIcon
|
|
|
|
+ } else if let cell = cell as? NCGridCell {
|
|
|
|
+ cell.imageItem.image = imageIcon
|
|
|
|
+ } // else: undefined cell
|
|
}
|
|
}
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|