Skip to content

Commit 4592271

Browse files
NMC 2341 - NCTrashView updated changes with 10.3.0 version
1 parent 9299c82 commit 4592271

6 files changed

Lines changed: 64 additions & 30 deletions

File tree

iOSClient/NCGlobal.swift

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ final class NCGlobal: Sendable {
7171
//
7272
let avatarSize: Int = 128 * Int(UIScreen.main.scale)
7373
let avatarSizeRounded: Int = 128
74-
74+
7575
// Preview size
7676
//
7777
let size1024: CGSize = CGSize(width: 1024, height: 1024)
@@ -125,6 +125,7 @@ final class NCGlobal: Sendable {
125125
let layoutViewOffline = "LayoutOffline"
126126
let layoutViewFavorite = "LayoutFavorite"
127127
let layoutViewFiles = "LayoutFiles"
128+
let layoutViewTransfers = "LayoutTransfers"
128129
let layoutViewRecent = "LayoutRecent"
129130
let layoutViewShares = "LayoutShares"
130131
let layoutViewShareExtension = "LayoutShareExtension"
@@ -146,7 +147,6 @@ final class NCGlobal: Sendable {
146147
let heightFooterButton: CGFloat = 30
147148
let endHeightFooter: CGFloat = 85
148149

149-
150150
// Text - OnlyOffice - Collabora - QuickLook
151151
//
152152
let editorText = "text"
@@ -251,7 +251,7 @@ final class NCGlobal: Sendable {
251251
let selectorSynchronizationOffline = "synchronizationOffline"
252252
let selectorPrint = "print"
253253
let selectorDeleteFile = "deleteFile"
254-
254+
255255
// Metadata : Status
256256
//
257257
// 0 normal
@@ -281,6 +281,7 @@ final class NCGlobal: Sendable {
281281
let metadataStatusForScreenAwake = [-1, -2, 1, 2]
282282
let metadataStatusHideInView = [1, 2, 3, 11]
283283
let metadataStatusWaitWebDav = [10, 11, 12, 13, 14, 15]
284+
let metadataStatusTransfers = [-2, -3, 2, 3, 10, 11, 12, 13, 14, 15]
284285

285286
let metadatasStatusInWaiting = [-1, 1, 10, 11, 12, 13, 14, 15]
286287
let metadatasStatusInProgress = [-2, 2]
@@ -297,23 +298,30 @@ final class NCGlobal: Sendable {
297298
let notificationCenterChangeTheming = "changeTheming" // userInfo: account
298299
let notificationCenterRichdocumentGrabFocus = "richdocumentGrabFocus"
299300
let notificationCenterReloadDataNCShare = "reloadDataNCShare"
300-
let notificationCenterDidCreateShareLink = "didCreateShareLink"
301-
302301
let notificationCenterCloseRichWorkspaceWebView = "closeRichWorkspaceWebView"
303302
let notificationCenterReloadAvatar = "reloadAvatar"
304303
let notificationCenterClearCache = "clearCache"
305304
let notificationCenterCheckUserDelaultErrorDone = "checkUserDelaultErrorDone" // userInfo: account, controller
306305
let notificationCenterServerDidUpdate = "serverDidUpdate" // userInfo: account
307306
let notificationCenterNetworkReachability = "networkReachability"
307+
let notificationCenterDidCreateShareLink = "didCreateShareLink"
308308

309+
let notificationCenterDeleteFile = "deleteFile" // userInfo: [ocId], error
310+
let notificationCenterCopyMoveFile = "copyMoveFile" // userInfo: [ocId] serverUrl, account, dragdrop, type (copy, move)
311+
let notificationCenterMoveFile = "moveFile" // userInfo: [ocId], [indexPath], error
312+
let notificationCenterCopyFile = "copyFile" // userInfo: [ocId], [indexPath], error
309313
let notificationCenterRenameFile = "renameFile" // userInfo: serverUrl, account, error
314+
let notificationCenterFavoriteFile = "favoriteFile" // userInfo: ocId, serverUrl
315+
let notificationCenterFileExists = "fileExists" // userInfo: ocId, fileExists
316+
let notificationCenterReloadDataSource = "reloadDataSource" // userInfo: serverUrl?, clearDataSource
310317

311318
let notificationCenterMenuSearchTextPDF = "menuSearchTextPDF"
312319
let notificationCenterMenuGotToPageInPDF = "menuGotToPageInPDF"
313320

314321
let notificationCenterOpenMediaDetail = "openMediaDetail" // userInfo: ocId
315322

316323
let notificationCenterDismissScanDocument = "dismissScanDocument"
324+
let notificationCenterDismissUploadAssets = "dismissUploadAssets"
317325

318326
let notificationCenterEnableSwipeGesture = "enableSwipeGesture"
319327
let notificationCenterDisableSwipeGesture = "disableSwipeGesture"
@@ -340,7 +348,6 @@ final class NCGlobal: Sendable {
340348
let networkingStatusUploading = "statusUploading"
341349
let networkingStatusUploaded = "statusUploaded"
342350

343-
344351
let networkingStatusReloadAvatar = "statusReloadAvatar"
345352
let notificationCenterUpdateIcons = "updateIcons"
346353

@@ -439,7 +446,7 @@ final class NCGlobal: Sendable {
439446
let keyFileNameAutoUploadType = "fileNameAutoUploadType"
440447
let keyFileNameOriginal = "fileNameOriginal"
441448
let keyFileNameOriginalAutoUpload = "fileNameOriginalAutoUpload"
442-
449+
443450
// LOG TAG
444451
//
445452
let logTagTask = "BGT"
@@ -458,6 +465,10 @@ final class NCGlobal: Sendable {
458465
//
459466
let udMigrationMultiDomains = "migrationMultiDomains"
460467
let udLastVersion = "lastVersion"
468+
469+
// Album
470+
//
471+
let selectedTabIndexAlbum: Int = 3
461472
}
462473

463474
/**

iOSClient/Trash/Cell/NCTrashCellProtocol.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ extension NCTrashCellProtocol where Self: UICollectionViewCell {
3636
self.labelInfo?.text = dateFormatter.string(from: tableTrash.trashbinDeletionTime as Date)
3737
}
3838
if tableTrash.directory {
39-
self.imageItem.image = NCImageCache.shared.getFolder(account: tableTrash.account)
39+
self.imageItem.image = NCImageCache.shared.getFolder()
4040
} else {
4141
self.imageItem.image = image
42+
// self.labelInfo?.text = (self.labelInfo?.text ?? "") + " · " + NCUtilityFileSystem().transformedSize(tableTrash.size)
4243
}
4344

4445
self.labelInfo?.text = (self.labelInfo?.text ?? "") + " · " + NCUtilityFileSystem().transformedSize(tableTrash.size)

iOSClient/Trash/Cell/NCTrashGridCell.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,6 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol {
5151
get { return labelInfo }
5252
set { labelInfo = newValue }
5353
}
54-
var fileProgressView: UIProgressView? {
55-
get { return progressView }
56-
set { progressView = newValue }
57-
}
58-
var fileSelectImage: UIImageView? {
59-
get { return imageSelect }
60-
set { imageSelect = newValue }
61-
}
62-
var fileStatusImage: UIImageView? {
63-
get { return imageStatus }
64-
set { imageStatus = newValue }
65-
}
66-
var fileLocalImage: UIImageView? {
67-
get { return imageLocal }
68-
set { imageLocal = newValue }
69-
}
70-
var fileFavoriteImage: UIImageView? {
71-
get { return imageFavorite }
72-
set { imageFavorite = newValue }
73-
}
7454

7555
override func awakeFromNib() {
7656
super.awakeFromNib()

iOSClient/Trash/Cell/NCTrashListCell.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCellProtocol {
5858

5959
]
6060

61+
// imageRestore.image = NCUtility().loadImage(named: "arrow.counterclockwise", colors: [NCBrandColor.shared.iconImageColor])
62+
// imageMore.image = NCUtility().loadImage(named: "trash", colors: [.red])
6163
imageRestore.image = NCUtility().loadImage(named: "restore", colors: [NCBrandColor.shared.iconImageColor])
6264
imageMore.image = NCUtility().loadImage(named: "trashIcon", colors: [NCBrandColor.shared.iconImageColor]) //NCUtility().loadImage(named: "trashIcon", colors: [.red])
6365
imageItem.layer.cornerRadius = 6

iOSClient/Trash/NCTrash+CollectionView.swift

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,44 @@ extension NCTrash: UICollectionViewDataSource {
9292

9393
return cell
9494
}
95+
96+
func setTextFooter(datasource: [tableTrash]) -> String {
97+
var folders: Int = 0, foldersText = ""
98+
var files: Int = 0, filesText = ""
99+
var size: Int64 = 0
100+
var text = ""
101+
102+
for record: tableTrash in datasource {
103+
if record.directory {
104+
folders += 1
105+
} else {
106+
files += 1
107+
size += record.size
108+
}
109+
}
110+
111+
if folders > 1 {
112+
foldersText = "\(folders) " + NSLocalizedString("_folders_", comment: "")
113+
} else if folders == 1 {
114+
foldersText = "1 " + NSLocalizedString("_folder_", comment: "")
115+
}
116+
117+
if files > 1 {
118+
filesText = "\(files) " + NSLocalizedString("_files_", comment: "") + " " + utilityFileSystem.transformedSize(size)
119+
} else if files == 1 {
120+
filesText = "1 " + NSLocalizedString("_file_", comment: "") + " " + utilityFileSystem.transformedSize(size)
121+
}
122+
123+
if foldersText.isEmpty {
124+
text = filesText
125+
} else if filesText.isEmpty {
126+
text = foldersText
127+
} else {
128+
text = foldersText + ", " + filesText
129+
}
130+
131+
return text
132+
}
95133

96134
func setTitleLabel(directories: Int, files: Int, size: Int64) -> String {
97135
var foldersText = ""
@@ -132,8 +170,9 @@ extension NCTrash: UICollectionViewDataSource {
132170
guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter
133171
else { return NCSectionFooter() }
134172
if let datasource {
135-
let info = self.getFooterInformation(datasource: datasource)
136-
footer.setTitleLabel(directories: info.directories, files: info.files, size: info.size)
173+
footer.setTitleLabel(setTextFooter(datasource: datasource))
174+
// let info = self.getFooterInformation(datasource: datasource)
175+
// footer.setTitleLabel(directories: info.directories, files: info.files, size: info.size)
137176
}
138177
return footer
139178
}

iOSClient/Trash/NCTrash.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCTrashGridCellDelegat
106106
await self.reloadDataSource()
107107
await loadListingTrash()
108108
}
109+
AnalyticsHelper.shared.trackEvent(eventName: .SCREEN_EVENT__DELETED_FILES)
109110
}
110111

111112
override func viewWillDisappear(_ animated: Bool) {

0 commit comments

Comments
 (0)