marinofaggiana 4 năm trước cách đây
mục cha
commit
7e2beb81f7
3 tập tin đã thay đổi với 71 bổ sung6 xóa
  1. 1 1
      Cartfile
  2. 1 2
      Cartfile.resolved
  3. 69 3
      iOSClient/Recent/NCRecent.swift

+ 1 - 1
Cartfile

@@ -1,4 +1,4 @@
-github "nextcloud/ios-communication-library" "v0.79"
+github "nextcloud/ios-communication-library" "develop"
 github "tilltue/TLPhotoPicker" "2.0.12"
 github "kishikawakatsumi/UICKeyChainStore"
 github "dzenbot/DZNEmptyDataSet" "v1.8.1"

+ 1 - 2
Cartfile.resolved

@@ -2,7 +2,6 @@ github "Alamofire/Alamofire" "5.2.2"
 github "AssistoLab/DropDown" "v2.3.13"
 github "CocoaLumberjack/CocoaLumberjack" "3.6.2"
 github "FabrizioBrancati/Queuer" "2.1.1"
-github "MortimerGoro/MGSwipeTableCell" "1.6.8"
 github "SVGKit/SVGKit" "58543f3714b34ea66cfe58636d86dcbec3514ccf"
 github "SwiftyJSON/SwiftyJSON" "5.0.0"
 github "WeTransfer/WeScan" "1.2.0"
@@ -18,7 +17,7 @@ github "malcommac/SwiftRichString" "3.7.2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
 github "marinofaggiana/OpenSSL" "6c7cf839d9c74e5a0b92bbf343e1a33b6f56a277"
 github "marinofaggiana/TOPasscodeViewController" "0.0.7"
-github "nextcloud/ios-communication-library" "v0.79"
+github "nextcloud/ios-communication-library" "15e2346ffeabca4c8d14d48de561a9299b42728f"
 github "rechsteiner/Parchment" "v2.4.0"
 github "scenee/FloatingPanel" "v1.7.6"
 github "tilltue/TLPhotoPicker" "2.0.12"

+ 69 - 3
iOSClient/Recent/NCRecent.swift

@@ -63,9 +63,75 @@ class NCRecent: NCCollectionViewCommon  {
     override func reloadDataSourceNetwork(forced: Bool = false) {
         super.reloadDataSourceNetwork(forced: forced)
         
-        self.refreshControl.endRefreshing()
-        self.isReloadDataSourceNetworkInProgress = false
-        self.reloadDataSource()
+        guard let href = NCCommunicationCommon.shared.encodeString("/files/" + appDelegate.userID) else {
+            return
+        }
+        
+        let requestBodyRecent =
+        """
+        <?xml version=\"1.0\"?>
+        <d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">
+        <d:basicsearch>
+            <d:select>
+                <d:prop>
+                    <d:displayname/>
+                    <d:getcontenttype/>
+                    <d:resourcetype/>
+                    <d:getcontentlength/>
+                    <d:getlastmodified/>
+                    <d:getetag/>
+                    <d:quota-used-bytes/>
+                    <d:quota-available-bytes/>
+                    <permissions xmlns=\"http://owncloud.org/ns\"/>
+                    <id xmlns=\"http://owncloud.org/ns\"/>
+                    <fileid xmlns=\"http://owncloud.org/ns\"/>
+                    <size xmlns=\"http://owncloud.org/ns\"/>
+                    <favorite xmlns=\"http://owncloud.org/ns\"/>
+                    <creation_time xmlns=\"http://nextcloud.org/ns\"/>
+                    <upload_time xmlns=\"http://nextcloud.org/ns\"/>
+                    <is-encrypted xmlns=\"http://nextcloud.org/ns\"/>
+                    <mount-type xmlns=\"http://nextcloud.org/ns\"/>
+                    <owner-id xmlns=\"http://owncloud.org/ns\"/>
+                    <owner-display-name xmlns=\"http://owncloud.org/ns\"/>
+                    <comments-unread xmlns=\"http://owncloud.org/ns\"/>
+                    <has-preview xmlns=\"http://nextcloud.org/ns\"/>
+                    <trashbin-filename xmlns=\"http://nextcloud.org/ns\"/>
+                    <trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/>
+                    <trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/>
+                </d:prop>
+            </d:select>
+        <d:from>
+            <d:scope>
+                <d:href>%@</d:href>
+                <d:depth>infinity</d:depth>
+            </d:scope>
+        </d:from>
+        <d:orderby>
+            <d:order>
+                <d:prop>
+                    <d:getlastmodified/>
+                </d:prop>
+                <d:descending/>
+            </d:order>
+        </d:orderby>
+            <d:limit>
+                <d:nresults>100</d:nresults>
+            </d:limit>
+        </d:basicsearch>
+        </d:searchrequest>
+        """
+        
+        let requestBody = String(format: requestBodyRecent, href)
+        
+        isReloadDataSourceNetworkInProgress = true
+        collectionView?.reloadData()
+        
+        NCCommunication.shared.searchBodyRequest(serverUrl: appDelegate.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles()) { (account, files, errorCode, errorDescription) in
+            
+            self.refreshControl.endRefreshing()
+            self.isReloadDataSourceNetworkInProgress = false
+            self.reloadDataSource()
+        }        
     }
 }