Marino Faggiana 8 жил өмнө
parent
commit
435d5eeec5

+ 3 - 0
iOSClient/AppDelegate.h

@@ -149,6 +149,9 @@
 // Animated title _brand_
 @property BOOL isTitleBrandAnimated;
 
+// Is in Crypto Mode
+@property BOOL isCryptoCloudMode;
+
 // Setting Active Account
 - (void)settingActiveAccount:(NSString *)activeAccount activeUrl:(NSString *)activeUrl activeUser:(NSString *)activeUser activePassword:(NSString *)activePassword activeUID:(NSString *)activeUID activeAccessToken:(NSString *)activeAccessToken typeCloud:(NSString *)typeCloud;
 

+ 2 - 2
iOSClient/CCGlobal.h

@@ -257,7 +257,7 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define k_pageOfflineLocal                              @"Local"
 
 // Search
-#define k_minCharsSearch                                3
+#define k_minCharsSearch                                2
 
 // -----------------------------------------------------------------------------------------------------------
 // COLOR
@@ -281,7 +281,7 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define COLOR_GRAY [UIColor colorWithRed:65.0/255.0 green:64.0/255.0 blue:66.0/255.0 alpha:1.0]                         // #414042 - A 1.0
 #define COLOR_CLEAR [UIColor colorWithRed:65.0/255.0 green:64.0/255.0 blue:66.0/255.0 alpha:1.0]
 #define COLOR_BAR [UIColor colorWithRed:(248.0f/255.0f) green:(248.0f/255.0f) blue:(248.0f/255.0f) alpha:1.0]
-#define COLOR_SEPARATOR_TABLE [UIColor colorWithRed:246.0/255.0 green:246.0/255.0 blue:246.0/255.0 alpha:1]           // Grigio chiaro
+#define COLOR_SEPARATOR_TABLE [UIColor colorWithRed:246.0/255.0 green:246.0/255.0 blue:246.0/255.0 alpha:1]             // Grigio chiaro
 #define COLOR_NO_CONNECTION [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0]
 #define COLOR_NAVBAR_IOS7 [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1.0]
 

+ 5 - 3
iOSClient/Create/CCCreateCloud.swift

@@ -70,10 +70,12 @@ class CreateMenuAdd: NSObject {
             appDelegate.activeMain.returnCreate(Int(k_returnCreateFilePlain))
         })
         
-        actionSheet.addButton(withTitle: NSLocalizedString("_upload_encrypted_mode", comment: ""), image: UIImage(named: "actionSheetLock"), backgroundColor: colorLightGray, height: 50.0, type: AHKActionSheetButtonType.encrypted, handler: {(AHKActionSheet) -> Void in
-            self.createMenuEncrypted(view: view)
-        })
+        if appDelegate.isCryptoCloudMode {
         
+            actionSheet.addButton(withTitle: NSLocalizedString("_upload_encrypted_mode", comment: ""), image: UIImage(named: "actionSheetLock"), backgroundColor: colorLightGray, height: 50.0, type: AHKActionSheetButtonType.encrypted, handler: {(AHKActionSheet) -> Void in
+                self.createMenuEncrypted(view: view)
+            })
+        }
         actionSheet.show()
         
         CCUtility.setCreateMenuEncrypted(false)

+ 14 - 2
iOSClient/Login/CCLogin.m

@@ -66,12 +66,14 @@
         [self.intro showIntroCryptoCloud:2.0];
     }
     
+    //REMOVECODE
+    /*
     // Request : Passcode
     if ([CCUtility getIntro:@"1.0"] == YES && [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
         
         [self passcodeVC];
     }
-    
+     
     // Request : Send Passcode email
     if ([CCUtility getIntro:@"1.0"] == YES && [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] > 0 && [CCUtility getEmail] == nil && [app.activeAccount length] == 0) {
         
@@ -81,12 +83,18 @@
         
         [self presentViewController:navigationController animated:YES completion:nil];
     }
-    
+
+     
     // OK all - Close
     if ([CCUtility getIntro:@"1.0"] == YES && [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] > 0 && [app.activeAccount length] > 0) {
         
         [self loginCorrect];
     }
+    */
+    
+    if ([CCUtility getIntro:@"1.0"] == YES && [app.activeAccount length] > 0) {
+         [self loginCorrect];
+    }
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -95,11 +103,15 @@
 
 - (IBAction)handleNextcloud:(id)sender
 {
+    //REMOVECODE
+    // Request CODE
+    /*
     if ([[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
         
         [self passcodeVC];
         return;
     }
+    */
     
     CCLoginNCOC *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
     

+ 76 - 50
iOSClient/Main/CCMain.m

@@ -309,6 +309,16 @@
         // This is Root
         _isRoot = YES;
         
+        // Crypto Mode
+        if ([[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
+           
+            app.isCryptoCloudMode = NO;
+            
+        } else {
+         
+            app.isCryptoCloudMode = YES;
+        }
+        
         // go Home
         [self.navigationController popToRootViewControllerAnimated:NO];
         
@@ -3509,41 +3519,43 @@
                                                                            [self moveOpenWindow:[self.tableView indexPathsForSelectedRows]];
                                                                        }];
     
-    // ITEM ENCRYPTED ------------------------------------------------------------------------------------------------------
-    
-    if (app.encryptItem == nil) app.encryptItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_encrypted_selected_files_", nil)
-                                                                                     subtitle:@""
-                                                                                        image:[UIImage imageNamed:image_encryptedSelectedFiles]
-                                                                             highlightedImage:nil
-                                                                                       action:^(REMenuItem *item) {
-                                                                                           [self performSelector:@selector(encryptedSelectedFiles) withObject:nil];
-                                                                                       }];
-    else app.encryptItem = [app.encryptItem initWithTitle:NSLocalizedString(@"_encrypted_selected_files_", nil)
-                                                           subtitle:@""
-                                                              image:[UIImage imageNamed:image_encryptedSelectedFiles]
-                                                   highlightedImage:nil
-                                                             action:^(REMenuItem *item) {
-                                                                 [self performSelector:@selector(encryptedSelectedFiles) withObject:nil];
-                                                             }];
-    
-    // ITEM DECRYPTED ----------------------------------------------------------------------------------------------------
+    if (app.isCryptoCloudMode) {
+    
+        // ITEM ENCRYPTED ------------------------------------------------------------------------------------------------------
+    
+        if (app.encryptItem == nil) app.encryptItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_encrypted_selected_files_", nil)
+                                                                               subtitle:@""
+                                                                                  image:[UIImage imageNamed:image_encryptedSelectedFiles]
+                                                                       highlightedImage:nil
+                                                                                 action:^(REMenuItem *item) {
+                                                                                     [self performSelector:@selector(encryptedSelectedFiles) withObject:nil];
+                                                                                 }];
+        else app.encryptItem = [app.encryptItem initWithTitle:NSLocalizedString(@"_encrypted_selected_files_", nil)
+                                                     subtitle:@""
+                                                        image:[UIImage imageNamed:image_encryptedSelectedFiles]
+                                             highlightedImage:nil
+                                                       action:^(REMenuItem *item) {
+                                                           [self performSelector:@selector(encryptedSelectedFiles) withObject:nil];
+                                                       }];
+    
+        // ITEM DECRYPTED ----------------------------------------------------------------------------------------------------
+    
+        if (app.decryptItem == nil) app.decryptItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_decrypted_selected_files_", nil)
+                                                                               subtitle:@""
+                                                                                  image:[UIImage imageNamed:image_decryptedSelectedFiles]
+                                                                       highlightedImage:nil
+                                                                                 action:^(REMenuItem *item) {
+                                                                                     [self performSelector:@selector(decryptedSelectedFiles) withObject:nil];
+                                                                                 }];
+        else app.decryptItem = [app.decryptItem initWithTitle:NSLocalizedString(@"_decrypted_selected_files_", nil)
+                                                     subtitle:@""
+                                                        image:[UIImage imageNamed:image_decryptedSelectedFiles]
+                                             highlightedImage:nil
+                                                       action:^(REMenuItem *item) {
+                                                           [self performSelector:@selector(decryptedSelectedFiles) withObject:nil];
+                                                       }];
+    }
     
-    if (app.decryptItem == nil) app.decryptItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_decrypted_selected_files_", nil)
-                                                                                           subtitle:@""
-                                                                                              image:[UIImage imageNamed:image_decryptedSelectedFiles]
-                                                                                   highlightedImage:nil
-                                                                                             action:^(REMenuItem *item) {
-                                                                                                 [self performSelector:@selector(decryptedSelectedFiles) withObject:nil];
-                                                                                             }];
-    else app.decryptItem = [app.decryptItem initWithTitle:NSLocalizedString(@"_decrypted_selected_files_", nil)
-                                                                 subtitle:@""
-                                                                    image:[UIImage imageNamed:image_decryptedSelectedFiles]
-                                                         highlightedImage:nil
-                                                                   action:^(REMenuItem *item) {
-                                                                       [self performSelector:@selector(decryptedSelectedFiles) withObject:nil];
-                                                                   }];
-
-
     // ITEM DOWNLOAD ----------------------------------------------------------------------------------------------------
     
     if (app.downloadItem == nil) app.downloadItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_download_selected_files_", nil)
@@ -3581,10 +3593,17 @@
 
     // REMENU --------------------------------------------------------------------------------------------------------------
     
-    if (app.reSelectMenu == nil)
-        app.reSelectMenu = [[REMenu alloc] initWithItems:@[app.deleteItem,app.moveItem, app.encryptItem, app.decryptItem, app.downloadItem, app.saveItem]];
-    else
-        app.reSelectMenu = [app.reSelectMenu initWithItems:@[app.deleteItem,app.moveItem, app.encryptItem, app.decryptItem, app.downloadItem, app.saveItem]];
+    if (app.isCryptoCloudMode) {
+        if (app.reSelectMenu == nil)
+            app.reSelectMenu = [[REMenu alloc] initWithItems:@[app.deleteItem,app.moveItem, app.encryptItem, app.decryptItem, app.downloadItem, app.saveItem]];
+        else
+            app.reSelectMenu = [app.reSelectMenu initWithItems:@[app.deleteItem,app.moveItem, app.encryptItem, app.decryptItem, app.downloadItem, app.saveItem]];
+    } else {
+        if (app.reSelectMenu == nil)
+            app.reSelectMenu = [[REMenu alloc] initWithItems:@[app.deleteItem,app.moveItem, app.downloadItem, app.saveItem]];
+        else
+            app.reSelectMenu = [app.reSelectMenu initWithItems:@[app.deleteItem,app.moveItem, app.downloadItem, app.saveItem]];
+    }
     
     app.reSelectMenu.imageOffset = CGSizeMake(5, -1);
     
@@ -3684,7 +3703,11 @@
         UIMenuItem *pasteFilesItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_paste_files_", nil) action:@selector(pasteFiles:)];
         UIMenuItem *pasteFilesEncryptedItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_paste_files_encrypted_", nil) action:@selector(pasteFilesEncrypted:)];
         
-        [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, openinFileItem, pasteFileItem, pasteFilesItem, pasteFileEncryptedItem, pasteFilesEncryptedItem, nil]];
+        if (app.isCryptoCloudMode)
+            [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, openinFileItem, pasteFileItem, pasteFilesItem, pasteFileEncryptedItem, pasteFilesEncryptedItem, nil]];
+        else
+            [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, openinFileItem, pasteFileItem, pasteFilesItem, nil]];
+
         [menuController setTargetRect:CGRectMake(touchPoint.x, touchPoint.y, 0.0f, 0.0f) inView:tableView];
         [menuController setMenuVisible:YES animated:YES];
     }
@@ -4187,7 +4210,7 @@
                                     }];
         }
         
-        if (!([_metadata.fileName isEqualToString:cameraUploadFolderName] == YES && [serverUrl isEqualToString:cameraUploadFolderPath] == YES) && !lockDirectory) {
+        if (!([_metadata.fileName isEqualToString:cameraUploadFolderName] == YES && [serverUrl isEqualToString:cameraUploadFolderPath] == YES) && !lockDirectory && app.isCryptoCloudMode) {
             
             [actionSheet addButtonWithTitle:titoloCriptaDecripta
                                       image:[UIImage imageNamed:image_actionSheetCrypto]
@@ -4391,18 +4414,21 @@
                                     }];
         }
 
-        [actionSheet addButtonWithTitle:titoloCriptaDecripta
-                                  image:[UIImage imageNamed:image_actionSheetCrypto]
-                        backgroundColor:[UIColor whiteColor]
-                                 height: 50.0
-                                   type:AHKActionSheetButtonTypeEncrypted
-                                handler:^(AHKActionSheet *as) {
+        if (app.isCryptoCloudMode) {
+            
+            [actionSheet addButtonWithTitle:titoloCriptaDecripta
+                                      image:[UIImage imageNamed:image_actionSheetCrypto]
+                            backgroundColor:[UIColor whiteColor]
+                                     height: 50.0
+                                       type:AHKActionSheetButtonTypeEncrypted
+                                    handler:^(AHKActionSheet *as) {
                                     
-                                    // close swipe
-                                    [self setEditing:NO animated:YES];
+                                        // close swipe
+                                        [self setEditing:NO animated:YES];
                                     
-                                    [self performSelector:@selector(cmdEncryptedDecryptedFile) withObject:nil];
-                                }];
+                                        [self performSelector:@selector(cmdEncryptedDecryptedFile) withObject:nil];
+                                    }];
+        }
         
         [actionSheet addButtonWithTitle:titoloOffline
                                   image:[UIImage imageNamed:image_actionSheetOffline]

+ 3 - 1
iOSClient/Main/CCSplit.m

@@ -136,7 +136,9 @@
 
 - (void)newAccount
 {
-    if ([app.activeAccount length] == 0 || [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
+    // REMOVECODE
+    //if ([app.activeAccount length] == 0 || [[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
+    if ([app.activeAccount length] == 0) {
     
         CCLogin *viewController = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLogin"];
     

+ 0 - 1
iOSClient/Security/CCCrypto.m

@@ -40,7 +40,6 @@
     return key;
 }
 
-
 - (void)autoInsertPasscodeUUID:(NSString *)uuid text:(NSString *)text
 {
     NSString *key;

+ 4 - 1
iOSClient/Utility/CCUtility.m

@@ -199,10 +199,13 @@
 
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid
 {
-    if (!uuid) return nil;
+    if (!uuid) return @"";
     
     NSString *passcode = [UICKeyChainStore stringForKey:uuid service:k_serviceShareKeyChain];
     
+    if (!passcode)
+        passcode = @"";
+    
     return passcode;
 }