Browse Source

remove passcode

marinofaggiana 4 years ago
parent
commit
0ae50c9a80

+ 1 - 2
Share/NCSelectDestination.h

@@ -23,7 +23,6 @@
 
 #import <UIKit/UIKit.h>
 
-#import "CCBKPasscode.h"
 #import "CCUtility.h"
 #import "CCHud.h"
 
@@ -31,7 +30,7 @@
 
 @protocol NCSelectDestinationDelegate;
 
-@interface NCSelectDestination : UITableViewController <UIAlertViewDelegate, UITableViewDelegate, BKPasscodeViewControllerDelegate>
+@interface NCSelectDestination : UITableViewController <UIAlertViewDelegate, UITableViewDelegate>
 
 @property (nonatomic, weak) id <NCSelectDestinationDelegate> delegate;
 

+ 15 - 134
Share/NCSelectDestination.m

@@ -161,67 +161,6 @@
     [self presentViewController:alertController animated:YES completion:nil];
 }
 
-// MARK: - BKPasscodeViewController
-
-- (void)passcodeViewController:(CCBKPasscode *)aViewController didFinishWithPasscode:(NSString *)aPasscode
-{
-    [aViewController dismissViewControllerAnimated:YES completion:nil];
-    
-    [self performSegueDirectoryWithControlPasscode:false];
-}
-
-- (void)passcodeViewController:(BKPasscodeViewController *)aViewController authenticatePasscode:(NSString *)aPasscode resultHandler:(void (^)(BOOL))aResultHandler
-{
-    if ([aPasscode isEqualToString:[CCUtility getBlockCode]]) {
-        
-        self.lockUntilDate = nil;
-        self.failedAttempts = 0;
-        aResultHandler(YES);
-        
-    } else {
-        
-        aResultHandler(NO);
-    }
-}
-
-- (void)passcodeViewControllerDidFailAttempt:(BKPasscodeViewController *)aViewController
-{
-    self.failedAttempts++;
-    
-    if (self.failedAttempts > 5) {
-        
-        NSTimeInterval timeInterval = 60;
-        
-        if (self.failedAttempts > 6) {
-            
-            NSUInteger multiplier = self.failedAttempts - 6;
-            
-            timeInterval = (5 * 60) * multiplier;
-            
-            if (timeInterval > 3600 * 24) {
-                timeInterval = 3600 * 24;
-            }
-        }
-        
-        self.lockUntilDate = [NSDate dateWithTimeIntervalSinceNow:timeInterval];
-    }
-}
-
-- (NSUInteger)passcodeViewControllerNumberOfFailedAttempts:(BKPasscodeViewController *)aViewController
-{
-    return self.failedAttempts;
-}
-
-- (NSDate *)passcodeViewControllerLockUntilDate:(BKPasscodeViewController *)aViewController
-{
-    return self.lockUntilDate;
-}
-
-- (void)passcodeViewCloseButtonPressed:(id)sender
-{
-    [self dismissViewControllerAnimated:YES completion:nil];
-}
-
 // MARK: - Read Folder
 
 - (void)readFolder
@@ -349,7 +288,21 @@
     
     if (metadata.directory) {
         
-        [self performSegueDirectoryWithControlPasscode:YES];
+        UINavigationController* navigationController = [[UIStoryboard storyboardWithName:@"NCSelectDestination" bundle:nil] instantiateInitialViewController];
+        NCSelectDestination *viewController = (NCSelectDestination *)navigationController.topViewController;
+        
+        viewController.delegate = self.delegate;
+        viewController.includeDirectoryE2EEncryption = self.includeDirectoryE2EEncryption;
+        viewController.includeImages = self.includeImages;
+        viewController.move.title = self.move.title;
+        viewController.hideCreateFolder = self.hideCreateFolder;
+        viewController.hideMoveutton = self.hideMoveutton;
+        viewController.selectFile = self.selectFile;
+        viewController.type = self.type;
+        viewController.passMetadata = metadata;
+        viewController.serverUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:metadata.fileName];
+        
+        [self.navigationController pushViewController:viewController animated:YES];
         
     } else {
         
@@ -366,76 +319,4 @@
     }
 }
 
-// MARK: - Navigation
-
-- (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode
-{
-    NSString *nomeDir;
-
-    NSIndexPath *index = [self.tableView indexPathForSelectedRow];
-    
-    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicateDataSource sorted:@"fileName" ascending:YES index:index.row];
-    
-    // lockServerUrl
-    NSString *lockServerUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:metadata.fileName];
-        
-    // Se siamo in presenza di una directory bloccata E è attivo il block E la sessione PASSWORD Lock è senza data ALLORA chiediamo la password per procedere
-        
-    tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", activeAccount, lockServerUrl]];
-        
-    if (directory.lock && [[CCUtility getBlockCode] length] && controlPasscode) {
-            
-        CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
-        viewController.delegate = self;
-        //viewController.fromType = CCBKPasscodeFromLockDirectory;
-        viewController.type = BKPasscodeViewControllerCheckPasscodeType;
-        viewController.inputViewTitlePassword = YES;
-            
-        if ([CCUtility getSimplyBlockCode]) {
-                
-            viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
-            viewController.passcodeInputView.maximumLength = 6;
-                
-        } else {
-                
-            viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
-            viewController.passcodeInputView.maximumLength = 64;
-        }
-            
-        BKTouchIDManager *touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:k_serviceShareKeyChain];
-        touchIDManager.promptText = NSLocalizedString(@"_scan_fingerprint_", nil);
-        viewController.touchIDManager = touchIDManager;
-        
-        viewController.title = NSLocalizedString(@"_folder_blocked_", nil);
-        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-        viewController.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor];
-        
-        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-        navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
-        [self presentViewController:navigationController animated:YES completion:nil];
-            
-        return;
-    }
-        
-    nomeDir = metadata.fileName;
-    
-    UINavigationController* navigationController = [[UIStoryboard storyboardWithName:@"NCSelectDestination" bundle:nil] instantiateInitialViewController];
-    
-    NCSelectDestination *viewController = (NCSelectDestination *)navigationController.topViewController;
-    
-    viewController.delegate = self.delegate;
-    viewController.includeDirectoryE2EEncryption = self.includeDirectoryE2EEncryption;
-    viewController.includeImages = self.includeImages;
-    viewController.move.title = self.move.title;
-    viewController.hideCreateFolder = self.hideCreateFolder;
-    viewController.hideMoveutton = self.hideMoveutton;
-    viewController.selectFile = self.selectFile;
-    viewController.type = self.type;
-
-    viewController.passMetadata = metadata;
-    viewController.serverUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:nomeDir];
-    
-    [self.navigationController pushViewController:viewController animated:YES];
-}
-
 @end

+ 1 - 1
iOSClient/AppDelegate.h

@@ -42,7 +42,7 @@
 @class IMImagemeterViewer;
 @class NCDetailViewController;
 
-@interface AppDelegate : UIResponder <UIApplicationDelegate, BKPasscodeLockScreenManagerDelegate, BKPasscodeViewControllerDelegate, UNUserNotificationCenterDelegate>
+@interface AppDelegate : UIResponder <UIApplicationDelegate, UNUserNotificationCenterDelegate>
 
 // Timer Process
 @property (nonatomic, strong) NSTimer *timerProcessAutoDownloadUpload;

+ 2 - 123
iOSClient/AppDelegate.m

@@ -113,13 +113,6 @@
     // ProgressView Detail
     self.progressViewDetail = [[UIProgressView alloc] initWithProgressViewStyle: UIProgressViewStyleBar];
     
-    // passcode
-    [[BKPasscodeLockScreenManager sharedManager] setDelegate:self];
-    
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[BKPasscodeLockScreenManager sharedManager] showLockScreen:NO];
-    });
-    
     // Quick Actions
     if([[UIApplicationShortcutItem class] respondsToSelector:@selector(new)]) {
     
@@ -259,9 +252,7 @@
 - (void)applicationDidEnterBackground:(UIApplication *)application
 {
     NSLog(@"[LOG] Enter in Background");
-    
-    [[BKPasscodeLockScreenManager sharedManager] showLockScreen:YES];
-    
+        
     if([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]) {
         
         __block UIBackgroundTaskIdentifier background_task;
@@ -1060,118 +1051,6 @@
     [self.window setTintColor:NCBrandColor.sharedInstance.textView];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Manager Passcode =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (BOOL)lockScreenManagerShouldShowLockScreen:(BKPasscodeLockScreenManager *)aManager
-{
-    // ServerUrl active
-    NSString *serverUrl = self.activeMain.serverUrl;
-    BOOL isBlockZone = false;
-    
-    // fermiamo la data della sessione
-    self.sessionePasscodeLock = nil;
-    
-    // se il block code è a zero esci con NON attivare la richiesta password
-    if ([[CCUtility getBlockCode] length] == 0) return NO;
-    
-    // se non c'è attivo un account esci con NON attivare la richiesta password
-    if ([self.activeAccount length] == 0) return NO;
-    
-    // se non è attivo il OnlyLockDir esci con NON attivare la richiesta password
-    if (serverUrl && _activeUrl) {
-        
-        while (![serverUrl isEqualToString:[CCUtility getHomeServerUrlActiveUrl:_activeUrl]]) {
-            
-            tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", self.activeAccount, serverUrl]];
-            
-            if (directory.lock) {
-                isBlockZone = true;
-                break;
-            } else {
-                serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
-                if (serverUrl == self.activeUrl)
-                    break;
-            }
-        }
-    }
-    
-    if ([CCUtility getOnlyLockDir] && !isBlockZone) return NO;
-    
-    return YES;
-}
-
-- (UIViewController *)lockScreenManagerPasscodeViewController:(BKPasscodeLockScreenManager *)aManager
-{
-    CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
-    viewController.type = BKPasscodeViewControllerCheckPasscodeType;
-    viewController.delegate = self;
-    viewController.title = [NCBrandOptions sharedInstance].brand;
-    viewController.fromType = CCBKPasscodeFromLockScreen;
-    viewController.inputViewTitlePassword = YES;
-    
-    if ([CCUtility getSimplyBlockCode]) {
-        
-        viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
-        viewController.passcodeInputView.maximumLength = 6;
-        
-    } else {
-        
-        viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
-        viewController.passcodeInputView.maximumLength = 64;
-    }
-
-    viewController.touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName: k_serviceShareKeyChain];
-    viewController.touchIDManager.promptText = NSLocalizedString(@"_scan_fingerprint_", nil);
-
-    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-    navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
-    return navigationController;
-}
-
-- (void)passcodeViewController:(CCBKPasscode *)aViewController didFinishWithPasscode:(NSString *)aPasscode
-{
-    [aViewController dismissViewControllerAnimated:YES completion:nil];
-    
-    // is a lock screen
-    if (aViewController.fromType == CCBKPasscodeFromLockScreen) {
-        
-        [aViewController dismissViewControllerAnimated:YES completion:nil];
-        
-        // start session Passcode Lock
-        BOOL isBlockZone = false;
-        NSString *serverUrl = self.activeMain.serverUrl;
-        
-        while (![serverUrl isEqualToString:[CCUtility getHomeServerUrlActiveUrl:_activeUrl]]) {
-            
-            tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", self.activeAccount, serverUrl]];
-            
-            if (directory.lock) {
-                isBlockZone = true;
-                break;
-            } else {
-                serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
-                if (serverUrl == self.activeUrl)
-                    break;
-            }
-        }
-        if (isBlockZone)
-            self.sessionePasscodeLock = [NSDate date];
-     }
-}
-
-- (void)passcodeViewController:(CCBKPasscode *)aViewController authenticatePasscode:(NSString *)aPasscode resultHandler:(void (^)(BOOL))aResultHandler
-{
-    if (aViewController.fromType == CCBKPasscodeFromLockScreen || aViewController.fromType == CCBKPasscodeFromInit) {
-        if ([aPasscode isEqualToString:[CCUtility getBlockCode]]) {
-            //self.lockUntilDate = nil;
-            //self.failedAttempts = 0;
-            aResultHandler(YES);
-        } else aResultHandler(NO);
-    } else aResultHandler(YES);
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== reachabilityChanged =====
 #pragma --------------------------------------------------------------------------------------------
@@ -1713,7 +1592,7 @@
                                                     NSString *fileName = [[path stringByDeletingLastPathComponent] lastPathComponent];
                                                     NSString *serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@%@/%@", matchedAccount.url, k_webDAV, [path stringByDeletingLastPathComponent]]];
                                                     tableMetadata *metadata = [[NCManageDatabase sharedInstance] createMetadataWithAccount:matchedAccount.account fileName:fileName ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrl url:@"" contentType:@""];
-                                                    [self.activeMain performSegueDirectoryWithControlPasscode:true metadata:metadata blinkFileNamePath:fileNamePath];
+                                                    [self.activeMain performSegueDirectoryWithMetadata:metadata blinkFileNamePath:fileNamePath];
                                                     
                                                 } else {
                                                     

+ 1 - 1
iOSClient/CCGlobal.h

@@ -84,7 +84,7 @@
 
 // Database Realm
 #define k_databaseDefault                               @"nextcloud.realm"
-#define k_databaseSchemaVersion                         100
+#define k_databaseSchemaVersion                         101
 
 // Intro selector
 #define k_intro_login                                   0

+ 0 - 1
iOSClient/Database/NCDatabase.swift

@@ -262,7 +262,6 @@ class tableDirectory: Object {
     @objc dynamic var etag = ""
     @objc dynamic var favorite: Bool = false
     @objc dynamic var fileId = ""
-    @objc dynamic var lock: Bool = false
     @objc dynamic var ocId = ""
     @objc dynamic var offline: Bool = false
     @objc dynamic var permissions = ""

+ 6 - 96
iOSClient/Database/NCManageDatabase.swift

@@ -1532,49 +1532,6 @@ class NCManageDatabase: NSObject {
         }
     }
     
-    @objc func setDirectoryLock(serverUrl: String, lock: Bool, account: String) -> Bool {
-        
-        let realm = try! Realm()
-
-        var update = false
-        
-        do {
-            try realm.write {
-            
-                guard let result = realm.objects(tableDirectory.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).first else {
-                    realm.cancelWrite()
-                    return
-                }
-                
-                result.lock = lock
-                update = true
-            }
-        } catch let error {
-            print("[LOG] Could not write to database: ", error)
-            return false
-        }
-        
-        return update
-    }
-    
-    @objc func setAllDirectoryUnLock(account: String) {
-        
-        let realm = try! Realm()
-
-        do {
-            try realm.write {
-            
-                let results = realm.objects(tableDirectory.self).filter("account == %@", account)
-
-                for result in results {
-                    result.lock = false;
-                }
-            }
-        } catch let error {
-            print("[LOG] Could not write to database: ", error)
-        }
-    }
-    
     @objc func setDirectory(serverUrl: String, offline: Bool, account: String) {
         
         let realm = try! Realm()
@@ -2729,12 +2686,8 @@ class NCManageDatabase: NSObject {
         if results.count == 0 {
             return nil
         }
-        
-        let serversUrlLocked = realm.objects(tableDirectory.self).filter(NSPredicate(format: "account == %@ AND lock == true", account)).map { $0.serverUrl } as Array
-        
+                
         var metadatas = [tableMetadata]()
-        var oldServerUrl = ""
-        var isValidMetadata = true
         
         // For Live Photo
         var fileNameImages = [String]()
@@ -2746,26 +2699,11 @@ class NCManageDatabase: NSObject {
                 
         for result in results {
             let metadata = tableMetadata.init(value: result)
-        
-            // Verify Lock
-            if (serversUrlLocked.count > 0) && (metadata.serverUrl != oldServerUrl) {
-                var foundLock = false
-                oldServerUrl = metadata.serverUrl
-                for serverUrlLocked in serversUrlLocked {
-                    if metadata.serverUrl.contains(serverUrlLocked) {
-                        foundLock = true
-                        break
-                    }
-                }
-                isValidMetadata = !foundLock
-            }
-            if isValidMetadata {
-                let ext = (metadata.fileNameView as NSString).pathExtension.uppercased()
-                let fileName = (metadata.fileNameView as NSString).deletingPathExtension
+            let ext = (metadata.fileNameView as NSString).pathExtension.uppercased()
+            let fileName = (metadata.fileNameView as NSString).deletingPathExtension
 
-                if !(ext == "MOV" && fileNameImages.contains(fileName)) {
-                    metadatas.append(tableMetadata.init(value: metadata))
-                }
+            if !(ext == "MOV" && fileNameImages.contains(fileName)) {
+                metadatas.append(tableMetadata.init(value: metadata))
             }
         }
       
@@ -2819,34 +2757,6 @@ class NCManageDatabase: NSObject {
         var isDifferent: Bool = false
         var newInsert: Int = 0
         
-        var oldServerUrl = ""
-        var isValidMetadata = true
-        
-        var metadatas = [tableMetadata]()
-        
-        let serversUrlLocked = realm.objects(tableDirectory.self).filter(NSPredicate(format: "account == %@ AND lock == true", account)).map { $0.serverUrl } as Array
-        if (serversUrlLocked.count > 0) {
-            for metadata in metadatasSource {
-                // Verify Lock
-                if (metadata.serverUrl != oldServerUrl) {
-                    var foundLock = false
-                    oldServerUrl = metadata.serverUrl
-                    for serverUrlLocked in serversUrlLocked {
-                        if metadata.serverUrl.contains(serverUrlLocked) {
-                            foundLock = true
-                            break
-                        }
-                    }
-                    isValidMetadata = !foundLock
-                }
-                if isValidMetadata {
-                    metadatas.append(tableMetadata.init(value: metadata))
-                }
-            }
-        } else {
-            metadatas = metadatasSource
-        }
-        
         do {
             try realm.write {
                 
@@ -2856,7 +2766,7 @@ class NCManageDatabase: NSObject {
                 numDelete = results.count
                 
                 // INSERT
-                let photos = Array(metadatas.map { tableMedia.init(value:$0) })
+                let photos = Array(metadatasSource.map { tableMedia.init(value:$0) })
                 etagsInsert = Array(photos.map { $0.etag })
                 numInsert = photos.count
                 

+ 9 - 12
iOSClient/Favorites/CCFavorites.m

@@ -662,18 +662,15 @@
     }
     
     // Directory
-    if (self.metadata.directory)
-        [self performSegueDirectoryWithControlPasscode];
-}
-
--(void)performSegueDirectoryWithControlPasscode
-{
-    CCFavorites *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CCFavorites"];
-    
-    vc.serverUrl = [CCUtility stringAppendServerUrl:self.metadata.serverUrl addFileName:self.metadata.fileName];
-    vc.titleViewControl = self.metadata.fileNameView;
-    
-    [self.navigationController pushViewController:vc animated:YES];
+    if (self.metadata.directory) {
+        
+        CCFavorites *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CCFavorites"];
+        
+        vc.serverUrl = [CCUtility stringAppendServerUrl:self.metadata.serverUrl addFileName:self.metadata.fileName];
+        vc.titleViewControl = self.metadata.fileNameView;
+        
+        [self.navigationController pushViewController:vc animated:YES];
+    }
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 2 - 3
iOSClient/Main/CCMain.h

@@ -43,7 +43,7 @@
 @class tableMetadata;
 @class NCViewRichWorkspace;
 
-@interface CCMain : UIViewController <UITableViewDataSource, UITableViewDelegate, UIActionSheetDelegate, UIGestureRecognizerDelegate, UIViewControllerPreviewingDelegate, BKPasscodeViewControllerDelegate, UISplitViewControllerDelegate, UIPopoverControllerDelegate, UIDocumentMenuDelegate, UIDocumentPickerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, UIScrollViewDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
+@interface CCMain : UIViewController <UITableViewDataSource, UITableViewDelegate, UIActionSheetDelegate, UIGestureRecognizerDelegate, UIViewControllerPreviewingDelegate, UISplitViewControllerDelegate, UIPopoverControllerDelegate, UIDocumentMenuDelegate, UIDocumentPickerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, UIScrollViewDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 
 @property (nonatomic, weak) IBOutlet UITableView *tableView;
 @property (nonatomic, strong) NCViewRichWorkspace *viewRichWorkspace;
@@ -66,7 +66,7 @@
 @property BOOL isSelectedMode;
 
 - (void)shouldPerformSegue:(tableMetadata *)metadata selector:(NSString *)selector;
-- (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode metadata:(tableMetadata *)metadata blinkFileNamePath:(NSString *)blinkFileNamePath;
+- (void)performSegueDirectoryWithMetadata:(tableMetadata *)metadata blinkFileNamePath:(NSString *)blinkFileNamePath;
 
 - (void)saveToPhotoAlbum:(tableMetadata *)metadata;
 
@@ -98,7 +98,6 @@
 - (void)moveOpenWindow:(NSArray *)indexPaths;
 
 - (void)minCharTextFieldDidChange:(UITextField *)sender;
-- (void)comandoLockPassword;
 - (void)actionDelete:(NSIndexPath *)indexPath;
 - (void)createRichWorkspace;
 

+ 2 - 193
iOSClient/Main/CCMain.m

@@ -2101,147 +2101,6 @@
     [appDelegate startLoadAutoDownloadUpload];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Lock Passcode =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (NSUInteger)passcodeViewControllerNumberOfFailedAttempts:(CCBKPasscode *)aViewController
-{
-    return _failedAttempts;
-}
-
-- (NSDate *)passcodeViewControllerLockUntilDate:(CCBKPasscode *)aViewController
-{
-    return _lockUntilDate;
-}
-
-- (void)passcodeViewCloseButtonPressed:(id)sender
-{
-    [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-- (void)passcodeViewController:(CCBKPasscode *)aViewController authenticatePasscode:(NSString *)aPasscode resultHandler:(void (^)(BOOL))aResultHandler
-{
-    if (aViewController.fromType == CCBKPasscodeFromLockScreen || aViewController.fromType == CCBKPasscodeFromLockDirectory || aViewController.fromType == CCBKPasscodeFromDisactivateDirectory ) {
-        if ([aPasscode isEqualToString:[CCUtility getBlockCode]]) {
-            _lockUntilDate = nil;
-            _failedAttempts = 0;
-            aResultHandler(YES);
-        } else aResultHandler(NO);
-    } else aResultHandler(YES);
-}
-
-- (void)passcodeViewController:(CCBKPasscode *)aViewController didFinishWithPasscode:(NSString *)aPasscode
-{
-    [aViewController dismissViewControllerAnimated:YES completion:nil];
-    
-    switch (aViewController.type) {
-            
-        case BKPasscodeViewControllerCheckPasscodeType: {
-            
-            if (aViewController.fromType == CCBKPasscodeFromLockDirectory) {
-                
-                // possiamo procedere alla prossima directory
-                [self performSegueDirectoryWithControlPasscode:false metadata:self.metadata blinkFileNamePath:self.blinkFileNamePath];
-                
-                // avviamo la sessione Passcode Lock con now
-                appDelegate.sessionePasscodeLock = [NSDate date];
-            }
-            
-            // disattivazione lock cartella
-            if (aViewController.fromType == CCBKPasscodeFromDisactivateDirectory) {
-            
-                NSString *lockServerUrl = [CCUtility stringAppendServerUrl:self.metadata.serverUrl addFileName:self.metadata.fileName];
-                
-                if (![[NCManageDatabase sharedInstance] setDirectoryLockWithServerUrl:lockServerUrl lock:NO account:appDelegate.activeAccount]) {
-                
-                    [[NCContentPresenter shared] messageNotification:@"_error_" description:@"_error_operation_canc_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError];
-                }
-                
-                [self tableViewReloadData];
-            }
-        }
-            break;
-        default:
-            break;
-    }
-}
-
-- (void)comandoLockPassword
-{
-    NSString *lockServerUrl = [CCUtility stringAppendServerUrl:self.metadata.serverUrl addFileName:self.metadata.fileName];
-
-    // se non è abilitato il Lock Passcode esci
-    if ([[CCUtility getBlockCode] length] == 0) {
-        
-        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_warning_", nil) message:NSLocalizedString(@"_only_lock_passcode_", nil) preferredStyle:UIAlertControllerStyleAlert];
-        UIAlertAction *goToSettingsAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_go_to_app_settings_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-            [self.tabBarController setSelectedIndex:4];
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
-                NSIndexPath *selectedIndex = [NSIndexPath indexPathForRow:0 inSection:1];
-                [appDelegate.activeMore.tableView selectRowAtIndexPath:selectedIndex animated:true scrollPosition: UITableViewScrollPositionNone];
-                [appDelegate.activeMore tableView:appDelegate.activeMore.tableView didSelectRowAtIndexPath:selectedIndex];
-            });
-        }];
-        UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
-
-        [alertController addAction:goToSettingsAction];
-        [alertController addAction:okAction];
-        [self presentViewController:alertController animated:YES completion:nil];
-        return;
-    }
-    
-    // se è richiesta la disattivazione si chiede la password
-    tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", appDelegate.activeAccount, lockServerUrl]];
-    
-    if (directory.lock) {
-        
-        CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
-        viewController.delegate = self;
-        viewController.fromType = CCBKPasscodeFromDisactivateDirectory;
-        viewController.type = BKPasscodeViewControllerCheckPasscodeType;
-        viewController.inputViewTitlePassword = YES;
-        
-        if ([CCUtility getSimplyBlockCode]) {
-            
-            viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
-            viewController.passcodeInputView.maximumLength = 6;
-            
-        } else {
-            
-            viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
-            viewController.passcodeInputView.maximumLength = 64;
-        }
-        
-        BKTouchIDManager *touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:k_serviceShareKeyChain];
-        touchIDManager.promptText = NSLocalizedString(@"_scan_fingerprint_", nil);
-        viewController.touchIDManager = touchIDManager;
-
-        viewController.title = NSLocalizedString(@"_passcode_protection_", nil);
-        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-        viewController.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor];
-        
-        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-        navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
-        [self presentViewController:navigationController animated:YES completion:nil];
-        
-        return;
-    }
-    
-    // ---------------- ACTIVATE PASSWORD
-    
-    if ([[NCManageDatabase sharedInstance] setDirectoryLockWithServerUrl:lockServerUrl lock:YES account:appDelegate.activeAccount]) {
-        
-        NSIndexPath *indexPath = [sectionDataSource.ocIdIndexPath objectForKey:self.metadata.ocId];
-        if ([self indexPathIsValid:indexPath])
-            [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationAutomatic];
-        
-    } else {
-        
-        [[NCContentPresenter shared] messageNotification:@"_error_" description:@"_error_operation_canc_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError];
-    }
-}
-
 #pragma mark -
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== menu action : Favorite, More, Delete [swipe] =====
@@ -2290,19 +2149,8 @@
 - (void)actionDelete:(NSIndexPath *)indexPath
 {
     tableMetadata *metadata = [[NCMainCommon sharedInstance] getMetadataFromSectionDataSourceIndexPath:indexPath sectionDataSource:sectionDataSource];
-    
-    // Directory locked ?
-    NSString *lockServerUrl = [CCUtility stringAppendServerUrl:self.metadata.serverUrl addFileName:metadata.fileName];
-    
-    tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", appDelegate.activeAccount, lockServerUrl]];
     tableLocalFile *localFile = [[NCManageDatabase sharedInstance] getTableLocalFileWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", metadata.ocId]];
     
-    if (directory.lock && [[CCUtility getBlockCode] length] && appDelegate.sessionePasscodeLock == nil) {
-        
-        [[NCContentPresenter shared] messageNotification:@"_error_" description:@"_folder_blocked_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError];
-        return;
-    }
-    
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_delete_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
@@ -2958,7 +2806,7 @@
     
     if (self.metadata.directory) {
         
-        [self performSegueDirectoryWithControlPasscode:true metadata:self.metadata blinkFileNamePath:self.blinkFileNamePath];
+        [self performSegueDirectoryWithMetadata:self.metadata blinkFileNamePath:self.blinkFileNamePath];
     }
 }
 
@@ -3060,51 +2908,12 @@
 }
 
 // can i go to next viewcontroller
-- (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode metadata:(tableMetadata *)metadata blinkFileNamePath:(NSString *)blinkFileNamePath
+- (void)performSegueDirectoryWithMetadata:(tableMetadata *)metadata blinkFileNamePath:(NSString *)blinkFileNamePath
 {
     NSString *nomeDir;
     
     if (self.tableView.editing == NO) {
         
-        NSString *lockServerUrl = [CCUtility stringAppendServerUrl:metadata.serverUrl addFileName:metadata.fileName];
-        
-        tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", metadata.account, lockServerUrl]];
-        
-        // SE siamo in presenza di una directory bloccata E è attivo il block E la sessione password Lock è senza data ALLORA chiediamo la password per procedere
-        if (directory.lock && [[CCUtility getBlockCode] length] && appDelegate.sessionePasscodeLock == nil && controlPasscode) {
-            
-            CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
-            viewController.delegate = self;
-            viewController.fromType = CCBKPasscodeFromLockDirectory;
-            viewController.type = BKPasscodeViewControllerCheckPasscodeType;
-            viewController.inputViewTitlePassword = YES;
-            
-            if ([CCUtility getSimplyBlockCode]) {
-                
-                viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
-                viewController.passcodeInputView.maximumLength = 6;
-                
-            } else {
-                
-                viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
-                viewController.passcodeInputView.maximumLength = 64;
-            }
-
-            BKTouchIDManager *touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:k_serviceShareKeyChain];
-            touchIDManager.promptText = NSLocalizedString(@"_scan_fingerprint_", nil);
-            viewController.touchIDManager = touchIDManager;
-            
-            viewController.title = NSLocalizedString(@"_folder_blocked_", nil);
-            viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-            viewController.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor];
-            
-            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-            navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
-            [self presentViewController:navigationController animated:YES completion:nil];
-            
-            return;
-        }
-        
         // E2EE Check enable
         if (metadata.e2eEncrypted && [CCUtility isEndToEndEnabled:appDelegate.activeAccount] == NO) {
             

+ 3 - 17
iOSClient/Main/Menu/CCMain+Menu.swift

@@ -235,14 +235,10 @@ extension CCMain {
 
         if (metadata.directory) {
             
-            var isDirectoryLock = false
             var isOffline = false
             let isFolderEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl+"/"+metadata.fileName, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account)
 
             if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName)!)) {
-                if (directory.lock && CCUtility.getBlockCode() != nil && appDelegate.sessionePasscodeLock == nil) {
-                    isDirectoryLock = true
-                }
                 isOffline = directory.offline
             }
 
@@ -264,7 +260,7 @@ extension CCMain {
                 )
             )
 
-            if (!isDirectoryLock && !isFolderEncrypted) {
+            if (!isFolderEncrypted) {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_details_", comment: ""),
@@ -276,7 +272,7 @@ extension CCMain {
                 )
             }
 
-            if(!(metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory) && !isDirectoryLock && !metadata.e2eEncrypted) {
+            if(!(metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory) && !metadata.e2eEncrypted) {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_rename_", comment: ""),
@@ -307,7 +303,7 @@ extension CCMain {
                 )
             }
 
-            if (!(metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory) && !isDirectoryLock && !isFolderEncrypted) {
+            if (!(metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory) && !isFolderEncrypted) {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_move_or_copy_", comment: ""),
@@ -338,16 +334,6 @@ extension CCMain {
                 )
             }
 
-            actions.append(
-                NCMenuAction(
-                    title: isDirectoryLock ? NSLocalizedString("_remove_passcode_", comment: "") : NSLocalizedString("_protect_passcode_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "settingsPasscodeYES"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                    action: { menuAction in
-                        self.perform(#selector(self.comandoLockPassword))
-                    }
-                )
-            )
-
             if (!metadata.e2eEncrypted && CCUtility.isEnd(toEndEnabled: appDelegate.activeAccount)) {
                 actions.append(
                     NCMenuAction(

+ 1 - 15
iOSClient/Main/NCMainCommon.swift

@@ -294,11 +294,6 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
                 let lockServerUrl = CCUtility.stringAppendServerUrl(serverUrl, addFileName: metadata.fileName)!
                 let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, lockServerUrl))
                 
-                // Status image: passcode
-                if tableDirectory != nil && tableDirectory!.lock && CCUtility.getBlockCode() != nil {
-                    cell.imageStatus.image = UIImage.init(named: "passcode")
-                }
-                
                 // Local image: offline
                 if tableDirectory != nil && tableDirectory!.offline {
                     cell.imageLocal.image = UIImage.init(named: "offlineFlag")
@@ -423,12 +418,7 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
     
                 let lockServerUrl = CCUtility.stringAppendServerUrl(serverUrl, addFileName: metadata.fileName)!
                 let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, lockServerUrl))
-                
-                // Status image: passcode
-                if tableDirectory != nil && tableDirectory!.lock && CCUtility.getBlockCode() != nil {
-                    cell.imageStatus.image = UIImage.init(named: "passcode")
-                }
-                
+                                
                 // Local image: offline
                 if tableDirectory != nil && tableDirectory!.offline {
                     cell.imageLocal.image = UIImage.init(named: "offlineFlag")
@@ -553,10 +543,6 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
                 if tableDirectory != nil && tableDirectory!.offline {
                     cell.local.image = UIImage.init(named: "offlineFlag")
                 }
-                // Status image: passcode
-                if tableDirectory != nil && tableDirectory!.lock && CCUtility.getBlockCode() != nil {
-                    cell.status.image = UIImage.init(named: "passcode")
-                }
                 
             } else {
                 

+ 8 - 96
iOSClient/Offline/NCOffline.swift

@@ -23,7 +23,7 @@
 
 import Foundation
 
-class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate, BKPasscodeViewControllerDelegate  {
+class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate  {
     
     @IBOutlet fileprivate weak var collectionView: UICollectionView!
 
@@ -176,50 +176,6 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
         return true
     }
     
-    // MARK: BKPASSCODEVIEWCONTROLLER
-    
-    func passcodeViewController(_ aViewController: BKPasscodeViewController!, didFinishWithPasscode aPasscode: String!) {
-        aViewController.dismiss(animated: true, completion: nil)
-        performSegueDirectoryWithControlPasscode(controlPasscode: false)
-    }
-    
-    func passcodeViewController(_ aViewController: BKPasscodeViewController!, authenticatePasscode aPasscode: String!, resultHandler aResultHandler: ((Bool) -> Void)!) {
-        if aPasscode == CCUtility.getBlockCode() {
-            failedAttempts = 0
-            lockUntilDate = nil
-            aResultHandler(true)
-        } else {
-            aResultHandler(false)
-        }
-    }
-    
-    func passcodeViewControllerDidFailAttempt(_ aViewController: BKPasscodeViewController!) {
-        failedAttempts += 1
-        if failedAttempts > 5 {
-            var timeInterval: TimeInterval = 60
-            if failedAttempts > 6 {
-                let multiplier: Double = failedAttempts - 6
-                timeInterval = (5 * 60) * multiplier
-                if timeInterval > 3600 * 24 {
-                    timeInterval = 3600 * 24
-                }
-            }
-            lockUntilDate = NSDate.init(timeIntervalSinceNow: timeInterval)
-        }
-    }
-    
-    func passcodeViewControllerNumber(ofFailedAttempts aViewController: BKPasscodeViewController!) -> UInt {
-        return UInt(failedAttempts)
-    }
-    
-    func passcodeViewControllerLock(untilDate aViewController: BKPasscodeViewController!) -> Date? {
-        return lockUntilDate as Date?
-    }
-    
-    @objc func passcodeViewCloseButtonPressed(_ sender: Any) {
-        self.dismiss(animated: true, completion: nil)
-    }
-
     // MARK: TAP EVENT
     
     func tapSwitchHeader(sender: Any) {
@@ -503,55 +459,6 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
             }
         }
     }
-    
-    // MARK: NAVIGATION
-    
-    private func performSegueDirectoryWithControlPasscode(controlPasscode: Bool) {
-        
-        guard let serverUrlPush = CCUtility.stringAppendServerUrl(metadataPush!.serverUrl, addFileName: metadataPush!.fileName) else {
-            return
-        }
-        guard let directoryPush = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, serverUrlPush))  else {
-            return
-        }
-        
-        if directoryPush.lock == true && CCUtility.getBlockCode() != nil && (CCUtility.getBlockCode()?.count)! > 0 && controlPasscode {
-            
-            let viewController = CCBKPasscode.init(nibName: nil, bundle: nil)
-            guard let touchIDManager = BKTouchIDManager.init(keychainServiceName: k_serviceShareKeyChain) else {
-                return
-            }
-            touchIDManager.promptText = NSLocalizedString("_scan_fingerprint_", comment: "")
-            
-            viewController.delegate = self
-            viewController.type = BKPasscodeViewControllerCheckPasscodeType
-            viewController.inputViewTitlePassword = true
-            if CCUtility.getSimplyBlockCode() {
-                viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle
-                viewController.passcodeInputView.maximumLength = 6
-            } else {
-                viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle
-                viewController.passcodeInputView.maximumLength = 64
-            }
-            viewController.touchIDManager = touchIDManager
-            viewController.title = NSLocalizedString("_folder_blocked_", comment: "")
-            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonItem.SystemItem.cancel, target: self, action: #selector(passcodeViewCloseButtonPressed(_:)))
-            viewController.navigationItem.leftBarButtonItem?.tintColor = UIColor.black
-            
-            let navigationController = UINavigationController.init(rootViewController: viewController)
-            navigationController.modalPresentationStyle = .fullScreen
-            self.present(navigationController, animated: true, completion: nil)
-            
-            return
-        }
-        
-        let ncOffline:NCOffline = UIStoryboard(name: "NCOffline", bundle: nil).instantiateInitialViewController() as! NCOffline
-        
-        ncOffline.serverUrl = serverUrlPush
-        ncOffline.titleCurrentFolder = metadataPush!.fileNameView
-        
-        self.navigationController?.pushViewController(ncOffline, animated: true)
-    }
 }
 
 // MARK: - 3D Touch peek and pop
@@ -615,10 +522,15 @@ extension NCOffline: UICollectionViewDelegate {
         
         if metadata.directory {
             
-            performSegueDirectoryWithControlPasscode(controlPasscode: true)
+            guard let serverUrlPush = CCUtility.stringAppendServerUrl(metadataPush!.serverUrl, addFileName: metadataPush!.fileName) else { return }
+            let ncOffline:NCOffline = UIStoryboard(name: "NCOffline", bundle: nil).instantiateInitialViewController() as! NCOffline
             
-        } else {
+            ncOffline.serverUrl = serverUrlPush
+            ncOffline.titleCurrentFolder = metadataPush!.fileNameView
             
+            self.navigationController?.pushViewController(ncOffline, animated: true)
+            
+        } else {
             
             performSegue(withIdentifier: "segueDetail", sender: self)
         }

+ 21 - 112
iOSClient/Select/NCSelect.swift

@@ -28,7 +28,7 @@ import NCCommunication
     @objc func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, buttonType: String, overwrite: Bool)
 }
 
-class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate, BKPasscodeViewControllerDelegate {
+class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
     
     @IBOutlet fileprivate weak var collectionView: UICollectionView!
     @IBOutlet fileprivate weak var toolbar: UIView!
@@ -236,50 +236,6 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
         return true
     }
     
-    // MARK: BKPASSCODEVIEWCONTROLLER
-    
-    func passcodeViewController(_ aViewController: BKPasscodeViewController!, didFinishWithPasscode aPasscode: String!) {
-        aViewController.dismiss(animated: true, completion: nil)
-        performSegueDirectoryWithControlPasscode(controlPasscode: false)
-    }
-    
-    func passcodeViewController(_ aViewController: BKPasscodeViewController!, authenticatePasscode aPasscode: String!, resultHandler aResultHandler: ((Bool) -> Void)!) {
-        if aPasscode == CCUtility.getBlockCode() {
-            failedAttempts = 0
-            lockUntilDate = nil
-            aResultHandler(true)
-        } else {
-            aResultHandler(false)
-        }
-    }
-    
-    func passcodeViewControllerDidFailAttempt(_ aViewController: BKPasscodeViewController!) {
-        failedAttempts += 1
-        if failedAttempts > 5 {
-            var timeInterval: TimeInterval = 60
-            if failedAttempts > 6 {
-                let multiplier: Double = failedAttempts - 6
-                timeInterval = (5 * 60) * multiplier
-                if timeInterval > 3600 * 24 {
-                    timeInterval = 3600 * 24
-                }
-            }
-            lockUntilDate = NSDate.init(timeIntervalSinceNow: timeInterval)
-        }
-    }
-    
-    func passcodeViewControllerNumber(ofFailedAttempts aViewController: BKPasscodeViewController!) -> UInt {
-        return UInt(failedAttempts)
-    }
-    
-    func passcodeViewControllerLock(untilDate aViewController: BKPasscodeViewController!) -> Date? {
-        return lockUntilDate as Date?
-    }
-    
-    @objc func passcodeViewCloseButtonPressed(_ sender: Any) {
-        self.dismiss(animated: true, completion: nil)
-    }
-    
     // MARK: ACTION
     
     @IBAction func actionCancel(_ sender: Any) {
@@ -508,68 +464,6 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
         if dropdownMenu.token == "tapMoreHeaderMenuSelect" {
         }
     }
-    
-    // MARK: NAVIGATION
-    
-    private func performSegueDirectoryWithControlPasscode(controlPasscode: Bool) {
-        
-        guard let directoryPush = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, serverUrlPush))  else {
-            return
-        }
-        
-        if directoryPush.lock == true && CCUtility.getBlockCode() != nil && (CCUtility.getBlockCode()?.count)! > 0 && controlPasscode {
-            
-            let viewController = CCBKPasscode.init(nibName: nil, bundle: nil)
-            guard let touchIDManager = BKTouchIDManager.init(keychainServiceName: k_serviceShareKeyChain) else {
-                return
-            }
-            touchIDManager.promptText = NSLocalizedString("_scan_fingerprint_", comment: "")
-
-            viewController.delegate = self
-            viewController.type = BKPasscodeViewControllerCheckPasscodeType
-            viewController.inputViewTitlePassword = true
-            if CCUtility.getSimplyBlockCode() {
-                viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle
-                viewController.passcodeInputView.maximumLength = 6
-            } else {
-                viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle
-                viewController.passcodeInputView.maximumLength = 64
-            }
-            viewController.touchIDManager = touchIDManager
-            viewController.title = NSLocalizedString("_folder_blocked_", comment: "")
-            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonItem.SystemItem.cancel, target: self, action: #selector(passcodeViewCloseButtonPressed(_:)))
-            viewController.navigationItem.leftBarButtonItem?.tintColor = UIColor.black
-            
-            let navigationController = UINavigationController.init(rootViewController: viewController)
-            navigationController.modalPresentationStyle = .fullScreen
-            self.present(navigationController, animated: true, completion: nil)
-            
-            return
-        }
-        
-        guard let visualController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateViewController(withIdentifier: "NCSelect.storyboard") as? NCSelect else {
-            return
-        }
-        
-        visualController.delegate = delegate
-        
-        visualController.hideButtonCreateFolder = hideButtonCreateFolder
-        visualController.selectFile = selectFile
-        visualController.includeDirectoryE2EEncryption = includeDirectoryE2EEncryption
-        visualController.includeImages = includeImages
-        visualController.type = type
-        visualController.titleButtonDone = titleButtonDone
-        visualController.titleButtonDone1 = titleButtonDone1
-        visualController.layoutViewSelect = layoutViewSelect
-        visualController.isButtonDone1Hide = isButtonDone1Hide
-        visualController.isOverwriteHide = isOverwriteHide
-        visualController.overwrite = overwrite
-        
-        visualController.titleCurrentFolder = metadataPush!.fileNameView
-        visualController.serverUrl = serverUrlPush
-        
-        self.navigationController?.pushViewController(visualController, animated: true)
-    }
 }
 
 // MARK: - Collection View
@@ -594,14 +488,29 @@ extension NCSelect: UICollectionViewDelegate {
         
         if metadata.directory {
             
-            guard let serverUrlPush = CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName) else {
-                return
-            }
-            
+            guard let serverUrlPush = CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName) else { return }
+            guard let visualController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateViewController(withIdentifier: "NCSelect.storyboard") as? NCSelect else { return }
+
             self.serverUrlPush = serverUrlPush
             self.metadataPush = metadata
             
-            performSegueDirectoryWithControlPasscode(controlPasscode: true)
+            visualController.delegate = delegate
+            visualController.hideButtonCreateFolder = hideButtonCreateFolder
+            visualController.selectFile = selectFile
+            visualController.includeDirectoryE2EEncryption = includeDirectoryE2EEncryption
+            visualController.includeImages = includeImages
+            visualController.type = type
+            visualController.titleButtonDone = titleButtonDone
+            visualController.titleButtonDone1 = titleButtonDone1
+            visualController.layoutViewSelect = layoutViewSelect
+            visualController.isButtonDone1Hide = isButtonDone1Hide
+            visualController.isOverwriteHide = isOverwriteHide
+            visualController.overwrite = overwrite
+                
+            visualController.titleCurrentFolder = metadataPush!.fileNameView
+            visualController.serverUrl = serverUrlPush
+                   
+            self.navigationController?.pushViewController(visualController, animated: true)
             
         } else {
             

+ 0 - 2
iOSClient/Settings/CCSettings.m

@@ -518,7 +518,6 @@
             if (aViewController.fromType == CCBKPasscodeFromSettingsPasscode) {
                 
                 [CCUtility setBlockCode:@""];
-                [[NCManageDatabase sharedInstance] setAllDirectoryUnLockWithAccount:appDelegate.activeAccount];
                 [appDelegate.activeMain.tableView reloadData];
             }
             
@@ -527,7 +526,6 @@
                 
                 // disable passcode
                 [CCUtility setBlockCode:@""];
-                [[NCManageDatabase sharedInstance] setAllDirectoryUnLockWithAccount:appDelegate.activeAccount];
                 [appDelegate.activeMain.tableView reloadData];
                 
                 [CCUtility setSimplyBlockCode:![CCUtility getSimplyBlockCode]];