Browse Source

clear code

Marino Faggiana 7 years ago
parent
commit
34a63e5c5c

+ 1 - 29
Picker/DocumentPickerViewController.swift

@@ -28,8 +28,6 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
     
     // MARK: - Properties
     
-    var providerDB : providerSessionDB?
-    
     lazy var fileCoordinator: NSFileCoordinator = {
     
         let fileCoordinator = NSFileCoordinator()
@@ -87,7 +85,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
     
     override func viewDidLoad() {
         
-        providerDB = providerSessionDB.sharedInstance
+        super.viewDidLoad()
         
         if let record = NCManageDatabase.sharedInstance.getAccountActive() {
             
@@ -884,8 +882,6 @@ extension DocumentPickerViewController: UITableViewDataSource {
 
 }
 
-
-
 // MARK: - Class UITableViewCell
 
 class recordMetadataCell: UITableViewCell {
@@ -894,27 +890,3 @@ class recordMetadataCell: UITableViewCell {
     @IBOutlet weak var StatusImageView: UIImageView!
     @IBOutlet weak var fileName : UILabel!
 }
-
-// MARK: - Class providerSession
-
-class providerSessionDB {
-    
-    class var sharedInstance : providerSessionDB {
-        
-        struct Static {
-            
-            static let instance = providerSessionDB()
-        }
-        
-        return Static.instance
-    }
-    
-    private init() {
-    
-        //let dirGroup = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.sharedInstance.capabilitiesGroups)
-        //let pathDB = dirGroup?.appendingPathComponent(appDatabase).appendingPathComponent("cryptocloud")
-        
-        //MagicalRecord.setupCoreDataStackWithAutoMigratingSqliteStore(at: pathDB!)
-        //MagicalRecord.setLoggingLevel(MagicalRecordLoggingLevel.off)
-    }
-}

+ 5 - 7
iOSClient/Networking/OCNetworking.m

@@ -1677,13 +1677,11 @@
 - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
 {
     // The pinnning check
-    dispatch_async(dispatch_get_main_queue(), ^{
-        if ([[CCCertificate sharedManager] checkTrustedChallenge:challenge]) {
-            completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
-        } else {
-            completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
-        }
-    });
+    if ([[CCCertificate sharedManager] checkTrustedChallenge:challenge]) {
+        completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
+    } else {
+        completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
+    }
 }
 
 @end

+ 1 - 3
iOSClient/Security/CCCertificate.m

@@ -67,9 +67,7 @@ static SecCertificateRef SecTrustGetLeafCertificate(SecTrustRef trust)
     
     protectionSpace = [challenge protectionSpace];
     trust = [protectionSpace serverTrust];
-    
-    [CCUtility getDirectoryCerificates];
-    
+        
     if(trust != nil) {
         
         [self saveCertificate:trust withName:@"tmp.der"];