Explorar el Código

Add menu Crypto Cloud

Marino Faggiana hace 8 años
padre
commit
054f3b8a23

+ 24 - 20
Share Ext/ShareViewController.m

@@ -39,6 +39,7 @@
     UIColor *tintColor;
     
     NSMutableArray *_filesSendCryptated;
+    BOOL _isCryptoCloudMode;
 }
 @end
 
@@ -72,6 +73,16 @@
         _directoryUser = [CCUtility getDirectoryActiveUser:self.activeUser activeUrl:self.activeUrl];
         _typeCloud = recordAccount.typeCloud;
         
+        if ([[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
+            
+            _isCryptoCloudMode = NO;
+            
+        } else {
+            
+            _isCryptoCloudMode = YES;
+        }
+
+        
         if ([_activeAccount isEqualToString:[CCUtility getActiveAccountShareExt]]) {
             
             // load
@@ -80,7 +91,8 @@
             
             _destinyFolderButton.title = [NSString stringWithFormat:NSLocalizedString(@"_destiny_folder_", nil), [CCUtility getTitleServerUrlShareExt]];
             
-            _localCryptated = [CCUtility getCryptatedShareExt];
+            if (_isCryptoCloudMode)
+                _localCryptated = [CCUtility getCryptatedShareExt];
             
         } else {
             
@@ -94,8 +106,8 @@
             _destinyFolderButton.title = [NSString stringWithFormat:NSLocalizedString(@"_destiny_folder_", nil), NSLocalizedString(@"_home_", nil)];
             [CCUtility setTitleServerUrlShareExt:NSLocalizedString(@"_home_", nil)];
 
-            _localCryptated = YES;
-            [CCUtility setCryptatedShareExt:YES];
+            _localCryptated = NO;
+            [CCUtility setCryptatedShareExt:NO];
         }
     }
 
@@ -166,7 +178,7 @@
     self.navigationController.navigationBar.tintColor = tintColor;
     
     // Upload
-    if (self.localCryptated) {
+    if (self.localCryptated && _isCryptoCloudMode) {
         
         rightButtonUpload = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"_save_encrypted_", nil) style:UIBarButtonItemStylePlain target:self action:@selector(selectPost)];
         [rightButtonUpload setTintColor:COLOR_ENCRYPTED];
@@ -176,10 +188,12 @@
         rightButtonUpload = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"_save_", nil) style:UIBarButtonItemStylePlain target:self action:@selector(selectPost)];
     }
     
-    // Encrypt
-    UIImage *icon = [[UIImage imageNamed:image_shareExtEncrypt] imageWithRenderingMode:UIImageRenderingModeAutomatic];
-    rightButtonEncrypt = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStylePlain target:self action:@selector(changeEncrypt)];
-    if (self.localCryptated) [rightButtonEncrypt setTintColor:COLOR_ENCRYPTED];
+    // Encrypt ICON
+    if (_isCryptoCloudMode) {
+        UIImage *icon = [[UIImage imageNamed:image_shareExtEncrypt] imageWithRenderingMode:UIImageRenderingModeAutomatic];
+        rightButtonEncrypt = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStylePlain target:self action:@selector(changeEncrypt)];
+        if (self.localCryptated) [rightButtonEncrypt setTintColor:COLOR_ENCRYPTED];
+    }
     
     // Cancel
     leftButtonCancel = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIBarButtonItemStylePlain target:self action:@selector(cancelPost)];
@@ -330,19 +344,9 @@
 - (void)addNetworkingQueue:(CCMetadataNet *)metadataNet
 {
     id operation;
-    BOOL isCryptoCloudMode;
-    
-    if ([[CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]] length] == 0) {
-        
-        isCryptoCloudMode = NO;
-        
-    } else {
-        
-        isCryptoCloudMode = YES;
-    }
-
+   
     if ([_typeCloud isEqualToString:typeCloudOwnCloud] || [_typeCloud isEqualToString:typeCloudNextcloud])
-        operation = [[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:_activeUser withPassword:_activePassword withUrl:_activeUrl withTypeCloud:_typeCloud activityIndicator:NO isCryptoCloudMode:isCryptoCloudMode];
+        operation = [[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:_activeUser withPassword:_activePassword withUrl:_activeUrl withTypeCloud:_typeCloud activityIndicator:NO isCryptoCloudMode:_isCryptoCloudMode];
     
     [operation setQueuePriority:metadataNet.priority];
     

+ 53 - 49
iOSClient/Settings/CCSettings.m

@@ -51,11 +51,12 @@
     XLFormSectionDescriptor *section;
     XLFormRowDescriptor *row;
     
-    // Section : Settings
-    
     form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_settings_", nil)];
     form.rowNavigationOptions = XLFormRowNavigationOptionNone;
     
+    
+    // Section : PASSWORD --------------------------------------------------------------
+    
     section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_passcode_", nil)];
     [form addFormSection:section];
     
@@ -90,9 +91,9 @@
         [section addFormRow:row];
     }
     
-    // Section : data Cloud
+    // Section : CLOUD ACCOUNT --------------------------------------------------------------
     
-    section = [XLFormSectionDescriptor formSectionWithTitle:@"Cloud account"];
+    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_cloud_account_", nil)];
     [form addFormSection:section];
     
     // version
@@ -119,7 +120,6 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
     [section addFormRow:row];
 
-    
     // Change Account
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"changecredentials" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_change_credentials_", nil)];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
@@ -127,9 +127,9 @@
     row.action.formSegueIdentifier = @"CCManageAccountSegue";
     [section addFormRow:row];
     
-    // Section : Camera Upload
+    // Section --------------------------------------------------------------
     
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_uploading_from_camera_", nil)];
+    section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
     
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"cameraupload" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_uploading_from_camera_", nil)];
@@ -138,9 +138,9 @@
     row.action.formSegueIdentifier = @"CCManageCameraUploadSegue";
     [section addFormRow:row];
 
-    // Section : Optimizations
+    // Section --------------------------------------------------------------
     
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_optimizations_", nil)];
+    section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
     
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"optimizations" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_optimizations_", nil)];
@@ -149,13 +149,25 @@
     row.action.formSegueIdentifier = @"CCManageOptimizationsSegue";
     [section addFormRow:row];
 
-    // Section : Acknowledgements
-
+    // Section --------------------------------------------------------------
+    
     section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
     
+    // Crypto Cloud
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"cryptocloud" rowType:XLFormRowDescriptorTypeButton title:@"Crypto Cloud"];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [row.cellConfig setObject:[UIImage imageNamed:image_settingsCredentials] forKey:@"imageView.image"];
+    row.action.formSegueIdentifier = @"CCManageCryptoCloud";
+    [section addFormRow:row];
+    
+    // Section : INFORMATION --------------------------------------------------------------
+
+    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_information_", nil)];
+    [form addFormSection:section];
     section.footerTitle = @"Nextcloud © 2017 T.W.S. Inc.";
     
+    // Acknowledgements
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"buttonLeftAligned" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_acknowledgements_", nil)];
     [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
@@ -167,29 +179,13 @@
     };
     [section addFormRow:row];
     
-    // Version
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"versioneapplicazione" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_app_version_", nil)];
-    row.value = [NSString stringWithFormat:@"%@ (%@)", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
-    [section addFormRow:row];
-    
-    // Section : help
-    
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_help_", nil)];
-    [form addFormSection:section];
-    
+    // Help
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"help" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_help_", nil)];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [row.cellConfig setObject:[UIImage imageNamed:image_settingsHelp] forKey:@"imageView.image"];
     row.action.formSegueIdentifier = @"CCManageHelpSegue";
     [section addFormRow:row];
-    
-    // Section : mail
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    
+
     // Contact us mail
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sendmail" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_contact_by_email_", nil)];
     [row.cellConfig setObject:COLOR_BRAND forKey:@"textLabel.textColor"];
@@ -198,7 +194,15 @@
     row.action.formSelector = @selector(sendMail:);
     [section addFormRow:row];
 
-    // Section : cache
+    // Version
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"versioneapplicazione" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_app_version_", nil)];
+    row.value = [NSString stringWithFormat:@"%@ (%@)", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
+    [section addFormRow:row];
+    
+   
+    // Section --------------------------------------------------------------
     
     section = [XLFormSectionDescriptor formSection];
     [form addFormSection:section];
@@ -210,9 +214,26 @@
     row.action.formSelector = @selector(azzeraCache:);
     [section addFormRow:row];
 
-    // Section : debug
+    // Section --------------------------------------------------------------
+    
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    
+    // Exit
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"esci" rowType:XLFormRowDescriptorTypeButton title:[CCUtility localizableBrand:@"_exit_" table:nil]];
+    
+    [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [row.cellConfig setObject:[UIImage imageNamed:image_settingsExit] forKey:@"imageView.image"];
+    row.action.formSelector = @selector(esci:);
+    [section addFormRow:row];
+    
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
     
 #ifdef DEBUG
+    // Section : debug
+    
     section = [XLFormSectionDescriptor formSectionWithTitle:@"Debug"];
     [form addFormSection:section];
     
@@ -243,7 +264,7 @@
     [row.cellConfig setObject:[UIImage imageNamed:image_settingsAdmin] forKey:@"imageView.image"];
     row.action.formSelector = @selector(copyDirGroupToLocal:);
     [section addFormRow:row];
-
+    
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"quickActionPhotos" rowType:XLFormRowDescriptorTypeButton title:@"Quick Action Photos"];
     [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
@@ -252,23 +273,6 @@
     [section addFormRow:row];
 #endif
 
-    // Section : quit
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    
-    // Exit
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"esci" rowType:XLFormRowDescriptorTypeButton title:[CCUtility localizableBrand:@"_exit_" table:nil]];
-    
-    [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIImage imageNamed:image_settingsExit] forKey:@"imageView.image"];
-    row.action.formSelector = @selector(esci:);
-    [section addFormRow:row];
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    
     self.form = form;
 }
 

+ 9 - 2
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.m

@@ -108,8 +108,15 @@
             break;
         case 4:
             
-            if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:102]; nameLabel.text = NSLocalizedString(@"_upload_file_", nil); }
-            if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:103]; nameLabel.text = NSLocalizedString(@"_upload_encrypted_file_", nil); }
+            if (row == 0) {
+                nameLabel = (UILabel *)[cell viewWithTag:102]; nameLabel.text = NSLocalizedString(@"_upload_file_", nil);
+            }
+            
+            if (row == 1) {
+                nameLabel = (UILabel *)[cell viewWithTag:103]; nameLabel.text = NSLocalizedString(@"_upload_encrypted_file_", nil);
+                if (app.isCryptoCloudMode == NO)
+                    cell.hidden = YES;
+            }
             break;
     }
     

+ 2 - 0
iOSClient/en.lproj/Localizable.strings

@@ -128,6 +128,8 @@
 "_change_simply_passcode_"  = "Change password type";
 "_quota_"                   = "Quota";
 "_available_"               = "available";
+"_cloud_account_"           = "Cloud Account";
+"_information_"             = "Information";
 
 // Manage Camera Upload