marinofaggiana 4 years ago
parent
commit
e1b65cf093

+ 1 - 1
Cartfile

@@ -1,4 +1,4 @@
-github "nextcloud/ios-communication-library" "v0.71"
+github "nextcloud/ios-communication-library" "develop"
 github "tilltue/TLPhotoPicker" "2.0.11"
 github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
 github "MortimerGoro/MGSwipeTableCell" "1.6.8"

+ 1 - 1
Cartfile.resolved

@@ -19,7 +19,7 @@ github "malcommac/SwiftRichString" "3.7.1"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
 github "marinofaggiana/TOPasscodeViewController" "0.0.7"
 github "marinofaggiana/XLForm" "eb9381ad8129f60402bf412250fb31b95a628a08"
-github "nextcloud/ios-communication-library" "v0.71"
+github "nextcloud/ios-communication-library" "8f2602605288b5b14831b4f44696837bb6aa492b"
 github "realm/realm-cocoa" "v5.2.0"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.5"

+ 4 - 5
File Provider Extension/FileProviderEnumerator.swift

@@ -277,13 +277,12 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
         
         let offset = (page - 1) * limit
         let serverUrl = fileProviderData.sharedInstance.accountUrl
-        var fileNamePath = "/"
-        
-        if serverUrl != fileProviderData.sharedInstance.accountUrl {
-            fileNamePath = CCUtility.returnPathfromServerUrl(serverUrl, activeUrl: fileProviderData.sharedInstance.accountUrl)!
+        var fileNamePath = CCUtility.returnPathfromServerUrl(serverUrl, activeUrl: fileProviderData.sharedInstance.accountUrl)!
+        if fileNamePath == "" {
+            fileNamePath = "/"
         }
         
-        NCCommunication.shared.iosHelper(fileNamePath: fileNamePath, offset: offset, limit: limit) { (account, files, errorCode, errorDescription) in
+        NCCommunication.shared.iosHelper(fileNamePath: fileNamePath, serverUrl: serverUrl, offset: offset, limit: limit) { (account, files, errorCode, errorDescription) in
             
              if errorCode == 0 && files != nil  && files!.count >= 1 {
                                 

+ 26 - 1
iOSClient/Networking/NCOperationQueue.swift

@@ -245,11 +245,36 @@ class NCOperationReadFileForMediaQueue: ConcurrentOperation {
             """
             <?xml version=\"1.0\" encoding=\"UTF-8\"?>
             <d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">
+            <d:prop>
+                <has-preview xmlns=\"http://nextcloud.org/ns\"/>
+                <creation_time xmlns=\"http://nextcloud.org/ns\"/>
+                <upload_time xmlns=\"http://nextcloud.org/ns\"/>
+            </d:prop>
             </d:propfind>
             """
             
             NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", requestBody: requestBody.data(using: .utf8)) { (account, files, responseData, errorCode, errorDescription) in
-                if errorCode == 404 {
+                if errorCode == 0 && files != nil {
+                    if let file = files?[0] {
+                        let metadata = tableMetadata.init(value: self.metadata)
+                        var modify = false
+                        if metadata.hasPreview != file.hasPreview {
+                            metadata.hasPreview = file.hasPreview
+                            modify = true
+                        }
+                        if file.creationDate != nil && metadata.creationDate != file.creationDate {
+                            metadata.creationDate = file.creationDate!
+                            modify = true
+                        }
+                        if file.uploadDate != nil && metadata.uploadDate != file.uploadDate {
+                            metadata.uploadDate = file.uploadDate!
+                            modify = true
+                        }
+                        if modify {
+                            NCManageDatabase.sharedInstance.addMetadata(metadata)
+                        }
+                    }
+                } else if errorCode == 404 {
                     NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", self.metadata.ocId))
                     NotificationCenter.default.postOnMainThread(name: k_notificationCenter_deleteFile, userInfo: ["metadata": self.metadata, "errorCode": errorCode])
                 }