Browse Source

#570 Error With Apple Works Suite & import from Photos App

Marino Faggiana 6 years ago
parent
commit
feedb97b71

+ 13 - 18
PickerFileProvider/FileProvider.swift

@@ -852,11 +852,6 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
         */
     }
     
-    override func setLastUsedDate(_ lastUsedDate: Date?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) {
-        print("[LOG] setLastUsedDate")
-        completionHandler(nil, nil)
-    }
-    
     override func setTagData(_ tagData: Data?, forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) {
         
         /* ONLY iOS 11*/
@@ -909,19 +904,6 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
         let fileCoordinator = NSFileCoordinator()
         var error: NSError?
         
-        do {
-            let attributes = try self.fileManager.attributesOfItem(atPath: fileURL.path)
-            size = attributes[FileAttributeKey.size] as! Double
-            let typeFile = attributes[FileAttributeKey.type] as! FileAttributeType
-            if typeFile == FileAttributeType.typeDirectory {
-                completionHandler(nil, NSFileProviderError(.noSuchItem))
-                return
-            }
-        } catch {
-            completionHandler(nil, NSFileProviderError(.noSuchItem))
-            return
-        }
-        
         DispatchQueue.main.async {
             
             guard let tableDirectory = getTableDirectoryFromParentItemIdentifier(parentItemIdentifier) else {
@@ -951,6 +933,19 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
             
             fileURL.stopAccessingSecurityScopedResource()
             
+            do {
+                let attributes = try self.fileManager.attributesOfItem(atPath: fileNamePathDirectory + "/" + fileName)
+                size = attributes[FileAttributeKey.size] as! Double
+                let typeFile = attributes[FileAttributeKey.type] as! FileAttributeType
+                if typeFile == FileAttributeType.typeDirectory {
+                    completionHandler(nil, NSFileProviderError(.noSuchItem))
+                    return
+                }
+            } catch {
+                completionHandler(nil, NSFileProviderError(.noSuchItem))
+                return
+            }
+            
             // ---------------------------------------------------------------------------------
             
             // Metadata TEMP

+ 1 - 1
iOSClient/Brand/Picker.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.21.0</string>
 	<key>CFBundleVersion</key>
-	<string>00009</string>
+	<string>00010</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 1 - 1
iOSClient/Brand/PickerFileProvider.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.21.0</string>
 	<key>CFBundleVersion</key>
-	<string>00009</string>
+	<string>00010</string>
 	<key>NSExtension</key>
 	<dict>
 		<key>NSExtensionFileProviderDocumentGroup</key>

+ 1 - 1
iOSClient/Brand/Share.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.21.0</string>
 	<key>CFBundleVersion</key>
-	<string>00009</string>
+	<string>00010</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 1 - 1
iOSClient/Brand/iOSClient.plist

@@ -69,7 +69,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>00009</string>
+	<string>00010</string>
 	<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
 	<true/>
 	<key>Fabric</key>