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
58 changes: 54 additions & 4 deletions iOSClient/NCGlobal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ final class NCGlobal: Sendable {
// Intro selector
//
let introLogin: Int = 0
let introSignup: Int = 1
let introSignUpWithProvider: Int = 1

// Avatar
//
let avatarSize: Int = 128 * Int(UIScreen.main.scale)
let avatarSizeRounded: Int = 128

// Preview size
//
let size1024: CGSize = CGSize(width: 1024, height: 1024)
Expand Down Expand Up @@ -138,7 +139,35 @@ 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,6 +250,8 @@ final class NCGlobal: Sendable {
let selectorSaveAsScan = "saveAsScan"
let selectorOpenDetail = "openDetail"
let selectorSynchronizationOffline = "synchronizationOffline"
let selectorPrint = "print"
let selectorDeleteFile = "deleteFile"

// Metadata : Status
//
Expand Down Expand Up @@ -251,7 +282,6 @@ final class NCGlobal: Sendable {
let metadataStatusForScreenAwake = [-1, -2, 1, 2]
let metadataStatusHideInView = [1, 2, 3, 11]
let metadataStatusWaitWebDav = [10, 11, 12, 13, 14, 15]
let metadataStatusTransfers = [-2, -3, 2, 3, 10, 11, 12, 13, 14, 15]

let metadatasStatusInWaiting = [-1, 1, 10, 11, 12, 13, 14, 15]
let metadatasStatusInProgress = [-2, 2]
Expand All @@ -268,13 +298,17 @@ final class NCGlobal: Sendable {
let notificationCenterChangeTheming = "changeTheming" // userInfo: account
let notificationCenterRichdocumentGrabFocus = "richdocumentGrabFocus"
let notificationCenterReloadDataNCShare = "reloadDataNCShare"
let notificationCenterDidCreateShareLink = "didCreateShareLink"

let notificationCenterCloseRichWorkspaceWebView = "closeRichWorkspaceWebView"
let notificationCenterReloadAvatar = "reloadAvatar"
let notificationCenterClearCache = "clearCache"
let notificationCenterCheckUserDelaultErrorDone = "checkUserDelaultErrorDone" // userInfo: account, controller
let notificationCenterServerDidUpdate = "serverDidUpdate" // userInfo: account
let notificationCenterNetworkReachability = "networkReachability"

let notificationCenterRenameFile = "renameFile" // userInfo: serverUrl, account, error

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

Expand All @@ -288,6 +322,7 @@ final class NCGlobal: Sendable {
let notificationCenterPlayerIsPlaying = "playerIsPlaying"
let notificationCenterPlayerStoppedPlaying = "playerStoppedPlaying"

let notificationCenterFavoriteStatusChanged = "favoriteStatusChanged"
let notificationCenterUserInteractionMonitor = "serInteractionMonitor"

// Networking Status
Expand All @@ -304,8 +339,9 @@ final class NCGlobal: Sendable {
let networkingStatusUploading = "statusUploading"
let networkingStatusUploaded = "statusUploaded"

let networkingStatusReloadAvatar = "statusReloadAvatar"

let networkingStatusReloadAvatar = "statusReloadAvatar"
let notificationCenterUpdateIcons = "updateIcons"

// TIP
//
Expand Down Expand Up @@ -388,6 +424,20 @@ 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
//
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Trash/Cell/NCTrashCellProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extension NCTrashCellProtocol where Self: UICollectionViewCell {
self.imageItem.image = NCImageCache.shared.getFolder(account: tableTrash.account)
} 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.accessibilityLabel = tableTrash.trashbinFileName + ", " + (self.labelInfo?.text ?? "")
}
}
19 changes: 2 additions & 17 deletions iOSClient/Trash/Cell/NCTrashGridCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,8 @@
// NCTrashGridCell.swift
// Nextcloud
//
// Created by Marino Faggiana on 19/03/2024.
// Copyright © 2024 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
//
// 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 <http://www.gnu.org/licenses/>.
// Created by A200073704 on 27/06/23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//

import UIKit
Expand Down
4 changes: 2 additions & 2 deletions iOSClient/Trash/Cell/NCTrashListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ 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: "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
36 changes: 13 additions & 23 deletions iOSClient/Trash/NCTrash+CollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,58 +101,48 @@ extension NCTrash: UICollectionViewDataSource {

return cell
}

func setTextFooter(datasource: [tableTrash]) -> String {
var folders: Int = 0, foldersText = ""
var files: Int = 0, filesText = ""
var size: Int64 = 0

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

for record: tableTrash in datasource {
if record.directory {
folders += 1
} else {
files += 1
size += record.size
}
}

if folders > 1 {
foldersText = "\(folders) " + NSLocalizedString("_folders_", comment: "")
} else if folders == 1 {
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)
filesText = "\(files) " + NSLocalizedString("_files_", comment: "") + " " + utilityFileSystem.transformedSize(size)
} else if files == 1 {
filesText = "1 " + NSLocalizedString("_file_", comment: "") + " " + utilityFileSystem.transformedSize(size)
filesText = "1 " + NSLocalizedString("_file_", comment: "") + " " + utilityFileSystem.transformedSize(size)
}

if foldersText.isEmpty {
text = filesText
} else if filesText.isEmpty {
text = foldersText
} else {
text = foldersText + ", " + filesText
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
} else {
guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter
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
18 changes: 18 additions & 0 deletions iOSClient/Trash/NCTrash.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,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)
}
}