Browse Source

clear old code

Marino Faggiana 6 years ago
parent
commit
6365283a88

+ 1 - 1
File Provider Extension/FileProviderExtension+Network.swift

@@ -178,7 +178,7 @@ extension FileProviderExtension {
         
         let tableMetadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND session == %@ AND (status == %d OR status == %d)", providerData.account, k_upload_session_extension, k_metadataStatusInUpload, k_metadataStatusUploading), sorted: "fileName", ascending: true)
         
-        if (tableMetadatas == nil || (tableMetadatas!.count < Int(k_maxConcurrentOperationDownloadUpload))) {
+        if (tableMetadatas == nil || (tableMetadatas!.count < Int(k_maxConcurrentOperation))) {
             
             guard let metadataForUpload = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "account == %@ AND session == %@ AND status == %d", providerData.account, k_upload_session_extension, k_metadataStatusWaitUpload)) else {
                 return

+ 0 - 2
Share/ShareViewController.h

@@ -37,8 +37,6 @@
 
 @interface ShareViewController : UIViewController <UITableViewDelegate, MBProgressHUDDelegate, BKPasscodeViewControllerDelegate, CCNetworkingDelegate, CCMoveDelegate>
 
-@property (nonatomic, strong) NSOperationQueue *networkingOperationQueue;
-
 @property (nonatomic, strong) NSString *activeAccount;
 @property (nonatomic, strong) NSString *activeUrl;
 @property (nonatomic, strong) NSString *activeUser;

+ 0 - 5
Share/ShareViewController.m

@@ -90,10 +90,6 @@
     _filesName = [[NSMutableArray alloc] init];
     _hud = [[CCHud alloc] initWithView:self.navigationController.view];
     
-    _networkingOperationQueue = [NSOperationQueue new];
-    _networkingOperationQueue.name = k_queue;
-    _networkingOperationQueue.maxConcurrentOperationCount = 1;
-    
     [CCNetworking sharedNetworking].delegate = self;
         
     [self.shareTable registerNib:[UINib nibWithNibName:@"CCCellShareExt" bundle:nil] forCellReuseIdentifier:@"ShareExtCell"];
@@ -198,7 +194,6 @@
     viewController.tintColor = tintColor;
     viewController.barTintColor = barTintColor;
     viewController.tintColorTitle = tintColor;
-    viewController.networkingOperationQueue = _networkingOperationQueue;
     // E2EE
     viewController.includeDirectoryE2EEncryption = NO;
 

+ 0 - 3
iOSClient/AppDelegate.h

@@ -65,9 +65,6 @@
 // Notification
 @property (nonatomic, strong) NSMutableArray<OCCommunication *> *listOfNotifications;
 
-// Network Operation
-@property (nonatomic, strong) NSOperationQueue *netQueue;
-
 // Networking 
 @property (nonatomic, copy) void (^backgroundSessionCompletionHandler)(void);
 

+ 1 - 6
iOSClient/AppDelegate.m

@@ -119,11 +119,6 @@
     [[NSFileManager defaultManager] copyItemAtPath:atPathDB toPath:toPathDB error:nil];
 #endif
     
-    // Operation Queue OC Networking
-    _netQueue = [[NSOperationQueue alloc] init];
-    _netQueue.name = k_queue;
-    _netQueue.maxConcurrentOperationCount = k_maxConcurrentOperation;
-       
     // UserDefaults
     self.ncUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:[NCBrandOptions sharedInstance].capabilitiesGroups];
     
@@ -1152,7 +1147,7 @@
     NSUInteger sizeDownload = 0, sizeUpload = 0;
     BOOL isE2EE = false;
     
-    long maxConcurrentOperationDownloadUpload = k_maxConcurrentOperationDownloadUpload;
+    long maxConcurrentOperationDownloadUpload = k_maxConcurrentOperation;
     
     // Detect E2EE
     NSString *saveserverUrl = @"";

+ 1 - 2
iOSClient/CCGlobal.h

@@ -168,8 +168,7 @@
 
 // ConcurrentOperation
 #define k_maxHTTPConnectionsPerHost                     5
-#define k_maxConcurrentOperation                        10
-#define k_maxConcurrentOperationDownloadUpload          5
+#define k_maxConcurrentOperation                        5
 
 // Max Size Operation
 #define k_maxSizeOperationUpload                        524288000   // 500 MB

+ 11 - 20
iOSClient/Main/CCMain.m

@@ -2335,36 +2335,27 @@
 
 - (void)changeDefaultAccount:(CCMenuItem *)sender
 {
-    [appDelegate.netQueue cancelAllOperations];
-    
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-
-        // LOGOUT
+    // LOGOUT
         
-        [appDelegate unsubscribingNextcloudServerPushNotification];
+    [appDelegate unsubscribingNextcloudServerPushNotification];
         
-        tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:[sender argument]];
-        if (tableAccount) {
+    tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:[sender argument]];
+    if (tableAccount) {
             
-            // LOGIN
+        // LOGIN
             
-            [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
+        [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
     
-            // go to home sweet home
-            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
+        // go to home sweet home
+        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
             
-            [appDelegate subscribingNextcloudServerPushNotification];
-        }
-    });
+        [appDelegate subscribingNextcloudServerPushNotification];
+    }
 }
 
 - (void)addNewAccount:(CCMenuItem *)sender
 {
-    [appDelegate.netQueue cancelAllOperations];
-    
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-        [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
-    });
+    [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 0 - 1
iOSClient/Move/CCMove.h

@@ -36,7 +36,6 @@
 @interface CCMove : UITableViewController <UIAlertViewDelegate, UITableViewDelegate, BKPasscodeViewControllerDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 
 @property (nonatomic, weak) id <CCMoveDelegate> delegate;
-@property (nonatomic, strong) NSOperationQueue *networkingOperationQueue;
 
 @property BOOL includeDirectoryE2EEncryption;
 @property BOOL includeImages;

+ 0 - 3
iOSClient/Move/CCMove.m

@@ -185,8 +185,6 @@
 
 - (IBAction)move:(UIBarButtonItem *)sender
 {
-    [_networkingOperationQueue cancelAllOperations];
- 
     if ([self.delegate respondsToSelector:@selector(dismissMove)])
         [self.delegate dismissMove];
     
@@ -521,7 +519,6 @@
     viewController.hideMoveutton = self.hideMoveutton;
     viewController.selectFile = self.selectFile;
     viewController.type = self.type;
-    viewController.networkingOperationQueue = self.networkingOperationQueue;
 
     viewController.passMetadata = metadata;
     viewController.serverUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:nomeDir];

+ 2 - 7
iOSClient/Networking/OCNetworking.h

@@ -23,12 +23,8 @@
 
 #import <Foundation/Foundation.h>
 
-#import "AFURLSessionManager.h"
-#import "TWMessageBarManager.h"
+//#import "AFURLSessionManager.h"
 #import "CCNetworking.h"
-#import "CCError.h"
-
-@class tableMetadata;
 
 @interface OCnetworking : NSObject <NSURLSessionDelegate>
 
@@ -104,8 +100,7 @@
 
 @end
 
-
-
 @interface OCURLSessionManager : AFURLSessionManager
 
 @end
+

+ 1 - 0
iOSClient/Networking/OCNetworking.m

@@ -1939,3 +1939,4 @@
 }
 
 @end
+

+ 1 - 7
iOSClient/Settings/CCAdvanced.m

@@ -328,10 +328,6 @@
     
     [self.hud visibleHudTitle:NSLocalizedString(@"_remove_cache_", nil) mode:MBProgressHUDModeIndeterminate color:nil];
     
-    if (withDB) {
-        [appDelegate.netQueue cancelAllOperations];
-    }
-    
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC),dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
         [[NSFileManager defaultManager] removeItemAtPath:[CCUtility getDirectoryProviderStorage] error:nil];
@@ -424,9 +420,7 @@
         [self.hud visibleIndeterminateHud];
         
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
-            
-            [appDelegate.netQueue cancelAllOperations];
-            
+                        
             [[NSURLCache sharedURLCache] setMemoryCapacity:0];
             [[NSURLCache sharedURLCache] setDiskCapacity:0];
             

+ 10 - 25
iOSClient/Settings/CCManageAccount.m

@@ -216,11 +216,7 @@
 {
     [self deselectFormRow:sender];
     
-    [appDelegate.netQueue cancelAllOperations];
-    
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-        [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
-    });
+    [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -231,11 +227,7 @@
 {    
     [self deselectFormRow:sender];
     
-    [appDelegate.netQueue cancelAllOperations];
-    
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-        [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
-    });
+    [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -246,8 +238,6 @@
 {
     [appDelegate unsubscribingNextcloudServerPushNotification];
     
-    [appDelegate.netQueue cancelAllOperations];
-    
     [[NCManageDatabase sharedInstance] clearTable:[tableAccount class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableCapabilities class] account:account];
@@ -303,23 +293,18 @@
 
 - (void)ChangeDefaultAccount:(NSString *)account
 {
-    [appDelegate.netQueue cancelAllOperations];
-
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-
-        tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:account];
-        if (tableAccount) {
+    tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:account];
+    if (tableAccount) {
         
-            [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
+        [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
  
-            // Init home
-            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
+        // Init home
+        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
             
-            [self UpdateForm];
+        [self UpdateForm];
             
-            [appDelegate subscribingNextcloudServerPushNotification];
-        }
-    });
+        [appDelegate subscribingNextcloudServerPushNotification];
+    }
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 0 - 1
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.m

@@ -164,7 +164,6 @@
     viewController.tintColor = [NCBrandColor sharedInstance].brandText;
     viewController.barTintColor = [NCBrandColor sharedInstance].brand;
     viewController.tintColorTitle = [NCBrandColor sharedInstance].brandText;
-    viewController.networkingOperationQueue = appDelegate.netQueue;
     // E2EE
     viewController.includeDirectoryE2EEncryption = NO;