Bladeren bron

design API Trash

Marino Faggiana 6 jaren geleden
bovenliggende
commit
07ba7d0187

+ 0 - 12
iOSClient/Library/OCCommunicationLib/OCCommunication.m

@@ -2831,18 +2831,6 @@
     }];
 }
 
-- (void)restoreTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
-{
-    OCWebDAVClient *request = [OCWebDAVClient new];
-    request = [self getRequestWithCredentials:request];
-    
-    [request restoreTrash:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *operation, id response) {
-        
-    } failure:^(NSHTTPURLResponse *response, id  _Nullable responseObject, NSError *error) {
-        failureRequest(response, error, request.redirectedServer);
-    }];
-}
-
 #pragma mark - Manage Mobile Editor OCS API
 
 - (void)eraseURLCache

+ 0 - 2
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h

@@ -665,6 +665,4 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
 
 - (void)listTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *response, id  _Nullable responseObject, NSError *error))failure;
 
-- (void)restoreTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *response, id  _Nullable responseObject, NSError *error))failure;
-
 @end

+ 0 - 16
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -1238,22 +1238,6 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     [operation resume];
 }
 
-- (void)restoreTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *response, id  _Nullable responseObject, NSError *error))failure
-{
-    NSParameterAssert(success);
-    
-    _requestMethod = @"POST";
-    
-    NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
-    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-    [request setHTTPBody:[[NSString stringWithFormat: @"path=%@",path] dataUsingEncoding:NSUTF8StringEncoding]];
-    
-    OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
-    [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-    
-    [operation resume];
-}
-
 #pragma mark - Manage Redirections
 
 - (void)setRedirectionBlockOnDatataskWithOCCommunication: (OCCommunication *) sharedOCCommunication andSessionManager:(AFURLSessionManager *) sessionManager{

+ 12 - 1
iOSClient/Trash/NCTrash.swift

@@ -139,7 +139,18 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
             NCManageDatabase.sharedInstance.deleteTrash(fileID: fileID)
             self.datasource = NCManageDatabase.sharedInstance.getTrash(filePath: self.path, sorted: "fileName", ascending: true)
             self.collectionView.reloadData()
-
+            
+            // Remove, if exists, fileID in appDelegate.filterFileID
+            for number in 0..<(self.appDelegate.filterFileID.count) {
+                
+                let fileIDDeleted = self.appDelegate.filterFileID[number] as! String
+                
+                if fileIDDeleted.range(of: fileID) != nil {
+                    self.appDelegate.filterFileID.remove(fileIDDeleted)
+                    break
+                }
+            }
+            
         }, failure: { (message, errorCode) in
             
             self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)