Marino Faggiana 6 年之前
父节点
当前提交
a8436b0f66
共有 3 个文件被更改,包括 8 次插入5 次删除
  1. 1 1
      iOSClient/Networking/OCNetworking.h
  2. 2 2
      iOSClient/Networking/OCNetworking.m
  3. 5 2
      iOSClient/Trash/NCTrash.swift

+ 1 - 1
iOSClient/Networking/OCNetworking.h

@@ -76,7 +76,7 @@
 - (void)createLinkRichdocumentsWithFileID:(NSString *)fileID success:(void(^)(NSString *link))success failure:(void (^)(NSString *message, NSInteger errorCode))failure;
 - (void)createAssetRichdocumentsWithFileName:(NSString *)fileName serverUrl:(NSString *)serverUrl success:(void(^)(NSString *link))success failure:(void (^)(NSString *message, NSInteger errorCode))failure;
 
-- (void)listingTrash:(NSString *)path account:(NSString *)account success:(void(^)(NSArray *items))success failure:(void (^)(NSString *message, NSInteger errorCode))failure;
+- (void)listingTrash:(NSString *)serverUrl path:(NSString *)path account:(NSString *)account success:(void(^)(NSArray *items))success failure:(void (^)(NSString *message, NSInteger errorCode))failure;
 
 @end
 

+ 2 - 2
iOSClient/Networking/OCNetworking.m

@@ -2273,14 +2273,14 @@
 #pragma mark =====  Trash =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)listingTrash:(NSString *)path account:(NSString *)account success:(void(^)(NSArray *items))success failure:(void (^)(NSString *message, NSInteger errorCode))failure
+- (void)listingTrash:(NSString *)serverUrl path:(NSString *)path account:(NSString *)account success:(void(^)(NSArray *items))success failure:(void (^)(NSString *message, NSInteger errorCode))failure
 {
     OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
     
     [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent]];
     
-    [communication listingTrash:path onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+    [communication listingTrash:[serverUrl stringByAppendingString:path] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         // Test active account
         tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];

+ 5 - 2
iOSClient/Trash/NCTrash.swift

@@ -26,12 +26,15 @@ class NCTrash: UICollectionViewController {
         
         if path == "" {
             let userID = (appDelegate.activeUserID as NSString).addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlFragmentAllowed)
-            path = appDelegate.activeUrl + k_dav + "/trashbin/" + userID! + "/trash"
+            path = k_dav + "/trashbin/" + userID! + "/trash/"
         }
         
         let ocNetworking = OCnetworking.init(delegate: self, metadataNet: nil, withUser: appDelegate.activeUser, withUserID: appDelegate.activeUserID, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl)
         
-        ocNetworking?.listingTrash(path, account: appDelegate.activeAccount, success: { (item) in
+        ocNetworking?.listingTrash(appDelegate.activeUrl, path:path, account: appDelegate.activeAccount, success: { (item) in
+            
+            NCManageDatabase.sharedInstance.deleteTrash(filePath: self.path)
+            _ = NCManageDatabase.sharedInstance.addTrashs(item as! [tableTrash])
             
         }, failure: { (message, errorCode) in