Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 66 additions & 4 deletions iOSClient/NCGlobal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ final class NCGlobal: Sendable {
let nextcloudVersion28: Int = 28
let nextcloudVersion30: Int = 30
let nextcloudVersion31: Int = 31
let nextcloudVersionFuture: Int = 99999


// Nextcloud unsupported
//
Expand All @@ -60,6 +62,7 @@ final class NCGlobal: Sendable {
// Intro selector
//
let introLogin: Int = 0
let introSignup: Int = 1
let introSignUpWithProvider: Int = 1

// Avatar
Expand Down Expand Up @@ -128,6 +131,7 @@ final class NCGlobal: Sendable {
let layoutViewOffline = "LayoutOffline"
let layoutViewFavorite = "LayoutFavorite"
let layoutViewFiles = "LayoutFiles"
let layoutViewTransfers = "LayoutTransfers"
let layoutViewRecent = "LayoutRecent"
let layoutViewShares = "LayoutShares"
let layoutViewShareExtension = "LayoutShareExtension"
Expand All @@ -138,7 +142,34 @@ final class NCGlobal: Sendable {
//
let buttonMoreMore = "more"
let buttonMoreLock = "moreLock"

let buttonMoreStop = "stop"

// Standard height sections header/footer
//
let heightButtonsView: CGFloat = 50
let heightHeaderTransfer: CGFloat = 50
let heightSection: CGFloat = 30
let heightFooter: CGFloat = 1
let heightFooterButton: CGFloat = 30
let endHeightFooter: CGFloat = 85

// Text - OnlyOffice - Collabora - QuickLook
//
let editorText = "text"
let editorOnlyoffice = "onlyoffice"
let editorCollabora = "collabora"
let editorQuickLook = "quicklook"

let onlyofficeDocx = "onlyoffice_docx"
let onlyofficeXlsx = "onlyoffice_xlsx"
let onlyofficePptx = "onlyoffice_pptx"

// Template
//
let templateDocument = "document"
let templateSpreadsheet = "spreadsheet"
let templatePresentation = "presentation"

// Rich Workspace
//
let fileNameRichWorkspace = "Readme.md"
Expand Down Expand Up @@ -221,7 +252,9 @@ final class NCGlobal: Sendable {
let selectorSaveAsScan = "saveAsScan"
let selectorOpenDetail = "openDetail"
let selectorSynchronizationOffline = "synchronizationOffline"

let selectorPrint = "print"
let selectorDeleteFile = "deleteFile"

// Metadata : Status
//
// 0 normal
Expand Down Expand Up @@ -274,13 +307,24 @@ final class NCGlobal: Sendable {
let notificationCenterCheckUserDelaultErrorDone = "checkUserDelaultErrorDone" // userInfo: account, controller
let notificationCenterServerDidUpdate = "serverDidUpdate" // userInfo: account
let notificationCenterNetworkReachability = "networkReachability"
let notificationCenterDidCreateShareLink = "didCreateShareLink"

let notificationCenterDeleteFile = "deleteFile" // userInfo: [ocId], error
let notificationCenterCopyMoveFile = "copyMoveFile" // userInfo: [ocId] serverUrl, account, dragdrop, type (copy, move)
let notificationCenterMoveFile = "moveFile" // userInfo: [ocId], [indexPath], error
let notificationCenterCopyFile = "copyFile" // userInfo: [ocId], [indexPath], error
let notificationCenterRenameFile = "renameFile" // userInfo: serverUrl, account, error
let notificationCenterFavoriteFile = "favoriteFile" // userInfo: ocId, serverUrl
let notificationCenterFileExists = "fileExists" // userInfo: ocId, fileExists
let notificationCenterReloadDataSource = "reloadDataSource" // userInfo: serverUrl?, clearDataSource

let notificationCenterMenuSearchTextPDF = "menuSearchTextPDF"
let notificationCenterMenuGotToPageInPDF = "menuGotToPageInPDF"

let notificationCenterOpenMediaDetail = "openMediaDetail" // userInfo: ocId

let notificationCenterDismissScanDocument = "dismissScanDocument"
let notificationCenterDismissUploadAssets = "dismissUploadAssets"

let notificationCenterEnableSwipeGesture = "enableSwipeGesture"
let notificationCenterDisableSwipeGesture = "disableSwipeGesture"
Expand All @@ -305,7 +349,7 @@ final class NCGlobal: Sendable {
let networkingStatusUploaded = "statusUploaded"

let networkingStatusReloadAvatar = "statusReloadAvatar"

let notificationCenterUpdateIcons = "updateIcons"

// TIP
//
Expand Down Expand Up @@ -388,7 +432,21 @@ final class NCGlobal: Sendable {
//
let taskDescriptionRetrievesProperties = "retrievesProperties"
let taskDescriptionSynchronization = "synchronization"

let taskDescriptionDeleteFileOrFolder = "deleteFileOrFolder"

// MoEngage App Version
//
let moEngageAppVersion = 854

// Filename Mask and Type
//
let keyFileNameMask = "fileNameMask"
let keyFileNameType = "fileNameType"
let keyFileNameAutoUploadMask = "fileNameAutoUploadMask"
let keyFileNameAutoUploadType = "fileNameAutoUploadType"
let keyFileNameOriginal = "fileNameOriginal"
let keyFileNameOriginalAutoUpload = "fileNameOriginalAutoUpload"

// LOG TAG
//
let logTagTask = "BGT"
Expand All @@ -407,6 +465,10 @@ final class NCGlobal: Sendable {
//
let udMigrationMultiDomains = "migrationMultiDomains"
let udLastVersion = "lastVersion"

// Album
//
let selectedTabIndexAlbum: Int = 3
}

/**
Expand Down
5 changes: 3 additions & 2 deletions iOSClient/Trash/Cell/NCTrashCellProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ extension NCTrashCellProtocol where Self: UICollectionViewCell {
self.labelInfo?.text = dateFormatter.string(from: tableTrash.trashbinDeletionTime as Date)
}
if tableTrash.directory {
self.imageItem.image = NCImageCache.shared.getFolder(account: tableTrash.account)
self.imageItem.image = NCImageCache.shared.getFolder()
} else {
self.imageItem.image = image
self.labelInfo?.text = (self.labelInfo?.text ?? "") + " · " + NCUtilityFileSystem().transformedSize(tableTrash.size)
// self.labelInfo?.text = (self.labelInfo?.text ?? "") + " · " + NCUtilityFileSystem().transformedSize(tableTrash.size)
}
self.labelInfo?.text = (self.labelInfo?.text ?? "") + " · " + NCUtilityFileSystem().transformedSize(tableTrash.size)
self.accessibilityLabel = tableTrash.trashbinFileName + ", " + (self.labelInfo?.text ?? "")
}
}
6 changes: 4 additions & 2 deletions iOSClient/Trash/Cell/NCTrashListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCellProtocol {

]

imageRestore.image = NCUtility().loadImage(named: "arrow.counterclockwise", colors: [NCBrandColor.shared.iconImageColor])
imageMore.image = NCUtility().loadImage(named: "trash", colors: [.red])
// imageRestore.image = NCUtility().loadImage(named: "arrow.counterclockwise", colors: [NCBrandColor.shared.iconImageColor])
// imageMore.image = NCUtility().loadImage(named: "trash", colors: [.red])
imageRestore.image = NCUtility().loadImage(named: "restore", colors: [NCBrandColor.shared.iconImageColor])
imageMore.image = NCUtility().loadImage(named: "trashIcon", colors: [NCBrandColor.shared.iconImageColor]) //NCUtility().loadImage(named: "trashIcon", colors: [.red])
imageItem.layer.cornerRadius = 6
imageItem.layer.masksToBounds = true

Expand Down
31 changes: 30 additions & 1 deletion iOSClient/Trash/NCTrash+CollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,39 @@ extension NCTrash: UICollectionViewDataSource {

return text
}

func setTitleLabel(directories: Int, files: Int, size: Int64) -> String {
var foldersText = ""
var filesText = ""
var text = ""

if directories > 1 {
foldersText = "\(directories) " + NSLocalizedString("_folders_", comment: "")
} else if directories == 1 {
foldersText = "1 " + NSLocalizedString("_folder_", comment: "")
}

if files > 1 {
filesText = "\(files) " + NSLocalizedString("_files_", comment: "") + " • " + utilityFileSystem.transformedSize(size)
} else if files == 1 {
filesText = "1 " + NSLocalizedString("_file_", comment: "") + " • " + utilityFileSystem.transformedSize(size)
}

if foldersText.isEmpty {
text = filesText
} else if filesText.isEmpty {
text = foldersText
} else {
text = foldersText + " • " + filesText
}
return text
}

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if kind == UICollectionView.elementKindSectionHeader {
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFirstHeaderEmptyData", for: indexPath) as? NCSectionFirstHeaderEmptyData
else { return NCSectionFirstHeaderEmptyData() }
header.emptyImage.image = utility.loadImage(named: "trash", colors: [NCBrandColor.shared.getElement(account: session.account)])
header.emptyImage.image = utility.loadImage(named: "trashIcon", colors: [NCBrandColor.shared.getElement(account: session.account)])
header.emptyTitle.text = NSLocalizedString("_trash_no_trash_", comment: "")
header.emptyDescription.text = NSLocalizedString("_trash_no_trash_description_", comment: "")
return header
Expand All @@ -153,6 +180,8 @@ extension NCTrash: UICollectionViewDataSource {
else { return NCSectionFooter() }
if let datasource {
footer.setTitleLabel(setTextFooter(datasource: datasource))
// let info = self.getFooterInformation(datasource: datasource)
// footer.setTitleLabel(directories: info.directories, files: info.files, size: info.size)
}
return footer
}
Expand Down
19 changes: 19 additions & 0 deletions iOSClient/Trash/NCTrash.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCTrashGridCellDelegat
await self.reloadDataSource()
await loadListingTrash()
}
AnalyticsHelper.shared.trackEvent(eventName: .SCREEN_EVENT__DELETED_FILES)
}

override func viewWillDisappear(_ animated: Bool) {
Expand Down Expand Up @@ -200,4 +201,22 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCTrashGridCellDelegat
return filePath + "/"
}
}

func getFooterInformation(datasource: [tableTrash]) -> (directories: Int, files: Int, size: Int64) {
let validMetadatas = datasource.filter { !$0.isInvalidated }
let directories = validMetadatas.filter({ $0.directory == true})
let files = validMetadatas.filter({ $0.directory == false})

var size: Int64 = 0

directories.forEach { metadata in
size += metadata.size
}

files.forEach { metadata in
size += metadata.size
}

return (directories.count, files.count, size)
}
}