From 7a69a62dd5a7a212a144d25bc36a10ca6eb31616 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:57:57 +0530 Subject: [PATCH 1/3] NMC 2253 - Context menu customisation changes --- iOSClient/Menu/NCViewer+Menu.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iOSClient/Menu/NCViewer+Menu.swift b/iOSClient/Menu/NCViewer+Menu.swift index 43104efd3b..6ec2bcebe2 100644 --- a/iOSClient/Menu/NCViewer+Menu.swift +++ b/iOSClient/Menu/NCViewer+Menu.swift @@ -172,6 +172,11 @@ extension NCViewer { ) ) } + // COPY IN PASTEBOARD + // + if !webView, metadata.isCopyableInPasteboard { + actions.append(.copyAction(selectOcId: [metadata.ocId])) + } // // PDF From 0a4e9b4337860fc58880242ac621b86cff151fda Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:52:24 +0530 Subject: [PATCH 2/3] NMC 2253 - Menu update after NC 5.0 Release --- iOSClient/Menu/NCViewer+Menu.swift | 49 +++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/iOSClient/Menu/NCViewer+Menu.swift b/iOSClient/Menu/NCViewer+Menu.swift index 6ec2bcebe2..ea20ed3c5b 100644 --- a/iOSClient/Menu/NCViewer+Menu.swift +++ b/iOSClient/Menu/NCViewer+Menu.swift @@ -67,7 +67,7 @@ extension NCViewer { // FAVORITE // Workaround: PROPPATCH doesn't work // https://github.com/nextcloud/files_lock/issues/68 - if !metadata.lock { + if !metadata.lock, !metadata.isDirectoryE2EE{ actions.append( NCMenuAction( title: metadata.favorite ? NSLocalizedString("_remove_favorites_", comment: "") : NSLocalizedString("_add_favorites_", comment: ""), @@ -96,9 +96,9 @@ extension NCViewer { if !webView, metadata.canShare { actions.append(.share(selectedMetadatas: [metadata], controller: controller)) } - + // - // SAVE LIVE PHOTO + // PRINT // if let metadataMOV = self.database.getMetadataLivePhoto(metadata: metadata), let hudView = controller.view { @@ -143,6 +143,47 @@ extension NCViewer { ) ) } + + // + // SAVE CAMERA ROLL + // + if !webView, metadata.isSavebleInCameraRoll { + actions.append(.saveMediaAction(selectedMediaMetadatas: [metadata])) + } + + + // + // RENAME + // + if !webView, metadata.isRenameable, !metadata.isDirectoryE2EE { + actions.append( + NCMenuAction( + title: NSLocalizedString("_rename_", comment: ""), + icon: utility.loadImage(named: "text.cursor", colors: [NCBrandColor.shared.iconImageColor]), + action: { _ in + + if let vcRename = UIStoryboard(name: "NCRenameFile", bundle: nil).instantiateInitialViewController() as? NCRenameFile { + + vcRename.metadata = metadata + vcRename.disableChangeExt = true + vcRename.imagePreview = imageIcon + vcRename.indexPath = indexPath + + let popup = NCPopupViewController(contentController: vcRename, popupWidth: vcRename.width, popupHeight: vcRename.height) + + viewController.present(popup, animated: true) + } + } + ) + ) + } + + // + // COPY - MOVE + // + if !webView, metadata.isCopyableMovable { + actions.append(.moveOrCopyAction(selectedMetadatas: [metadata], viewController: viewController, indexPath: [])) + } // // DOWNLOAD - LOCAL @@ -174,7 +215,7 @@ extension NCViewer { } // COPY IN PASTEBOARD // - if !webView, metadata.isCopyableInPasteboard { + if !webView, metadata.isCopyableInPasteboard, !metadata.isDirectoryE2EE { actions.append(.copyAction(selectOcId: [metadata.ocId])) } From cbffc6c99b3be4e5b4c60ec6070537602935de0d Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Thu, 10 Apr 2025 12:49:31 +0530 Subject: [PATCH 3/3] NMC 2253 - Context menu customisation changes --- iOSClient/Menu/NCViewer+Menu.swift | 103 +++++------------------------ 1 file changed, 16 insertions(+), 87 deletions(-) diff --git a/iOSClient/Menu/NCViewer+Menu.swift b/iOSClient/Menu/NCViewer+Menu.swift index ea20ed3c5b..486c9977e1 100644 --- a/iOSClient/Menu/NCViewer+Menu.swift +++ b/iOSClient/Menu/NCViewer+Menu.swift @@ -33,21 +33,6 @@ extension NCViewer { let localFile = self.database.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) let isOffline = localFile?.offline == true - // - // DETAIL - // - if !NCCapabilities.shared.disableSharesView(account: metadata.account) { - actions.append( - NCMenuAction( - title: NSLocalizedString("_details_", comment: ""), - icon: utility.loadImage(named: "info.circle", colors: [NCBrandColor.shared.iconImageColor]), - action: { _ in - NCActionCenter.shared.openShare(viewController: controller, metadata: metadata, page: .activity) - } - ) - ) - } - // // VIEW IN FOLDER // @@ -55,7 +40,7 @@ extension NCViewer { actions.append( NCMenuAction( title: NSLocalizedString("_view_in_folder_", comment: ""), - icon: utility.loadImage(named: "questionmark.folder", colors: [NCBrandColor.shared.iconImageColor]), + icon: utility.loadImage(named: "arrow.forward.square", colors: [NCBrandColor.shared.iconColor]), action: { _ in NCActionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileNameBlink: metadata.fileName, fileNameOpen: nil, sceneIdentifier: controller.sceneIdentifier) } @@ -71,7 +56,7 @@ extension NCViewer { actions.append( NCMenuAction( title: metadata.favorite ? NSLocalizedString("_remove_favorites_", comment: "") : NSLocalizedString("_add_favorites_", comment: ""), - icon: utility.loadImage(named: metadata.favorite ? "star.slash" : "star", colors: [NCBrandColor.shared.yellowFavorite]), + icon: utility.loadImage(named: "star.fill", colors: [NCBrandColor.shared.yellowFavorite]), action: { _ in NCNetworking.shared.favoriteMetadata(metadata) { error in if error != .success { @@ -100,44 +85,16 @@ extension NCViewer { // // PRINT // - if let metadataMOV = self.database.getMetadataLivePhoto(metadata: metadata), - let hudView = controller.view { - actions.append( - NCMenuAction( - title: NSLocalizedString("_livephoto_save_", comment: ""), - icon: NCUtility().loadImage(named: "livephoto", colors: [NCBrandColor.shared.iconImageColor]), - action: { _ in - NCNetworking.shared.saveLivePhotoQueue.addOperation(NCOperationSaveLivePhoto(metadata: metadata, metadataMOV: metadataMOV, hudView: hudView)) - } - ) - ) - } - - // - // SAVE AS SCAN - // - if !webView, metadata.isSavebleAsImage { + if !webView, metadata.isPrintable { actions.append( NCMenuAction( - title: NSLocalizedString("_save_as_scan_", comment: ""), - icon: utility.loadImage(named: "doc.viewfinder", colors: [NCBrandColor.shared.iconImageColor]), + title: NSLocalizedString("_print_", comment: ""), + icon: utility.loadImage(named: "printer", colors: [NCBrandColor.shared.iconColor]), action: { _ in if self.utilityFileSystem.fileProviderStorageExists(metadata) { - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, - object: nil, - userInfo: ["ocId": metadata.ocId, - "ocIdTransfer": metadata.ocIdTransfer, - "session": metadata.session, - "selector": NCGlobal.shared.selectorSaveAsScan, - "error": NKError(), - "account": metadata.account], - second: 0.5) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorPrint, "error": NKError(), "account": metadata.account, "ocIdTransfer": metadata.ocIdTransfer]) } else { - guard let metadata = self.database.setMetadatasSessionInWaitDownload(metadatas: [metadata], - session: NCNetworking.shared.sessionDownload, - selector: NCGlobal.shared.selectorSaveAsScan, - sceneIdentifier: controller.sceneIdentifier) else { return } - NCNetworking.shared.download(metadata: metadata, withNotificationProgressTask: true) + NCNetworking.shared.downloadQueue.addOperation(NCOperationDownload(metadata: metadata, selector: NCGlobal.shared.selectorPrint)) } } ) @@ -148,7 +105,7 @@ extension NCViewer { // SAVE CAMERA ROLL // if !webView, metadata.isSavebleInCameraRoll { - actions.append(.saveMediaAction(selectedMediaMetadatas: [metadata])) + actions.append(.saveMediaAction(selectedMediaMetadatas: [metadata], controller: controller)) } @@ -159,7 +116,7 @@ extension NCViewer { actions.append( NCMenuAction( title: NSLocalizedString("_rename_", comment: ""), - icon: utility.loadImage(named: "text.cursor", colors: [NCBrandColor.shared.iconImageColor]), + icon: utility.loadImage(named: "rename", colors: [NCBrandColor.shared.iconColor]), action: { _ in if let vcRename = UIStoryboard(name: "NCRenameFile", bundle: nil).instantiateInitialViewController() as? NCRenameFile { @@ -171,7 +128,7 @@ extension NCViewer { let popup = NCPopupViewController(contentController: vcRename, popupWidth: vcRename.width, popupHeight: vcRename.height) - viewController.present(popup, animated: true) + controller.present(popup, animated: true) } } ) @@ -182,41 +139,13 @@ extension NCViewer { // COPY - MOVE // if !webView, metadata.isCopyableMovable { - actions.append(.moveOrCopyAction(selectedMetadatas: [metadata], viewController: viewController, indexPath: [])) - } - - // - // DOWNLOAD - LOCAL - // - if !webView, metadata.session.isEmpty, !self.utilityFileSystem.fileProviderStorageExists(metadata) { - var title = "" - if metadata.isImage { - title = NSLocalizedString("_try_download_full_resolution_", comment: "") - } else if metadata.isVideo { - title = NSLocalizedString("_download_video_", comment: "") - } else if metadata.isAudio { - title = NSLocalizedString("_download_audio_", comment: "") - } else { - title = NSLocalizedString("_download_file_", comment: "") - } - actions.append( - NCMenuAction( - title: title, - icon: utility.loadImage(named: "iphone.circle", colors: [NCBrandColor.shared.iconImageColor]), - action: { _ in - guard let metadata = self.database.setMetadatasSessionInWaitDownload(metadatas: [metadata], - session: NCNetworking.shared.sessionDownload, - selector: "", - sceneIdentifier: controller.sceneIdentifier) else { return } - NCNetworking.shared.download(metadata: metadata, withNotificationProgressTask: true) - } - ) - ) + actions.append(.moveOrCopyAction(selectedMetadatas: [metadata], controller: controller)) } + // COPY IN PASTEBOARD // if !webView, metadata.isCopyableInPasteboard, !metadata.isDirectoryE2EE { - actions.append(.copyAction(selectOcId: [metadata.ocId])) + actions.append(.copyAction(fileSelect: [metadata.ocId], controller: controller)) } // @@ -226,7 +155,7 @@ extension NCViewer { actions.append( NCMenuAction( title: NSLocalizedString("_search_", comment: ""), - icon: utility.loadImage(named: "magnifyingglass", colors: [NCBrandColor.shared.iconImageColor]), + icon: utility.loadImage(named: "search", colors: [NCBrandColor.shared.iconColor]), action: { _ in NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMenuSearchTextPDF) } @@ -236,7 +165,7 @@ extension NCViewer { actions.append( NCMenuAction( title: NSLocalizedString("_go_to_page_", comment: ""), - icon: utility.loadImage(named: "number.circle", colors: [NCBrandColor.shared.iconImageColor]), + icon: utility.loadImage(named: "go-to-page", colors: [NCBrandColor.shared.iconColor]), action: { _ in NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMenuGotToPageInPDF) } @@ -251,7 +180,7 @@ extension NCViewer { actions.append( NCMenuAction( title: NSLocalizedString("_modify_", comment: ""), - icon: utility.loadImage(named: "pencil.tip.crop.circle", colors: [NCBrandColor.shared.iconImageColor]), + icon: utility.loadImage(named: "pencil.tip.crop.circle", colors: [NCBrandColor.shared.iconColor]), action: { _ in if self.utilityFileSystem.fileProviderStorageExists(metadata) { NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile,