marinofaggiana 5 жил өмнө
parent
commit
e42e0fe889

+ 4 - 0
File Provider Extension/FileProviderEnumerator.swift

@@ -147,6 +147,10 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
                     
                     if fileProviderData.sharedInstance.listServerUrlEtag[serverUrl] == nil || fileProviderData.sharedInstance.listServerUrlEtag[serverUrl] != metadata!.etag || metadatasFromDB == nil {
                         
+                        OCNetworking.sharedManager()?.search(withAccount: fileProviderData.sharedInstance.account, folder: "", startWith: "a", serverUrl: fileProviderData.sharedInstance.accountUrl, dateLastModified: nil, numberOfItem: 2, completion: { (account, metadatas, message, errorCode) in
+                            print(message ?? "NO MESSAGE")
+                        })
+                        
                         OCNetworking.sharedManager().readFolder(withAccount: fileProviderData.sharedInstance.account, serverUrl: serverUrl, depth: "1", completion: { (account, metadatas, metadataFolder, message, errorCode) in
                             
                             if errorCode == 0 && account == fileProviderData.sharedInstance.account {

+ 7 - 5
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -421,9 +421,6 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     body = [NSString stringWithFormat: @""
             "<?xml version=\"1.0\"?>"
                 "<d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
-                "<d:limit>"
-                    "<d:nresults>10</d:nresults>"
-                "</d:limit>"
                 "<d:basicsearch>"
                     "<d:select>"
                         "<d:prop>"
@@ -444,7 +441,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
                     "<d:from>"
                         "<d:scope>"
                             "<d:href>/files/%@%@</d:href>"
-                            "<d:depth>1</d:depth>"
+                            "<d:depth>0</d:depth>"
                         "</d:scope>"
                     "</d:from>"
                     "<d:orderby>"
@@ -463,9 +460,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
                             "<d:literal>%@</d:literal>"
                         "</d:gte>"
                     "</d:or></d:and></d:where>"
+            
+                    "<d:limit>"
+                        "<d:nresults>%@</d:nresults>"
+                    "</d:limit>"
+            
                 "</d:basicsearch>"
                 "</d:searchrequest>"
-    ,userID, folderStartWith, dateLastModified];
+    ,userID, folderStartWith, dateLastModified, [@(numberOfItem) stringValue]];
     
     [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
     [request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];

+ 2 - 2
iOSClient/Networking/OCNetworking.m

@@ -973,7 +973,7 @@
     }
     
     NSString *path = [tableAccount.url stringByAppendingString:k_dav];
-    NSString *folderStartWith = [serverUrl stringByReplacingOccurrencesOfString:[CCUtility getHomeServerUrlActiveUrl:tableAccount.url] withString:@""];
+    NSString *folderStartWith = @""; //[serverUrl stringByReplacingOccurrencesOfString:[CCUtility getHomeServerUrlActiveUrl:tableAccount.url] withString:@""];
     
     NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
     NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
@@ -985,7 +985,7 @@
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:[CCUtility getPassword:account]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    [communication search:path folderStartWith:folderStartWith dateLastModified:dateLastModifiedString numberOfItem:10 withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+    [communication search:path folderStartWith:folderStartWith dateLastModified:dateLastModifiedString numberOfItem:numberOfItem withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         completion(account, nil, nil, 0);