marinofaggiana 4 vuotta sitten
vanhempi
commit
d0b7878074

+ 4 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -297,7 +297,7 @@
 		F7E0E1DC22327885006B0911 /* NCAudioRecorderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E0E1DB22327885006B0911 /* NCAudioRecorderViewController.swift */; };
 		F7E0E1DE22327DBA006B0911 /* NCAudioRecorderViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7E0E1DD22327DBA006B0911 /* NCAudioRecorderViewController.storyboard */; };
 		F7E4D9C422ED929B003675FD /* NCShareComments.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E4D9C322ED929B003675FD /* NCShareComments.swift */; };
-		F7EFA47825ADBA500083159A /* NCViewerPeekPop.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7EFA47725ADBA500083159A /* NCViewerPeekPop.swift */; };
+		F7EFA47825ADBA500083159A /* NCViewerProviderContextMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7EFA47725ADBA500083159A /* NCViewerProviderContextMenu.swift */; };
 		F7EFC0C6256BC77700461AAD /* NCMoreUserCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7EFC0C5256BC77700461AAD /* NCMoreUserCell.xib */; };
 		F7EFC0CD256BF8DD00461AAD /* NCUserStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7EFC0CC256BF8DD00461AAD /* NCUserStatus.swift */; };
 		F7F1E54C2492369A00E42386 /* NCMediaCommandView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7F1E54B2492369A00E42386 /* NCMediaCommandView.xib */; };
@@ -684,7 +684,7 @@
 		F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F7E4D9C322ED929B003675FD /* NCShareComments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareComments.swift; sourceTree = "<group>"; };
 		F7E856182351D7BE009A3330 /* SwiftyXMLParser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyXMLParser.framework; path = Carthage/Build/iOS/SwiftyXMLParser.framework; sourceTree = "<group>"; };
-		F7EFA47725ADBA500083159A /* NCViewerPeekPop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerPeekPop.swift; sourceTree = "<group>"; };
+		F7EFA47725ADBA500083159A /* NCViewerProviderContextMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerProviderContextMenu.swift; sourceTree = "<group>"; };
 		F7EFC0C5256BC77700461AAD /* NCMoreUserCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCMoreUserCell.xib; sourceTree = "<group>"; };
 		F7EFC0CC256BF8DD00461AAD /* NCUserStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCUserStatus.swift; sourceTree = "<group>"; };
 		F7F1E54B2492369A00E42386 /* NCMediaCommandView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCMediaCommandView.xib; sourceTree = "<group>"; };
@@ -1110,7 +1110,7 @@
 		F79630EC215526B60015EEA5 /* Viewer */ = {
 			isa = PBXGroup;
 			children = (
-				F7EFA47725ADBA500083159A /* NCViewerPeekPop.swift */,
+				F7EFA47725ADBA500083159A /* NCViewerProviderContextMenu.swift */,
 				F7F9D1BA25397CE000D9BFF5 /* NCViewer.swift */,
 				F79018B1240962C7007C9B6D /* NCViewerImage */,
 				F7A5281B254834500039CA15 /* NCViewerVideo */,
@@ -2106,7 +2106,7 @@
 				F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */,
 				F769454422E9F142000A798A /* NCShareUserMenuView.swift in Sources */,
 				F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */,
-				F7EFA47825ADBA500083159A /* NCViewerPeekPop.swift in Sources */,
+				F7EFA47825ADBA500083159A /* NCViewerProviderContextMenu.swift in Sources */,
 				F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */,
 				F7B7504B2397D38F004E13EC /* UIImage+Extensions.swift in Sources */,
 				F7EFC0CD256BF8DD00461AAD /* NCUserStatus.swift in Sources */,

+ 3 - 1
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -1052,7 +1052,9 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
         metadataTouch = metadata
         
         return UIContextMenuConfiguration(identifier: nil, previewProvider: {
-            return NCViewerPeekPop(metadata: metadata)
+            
+            return NCViewerProviderContextMenu(metadata: metadata)
+            
         }, actionProvider: { suggestedActions in
             
             let copy = UIAction(title: NSLocalizedString("_copy_file_", comment: ""), image: UIImage(systemName: "doc.on.doc") ) { action in

+ 3 - 1
iOSClient/Media/NCMedia.swift

@@ -500,7 +500,9 @@ extension NCMedia: UICollectionViewDelegate {
         let metadata = metadatas[indexPath.row]
 
         return UIContextMenuConfiguration(identifier: nil, previewProvider: {
-            return NCViewerPeekPop(metadata: metadata)
+            
+            return NCViewerProviderContextMenu(metadata: metadata)
+            
         }, actionProvider: { suggestedActions in
             
             let save = UIAction(title: NSLocalizedString("_save_selected_files_", comment: ""), image: UIImage(systemName: "square.and.arrow.down")) { action in

+ 6 - 6
iOSClient/Viewer/NCViewerPeekPop.swift → iOSClient/Viewer/NCViewerProviderContextMenu.swift

@@ -1,5 +1,5 @@
 //
-//  NCViewerPeekPop.swift
+//  NCViewerProviderContextMenu.swift
 //  Nextcloud
 //
 //  Created by Marino Faggiana on 12/01/21.
@@ -24,7 +24,7 @@
 import Foundation
 import NCCommunication
 
-class NCViewerPeekPop: UIViewController  {
+class NCViewerProviderContextMenu: UIViewController  {
 
     private let imageView = UIImageView()
     private let standardSizeWidth = UIScreen.main.bounds.width / 2
@@ -40,16 +40,15 @@ class NCViewerPeekPop: UIViewController  {
 
         imageView.clipsToBounds = true
         imageView.contentMode = .scaleAspectFill
+        view.backgroundColor = NCBrandColor.shared.backgroundView
                 
         if metadata.directory {
 
             imageView.image = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: standardSizeWidth)
-            preferredContentSize = imageView.frame.size
 
         } else {
             
             imageView.image = UIImage.init(named: metadata.iconName)?.resizeImage(size: CGSize(width: standardSizeWidth, height: standardSizeHeight), isAspectRation: true)
-            preferredContentSize = imageView.frame.size
         
             if metadata.hasPreview {
                 
@@ -57,7 +56,6 @@ class NCViewerPeekPop: UIViewController  {
                     
                     if let image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)) {
                         imageView.image = image.resizeImage(size: CGSize(width: view.frame.size.width, height: view.frame.size.height), isAspectRation: true)
-                        if let image = imageView.image { preferredContentSize = CGSize(width: image.size.width,  height: image.size.height-50) } // -50 white line bottom
                     }
                     
                 } else {
@@ -70,13 +68,15 @@ class NCViewerPeekPop: UIViewController  {
                         if errorCode == 0 {
                             if let image = imagePreview {
                                 self.imageView.image = image.resizeImage(size: CGSize(width: self.view.frame.size.width, height: self.view.frame.size.height), isAspectRation: true)
-                                self.preferredContentSize = CGSize(width: image.size.width,  height: image.size.height-50) // -50 white line bottom
+                                self.preferredContentSize = CGSize(width: self.imageView.image?.size.width ?? 0,  height: self.imageView.image?.size.height ?? 0)
                             }
                         }
                     }
                 }
             }
         }
+        
+        preferredContentSize = CGSize(width: imageView.image?.size.width ?? 0,  height: imageView.image?.size.height ?? 0)
     }
 
     required init?(coder: NSCoder) {