Browse Source

fix

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 1 year ago
parent
commit
144f97ac0f

+ 5 - 2
iOSClient/Main/NCPickerViewController.swift

@@ -129,13 +129,13 @@ class NCDocumentPickerViewController: NSObject, UIDocumentPickerDelegate {
     var viewController: UIViewController?
     var viewController: UIViewController?
 
 
     @discardableResult
     @discardableResult
-    init (tabBarController: UITabBarController, supportedTypes: [UTType], isViewerMedia: Bool, allowsMultipleSelection: Bool, viewController: UIViewController? = nil) {
+    init (tabBarController: UITabBarController, isViewerMedia: Bool, allowsMultipleSelection: Bool, viewController: UIViewController? = nil) {
 
 
         self.isViewerMedia = isViewerMedia
         self.isViewerMedia = isViewerMedia
         self.viewController = viewController
         self.viewController = viewController
         super.init()
         super.init()
 
 
-        let documentProviderMenu = UIDocumentPickerViewController(forOpeningContentTypes: supportedTypes)
+        let documentProviderMenu = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.data])
 
 
         documentProviderMenu.modalPresentationStyle = .formSheet
         documentProviderMenu.modalPresentationStyle = .formSheet
         documentProviderMenu.allowsMultipleSelection = allowsMultipleSelection
         documentProviderMenu.allowsMultipleSelection = allowsMultipleSelection
@@ -157,6 +157,9 @@ class NCDocumentPickerViewController: NSObject, UIDocumentPickerDelegate {
 
 
             let fileName = url.lastPathComponent
             let fileName = url.lastPathComponent
             let metadata = NCManageDatabase.shared.createMetadata(account: appDelegate.account, user: appDelegate.user, userId: appDelegate.userId, fileName: fileName, fileNameView: fileName, ocId: ocId, serverUrl: "", urlBase: appDelegate.urlBase, url: url.path, contentType: "")
             let metadata = NCManageDatabase.shared.createMetadata(account: appDelegate.account, user: appDelegate.user, userId: appDelegate.userId, fileName: fileName, fileNameView: fileName, ocId: ocId, serverUrl: "", urlBase: appDelegate.urlBase, url: url.path, contentType: "")
+            if metadata.classFile == NKCommon.TypeClassFile.unknow.rawValue {
+                metadata.classFile = NKCommon.TypeClassFile.video.rawValue
+            }
             NCManageDatabase.shared.addMetadata(metadata)
             NCManageDatabase.shared.addMetadata(metadata)
             NCViewer.shared.view(viewController: viewController, metadata: metadata, metadatas: [metadata], imageIcon: nil)
             NCViewer.shared.view(viewController: viewController, metadata: metadata, metadatas: [metadata], imageIcon: nil)
 
 

+ 1 - 1
iOSClient/Menu/AppDelegate+Menu.swift

@@ -57,7 +57,7 @@ extension AppDelegate {
             NCMenuAction(
             NCMenuAction(
                 title: NSLocalizedString("_upload_file_", comment: ""), icon: UIImage(named: "file")!.image(color: UIColor.systemGray, size: 50), action: { _ in
                 title: NSLocalizedString("_upload_file_", comment: ""), icon: UIImage(named: "file")!.image(color: UIColor.systemGray, size: 50), action: { _ in
                     if let tabBarController = self.window?.rootViewController as? UITabBarController {
                     if let tabBarController = self.window?.rootViewController as? UITabBarController {
-                        self.documentPickerViewController = NCDocumentPickerViewController(tabBarController: tabBarController, supportedTypes: [UTType.data], isViewerMedia: false, allowsMultipleSelection: true)
+                        self.documentPickerViewController = NCDocumentPickerViewController(tabBarController: tabBarController, isViewerMedia: false, allowsMultipleSelection: true)
                     }
                     }
                 }
                 }
             )
             )

+ 1 - 1
iOSClient/Menu/NCMedia+Menu.swift

@@ -104,7 +104,7 @@ extension NCMedia {
                     icon: NCUtility.shared.loadImage(named: "play.circle"),
                     icon: NCUtility.shared.loadImage(named: "play.circle"),
                     action: { _ in
                     action: { _ in
                         if let tabBarController =  self.appDelegate.window?.rootViewController as? UITabBarController {
                         if let tabBarController =  self.appDelegate.window?.rootViewController as? UITabBarController {
-                            self.documentPickerViewController = NCDocumentPickerViewController(tabBarController: tabBarController, supportedTypes: [UTType.movie], isViewerMedia: true, allowsMultipleSelection: false, viewController: self)
+                            self.documentPickerViewController = NCDocumentPickerViewController(tabBarController: tabBarController, isViewerMedia: true, allowsMultipleSelection: false, viewController: self)
                         }
                         }
                     }
                     }
                 )
                 )