From 1c9557337b321d90f47c6d335a92c43351118c52 Mon Sep 17 00:00:00 2001 From: marinofaggiana Date: Sat, 16 Jan 2021 15:47:29 +0100 Subject: fix --- .../Main/Menu/NCCollectionViewCommon+Menu.swift | 5 ++++- iOSClient/Main/Menu/NCViewer+Menu.swift | 26 +++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'iOSClient') diff --git a/iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift b/iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift index 691b7cb08..3f887053f 100644 --- a/iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift +++ b/iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift @@ -156,14 +156,17 @@ extension NCCollectionViewCommon { // if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileImage || metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileVideo { var title: String = NSLocalizedString("_save_selected_files_", comment: "") + var icon = UIImage(named: "saveSelectedFiles")!.image(color: NCBrandColor.shared.icon, size: 50) let metadataMOV = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) if metadataMOV != nil { title = NSLocalizedString("_livephoto_save_", comment: "") + icon = UIImage(named: "livePhoto")!.image(color: NCBrandColor.shared.icon, size: 50) } + actions.append( NCMenuAction( title: title, - icon: UIImage(named: "saveSelectedFiles")!.image(color: NCBrandColor.shared.icon, size: 50), + icon: icon, action: { menuAction in if metadataMOV != nil { NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMOV: metadataMOV!) diff --git a/iOSClient/Main/Menu/NCViewer+Menu.swift b/iOSClient/Main/Menu/NCViewer+Menu.swift index b59904cbc..59a208d85 100644 --- a/iOSClient/Main/Menu/NCViewer+Menu.swift +++ b/iOSClient/Main/Menu/NCViewer+Menu.swift @@ -256,7 +256,7 @@ extension NCViewer { } // - // IMAGE - VIDEO - AUDIO + // DOWNLOAD IMAGE MAX RESOLUTION // if metadata.session == "" { if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileImage && !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) && metadata.session == "" { @@ -272,13 +272,29 @@ extension NCViewer { } } - if let metadataMOV = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) { + // + // SAVE IMAGE / VIDEO + // + if metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileImage || metadata.typeFile == NCBrandGlobal.shared.metadataTypeFileVideo { + + var title: String = NSLocalizedString("_save_selected_files_", comment: "") + var icon = UIImage(named: "saveSelectedFiles")!.image(color: NCBrandColor.shared.icon, size: 50) + let metadataMOV = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) + if metadataMOV != nil { + title = NSLocalizedString("_livephoto_save_", comment: "") + icon = UIImage(named: "livePhoto")!.image(color: NCBrandColor.shared.icon, size: 50) + } + actions.append( NCMenuAction( - title: NSLocalizedString("_livephoto_save_", comment: ""), - icon: UIImage(named: "livePhoto")!.image(color: NCBrandColor.shared.icon, size: 50), + title: title, + icon: icon, action: { menuAction in - NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMOV: metadataMOV) + if metadataMOV != nil { + NCCollectionCommon.shared.saveLivePhoto(metadata: metadata, metadataMOV: metadataMOV!) + } else { + NCOperationQueue.shared.download(metadata: metadata, selector: NCBrandGlobal.shared.selectorSaveAlbum, setFavorite: false) + } } ) ) -- cgit v1.2.3