浏览代码

Build 00012

Marino Faggiana 6 年之前
父节点
当前提交
6b4d3ccfd3

+ 20 - 15
PickerFileProvider/FileProvider.swift

@@ -166,9 +166,11 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
             throw NSError(domain: NSCocoaErrorDomain, code: NSFileNoSuchFileError, userInfo:[:])
         }
 
+        // Looking up the matched item; crash if nothing matched.
+        
         // Check account
         if setupActiveAccount() == false {
-            throw NSFileProviderError(.notAuthenticated)
+            assert(false, "not account available return nil!")
         }
         
         if identifier == .rootContainer {
@@ -186,6 +188,9 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
                 metadata.typeFile = k_metadataTypeFile_directory
                     
                 return FileProviderItem(metadata: metadata, parentItemIdentifier: NSFileProviderItemIdentifier(NSFileProviderItemIdentifier.rootContainer.rawValue))
+                
+            } else {
+                assert(false, "directory not found, item with \(identifier) return nil!")
             }
             
         } else {
@@ -196,14 +201,14 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
                 if parentItemIdentifier != nil {
                     let item = FileProviderItem(metadata: metadata!, parentItemIdentifier: parentItemIdentifier!)
                     return item
+                } else {
+                    assert(false, "parentItemIdentifier not found, item with \(identifier) return nil!")
                 }
             } else {
-                throw NSFileProviderError(.noSuchItem)
+                assert(false, "metadata not found, item with \(identifier) return nil!")
             }
         }
-        
-        // implement the actual lookup
-        throw NSFileProviderError(.noSuchItem)
+        //throw NSFileProviderError(.noSuchItem)
     }
     
     override func urlForItem(withPersistentIdentifier identifier: NSFileProviderItemIdentifier) -> URL? {
@@ -1266,6 +1271,16 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
 
 func setupActiveAccount() -> Bool {
     
+    groupURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.sharedInstance.capabilitiesGroups)
+    fileProviderStorageURL = groupURL!.appendingPathComponent(k_assetLocalIdentifierFileProviderStorage)
+    
+    // Create dir File Provider Storage
+    do {
+        try FileManager.default.createDirectory(atPath: fileProviderStorageURL!.path, withIntermediateDirectories: true, attributes: nil)
+    } catch let error as NSError {
+        NSLog("Unable to create directory \(error.debugDescription)")
+    }
+    
     guard let activeAccount = NCManageDatabase.sharedInstance.getAccountActive() else {
         return false
     }
@@ -1280,16 +1295,6 @@ func setupActiveAccount() -> Bool {
     
     ocNetworking = OCnetworking.init(delegate: nil, metadataNet: nil, withUser: accountUser, withUserID: accountUserID, withPassword: accountPassword, withUrl: accountUrl)
     
-    groupURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.sharedInstance.capabilitiesGroups)
-    fileProviderStorageURL = groupURL!.appendingPathComponent(k_assetLocalIdentifierFileProviderStorage)
-    
-    // Create dir File Provider Storage
-    do {
-        try FileManager.default.createDirectory(atPath: fileProviderStorageURL!.path, withIntermediateDirectories: true, attributes: nil)
-    } catch let error as NSError {
-        NSLog("Unable to create directory \(error.debugDescription)")
-    }
-    
     return true
 }
 

+ 1 - 1
iOSClient/Brand/Picker.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.21.0</string>
 	<key>CFBundleVersion</key>
-	<string>00011</string>
+	<string>00012</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>00011</string>
+	<string>00012</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>00011</string>
+	<string>00012</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 1 - 1
iOSClient/Brand/iOSClient.plist

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