Marino Faggiana 7 жил өмнө
parent
commit
5a442a385d

+ 1 - 2
iOSClient/Brand/NCBrand.swift

@@ -35,7 +35,7 @@ class NCBrandColor: NSObject {
 
     @objc public var brand:                   UIColor
     @objc public var connectionNo:            UIColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)
-    @objc public var cryptocloud:             UIColor = UIColor(red: 241.0/255.0, green: 90.0/255.0, blue: 34.0/255.0, alpha: 1.0)
+    @objc public var encrypted:               UIColor = .red
     @objc public var navigationBarProgress:   UIColor = .white
     @objc public var navigationBarText:       UIColor = .white
     @objc public var menuBackground:          UIColor = .white
@@ -98,7 +98,6 @@ class NCBrandColor: NSObject {
     @objc public let disable_linkLoginProvider:       Bool = false
     @objc public let disable_request_login_url:       Bool = false
     @objc public let disable_multiaccount:            Bool = false
-    @objc public let disable_cryptocloudsystem:       Bool = false
     @objc public let disable_manage_account:          Bool = false
     
     override init() {

+ 1 - 1
iOSClient/Create/CCCreateCloud.swift

@@ -30,7 +30,7 @@ class CreateMenuAdd: NSObject {
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
     let fontButton = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: UIColor.black]
-    let fontEncrypted = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.cryptocloud as UIColor]
+    let fontEncrypted = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.encrypted as UIColor]
     let fontCancel = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue-Bold", size: 17)!, NSAttributedStringKey.foregroundColor: UIColor.black]
     let fontDisable = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: UIColor.darkGray]
 

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

@@ -372,7 +372,7 @@
     
     actionSheet.automaticallyTintButtonImages = @(NO);
     
-    actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[NCBrandColor sharedInstance].cryptocloud };
+    actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[NCBrandColor sharedInstance].encrypted };
     actionSheet.buttonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[UIColor blackColor] };
     actionSheet.cancelButtonTextAttributes = @{ NSFontAttributeName:[UIFont boldSystemFontOfSize:17], NSForegroundColorAttributeName:[UIColor blackColor] };
     actionSheet.disableButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[UIColor darkGrayColor] };

+ 3 - 4
iOSClient/Main/CCMain.m

@@ -3763,7 +3763,7 @@
 
         viewController.title = NSLocalizedString(@"_passcode_protection_", nil);
         viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-        viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
+        viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].encrypted;
         
         UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
         [self presentViewController:navigationController animated:YES completion:nil];
@@ -3910,7 +3910,7 @@
     
     actionSheet.automaticallyTintButtonImages = @(NO);
     
-    actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[NCBrandColor sharedInstance].cryptocloud };
+    actionSheet.encryptedButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[NCBrandColor sharedInstance].encrypted };
     actionSheet.buttonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[UIColor blackColor] };
     actionSheet.cancelButtonTextAttributes = @{ NSFontAttributeName:[UIFont boldSystemFontOfSize:17], NSForegroundColorAttributeName:[UIColor blackColor] };
     actionSheet.disableButtonTextAttributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:16], NSForegroundColorAttributeName:[UIColor darkGrayColor] };
@@ -4051,7 +4051,7 @@
         
         if (!([_metadata.fileName isEqualToString:autoUploadFileName] == YES && [serverUrl isEqualToString:autoUploadDirectory] == YES) && !lockDirectory && [CCUtility isEndToEndEnabled:app.activeAccount]) {
             
-            [actionSheet addButtonWithTitle:@"Delete as encrypted"
+            [actionSheet addButtonWithTitle:@"Delete mark as encrypted"
                                       image:[UIImage imageNamed:@"actionSheetCrypto"]
                             backgroundColor:[UIColor whiteColor]
                                      height: 50.0
@@ -5186,7 +5186,6 @@
             
             viewController.title = NSLocalizedString(@"_folder_blocked_", nil);
             viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-            //viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
             
             UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
             [self presentViewController:navController animated:YES completion:nil];

+ 1 - 1
iOSClient/Move/CCMove.m

@@ -500,7 +500,7 @@
         
         viewController.title = NSLocalizedString(@"_folder_blocked_", nil);
         viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-        viewController.navigationItem.leftBarButtonItem.tintColor = NCBrandColor.sharedInstance.cryptocloud;
+        viewController.navigationItem.leftBarButtonItem.tintColor = NCBrandColor.sharedInstance.encrypted;
         
         UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
         [self presentViewController:navController animated:YES completion:nil];

+ 0 - 35
iOSClient/Settings/CCManageCryptoCloud.h

@@ -1,35 +0,0 @@
-//
-//  CCManageCryptoCloud.h
-//  Nextcloud iOS
-//
-//  Created by Marino Faggiana on 13/02/17.
-//  Copyright (c) 2017 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "XLFormViewController.h"
-#import "XLForm.h"
-#import "BKPasscodeViewController.h"
-#import "CCManageCryptoCloudSecurity.h"
-#import <MessageUI/MessageUI.h>
-
-@interface CCManageCryptoCloud : XLFormViewController <BKPasscodeViewControllerDelegate, MFMailComposeViewControllerDelegate, CCManageCryptoCloudSecurityDelegate>
-
-@property (nonatomic) NSUInteger failedAttempts;
-@property (strong, nonatomic) NSDate *lockUntilDate;
-
-@end

+ 0 - 303
iOSClient/Settings/CCManageCryptoCloud.m

@@ -1,303 +0,0 @@
-//
-//  CCManageCryptoCloud.m
-//  Nextcloud iOS
-//
-//  Created by Marino Faggiana on 13/02/17.
-//  Copyright (c) 2017 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "CCManageCryptoCloud.h"
-#import "AppDelegate.h"
-#import "NCBridgeSwift.h"
-
-@implementation CCManageCryptoCloud
-
--(id)init
-{
-    XLFormDescriptor *form ;
-    XLFormSectionDescriptor *section;
-    XLFormRowDescriptor *row;
-    
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
-    
-    form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_crypto_cloud_system_", nil)];
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    section.footerTitle = NSLocalizedString(@"_footer_crypto_cloud_", nil);
-    
-    // Activation Crypto Cloud Mode
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"activatecryptocloud" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_activation_crypto_cloud_", nil)];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIImage imageNamed:@"settingsCryptoCloud"] forKey:@"imageView.image"];
-    [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
-    [row.cellConfig setObject:[NCBrandColor sharedInstance].brand forKey:@"textLabel.textColor"];
-    row.action.formSelector = @selector(activateCryptoCloud:);
-    row.hidden = @(YES);
-    [section addFormRow:row];
-    
-    // Deactivation Crypto Cloud Mode
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"deactivatecryptocloud" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_deactivation_crypto_cloud_", nil)];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIImage imageNamed:@"settingsRemoveCryptoCloud"] forKey:@"imageView.image"];
-    [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
-    [row.cellConfig setObject:[NCBrandColor sharedInstance].brand forKey:@"textLabel.textColor"];
-    row.action.formSelector = @selector(disactivateCryptoCloud:);
-    row.hidden = @(YES);
-    [section addFormRow:row];
-
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    
-    return [super initWithForm:form];
-}
-
-// Apparirà
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-    
-    self.tableView.backgroundColor = [NCBrandColor sharedInstance].tableBackground;
-    
-    // Color
-    [app aspectNavigationControllerBar:self.navigationController.navigationBar online:[app.reachability isReachable] hidden:NO];
-    [app aspectTabBar:self.tabBarController.tabBar hidden:NO];
-    
-    [self reloadForm];
-}
-
-- (void)changeTheming
-{
-    if (self.isViewLoaded && self.view.window)
-        [app changeTheming:self];
-}
-
-- (void)activateCryptoCloud:(XLFormRowDescriptor *)sender
-{
-    [self deselectFormRow:sender];
-    
-    CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
-    viewController.delegate = self;
-    
-    viewController.type = BKPasscodeViewControllerNewPasscodeType;
-
-    viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
-    viewController.passcodeInputView.maximumLength = 64;
-    
-    viewController.title = NSLocalizedString(@"_key_aes_256_", nil);
-    
-    viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-    viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
-    
-    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-    [self presentViewController:navigationController animated:YES completion:nil];
-}
-
-- (void)disactivateCryptoCloud:(XLFormRowDescriptor *)sender
-{
-    CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
-    viewController.delegate = self;
-    
-    viewController.type = BKPasscodeViewControllerCheckPasscodeType;
-    
-    viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;
-    viewController.passcodeInputView.maximumLength = 64;
-    
-    viewController.title = NSLocalizedString(@"_check_key_aes_256_", nil);
-    
-    viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-    viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
-    
-    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
-    [self presentViewController:navigationController animated:YES completion:nil];
-}
-
-- (void)closeCryptoCloudSecurity
-{
-    // @"Attivazione avvenuta correttamente, ora potrai usufruire di tutte le funzionalità aggiuntive. Ti ricordiamo che i file cifrati possono essere decifrati sono sui dispositivi iOS"
-    UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_info_", nil) message:NSLocalizedString(@"_alert_activation_crypto_cloud_", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-    [alertView show];
-}
-
-- (void)activateSecurityOptions
-{
-    CCManageCryptoCloudSecurity *vc = [[CCManageCryptoCloudSecurity alloc] initWithDelegate:self];
-    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
-    
-    [nc setModalPresentationStyle:UIModalPresentationFormSheet];
-    [self presentViewController:nc animated:YES completion:nil];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark == BKPasscodeViewController ==
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)passcodeViewController:(BKPasscodeViewController *)aViewController didFinishWithPasscode:(NSString *)aPasscode
-{
-    switch (aViewController.type) {
-            
-        case BKPasscodeViewControllerNewPasscodeType: {
-            
-            // min passcode 4 chars
-            if ([aPasscode length] >= 4) {
-                
-                [CCUtility setKeyChainPasscodeForUUID:[CCUtility getUUID] conPasscode:aPasscode];
-                
-                // verify
-                NSString *pwd = [CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]];
-                
-                if ([pwd isEqualToString:aPasscode] == NO || pwd == nil) {
-                    
-                    UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:@"Fatal error writing key" delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-                    [alertView show];
-                        
-                } else {
-                
-                    // Crypto Cloud Mode : Activated
-                    app.isCryptoCloudMode = YES;
-                        
-                    // force reload all directory for all users
-                    [[NCManageDatabase sharedInstance] setClearAllDateReadDirectory];
-                    
-                    // 3D Touch
-                    [app configDynamicShortcutItems];
-
-                    // Request : Send Passcode email
-                    [self performSelector:@selector(activateSecurityOptions) withObject:nil afterDelay:0.1];
-                }
-                
-            } else {
-                
-                UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:NSLocalizedString(@"_passcode_too_short_", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-                [alertView show];
-            }
-            
-            [aViewController dismissViewControllerAnimated:YES completion:nil];
-        }
-        break;
-        
-        case BKPasscodeViewControllerCheckPasscodeType: {
-            
-            // Crypto Cloud Mode : Deactivated
-            [CCUtility adminRemovePasscode];
-            app.isCryptoCloudMode = NO;
-            
-            // 3D touch
-            [app configDynamicShortcutItems];
-
-            // force reload all directory for all users and all metadata cryptated
-            [[NCManageDatabase sharedInstance] setClearAllDateReadDirectory];
-            [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"cryptated == true"] clearDateReadDirectoryID:nil];
-            
-            UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_info_", nil) message:NSLocalizedString(@"_alert_deactivation_crypto_cloud_", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-            [alertView show];
-            
-            [aViewController dismissViewControllerAnimated:YES completion:nil];
-        }
-        break;
-            
-        default:
-            
-        break;
-    }
-}
-
-- (void)passcodeViewController:(BKPasscodeViewController *)aViewController authenticatePasscode:(NSString *)aPasscode resultHandler:(void (^)(BOOL))aResultHandler
-{
-    if (aViewController.type == BKPasscodeViewControllerCheckPasscodeType) {
-        
-        NSString *key = [CCUtility getKeyChainPasscodeForUUID:[CCUtility getUUID]];
-        
-        if ([aPasscode isEqualToString:key]) {
-            
-            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];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Reload Form ===
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)reloadForm
-{
-    XLFormRowDescriptor *rowActivateCryptoCloud = [self.form formRowWithTag:@"activatecryptocloud"];
-    XLFormRowDescriptor *rowDeactivateCryptoCloud = [self.form formRowWithTag:@"deactivatecryptocloud"];
-    XLFormRowDescriptor *rowSendMailEncryptPass = [self.form formRowWithTag:@"sendmailencryptpass"];
-
-    if (app.isCryptoCloudMode) {
-        
-        rowActivateCryptoCloud.hidden = @(YES);
-        rowDeactivateCryptoCloud.hidden = @(NO);
-        rowSendMailEncryptPass.hidden = @(NO);
-        
-    } else {
-        
-        rowActivateCryptoCloud.hidden = @(NO);
-        rowDeactivateCryptoCloud.hidden = @(YES);
-        rowSendMailEncryptPass.hidden = @(YES);
-    }
-
-    [self.tableView reloadData];
-}
-
-@end

+ 0 - 45
iOSClient/Settings/CCManageCryptoCloudSecurity.h

@@ -1,45 +0,0 @@
-//
-//  CCManageCryptoCloudSecurity.h
-//  Nextcloud iOS
-//
-//  Created by Marino Faggiana on 31/03/16.
-//  Copyright (c) 2017 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-
-#import "XLFormViewController.h"
-#import "XLForm.h"
-#import "CCUtility.h"
-
-@protocol CCManageCryptoCloudSecurityDelegate;
-
-@interface CCManageCryptoCloudSecurity : XLFormViewController <MFMailComposeViewControllerDelegate>
-
-- (id)initWithDelegate:(id <CCManageCryptoCloudSecurityDelegate>)delegate;
-
-@property(nonatomic, weak) id <CCManageCryptoCloudSecurityDelegate> delegate;
-
-@end
-
-@protocol CCManageCryptoCloudSecurityDelegate <NSObject>
-
-- (void)closeCryptoCloudSecurity;
-
-@end

+ 0 - 180
iOSClient/Settings/CCManageCryptoCloudSecurity.m

@@ -1,180 +0,0 @@
-//
-//  CCManageCryptoCloudSecurity.m
-//  Nextcloud iOS
-//
-//  Created by Marino Faggiana on 31/03/16.
-//  Copyright (c) 2017 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "CCManageCryptoCloudSecurity.h"
-#import "AppDelegate.h"
-#import "NCBridgeSwift.h"
-
-@interface CCManageCryptoCloudSecurity()
-{
-    NSTimer* myTimer;
-    NSMutableDictionary *field;
-}
-@end
-
-@implementation CCManageCryptoCloudSecurity
-
-- (id)initWithDelegate:(id <CCManageCryptoCloudSecurityDelegate>)delegate
-{    
-    self = [super init];
-    
-    if (self){
-        
-        self.delegate = delegate;
-        
-        XLFormDescriptor * form ;
-        XLFormSectionDescriptor *section;
-        XLFormRowDescriptor *row;
-        
-        form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_title_form_security_init_", nil)];
-        
-        // form mail
-        section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_security_init_required_mail_", nil)];
-        [form addFormSection:section];
-        form.assignFirstResponderOnShow = YES;
-        form.rowNavigationOptions = XLFormRowNavigationOptionNone;
-        
-        // mail
-        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"mail" rowType:XLFormRowDescriptorTypeEmail title:NSLocalizedString(@"_email_", nil)];
-        [row.cellConfig setObject:[UIColor blackColor] forKey:@"textField.textColor"];
-        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textField.font"];
-        [section addFormRow:row];
-        
-        section = [XLFormSectionDescriptor formSection];
-        [form addFormSection:section];
-        
-        // Send aes-256 password via mail
-        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sendmailencryptpass" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_encryptpass_by_email_", nil)];
-        [row.cellConfig setObject:@(NSTextAlignmentCenter) forKey:@"textLabel.textAlignment"];
-        [row.cellConfig setObject:[NCBrandColor sharedInstance].cryptocloud forKey:@"textLabel.textColor"];
-        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-        [row.cellConfig setObject:[UIImage imageNamed:@"settingsKeyMail"] forKey:@"imageView.image"];
-        row.action.formSelector = @selector(sendMailEncryptPass:);
-        //row.disabled = @1;
-        [section addFormRow:row];
-
-        section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_security_init_required_hint_", nil)];
-        [form addFormSection:section];
-        
-        // hint
-        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"hint" rowType:XLFormRowDescriptorTypeText title:NSLocalizedString(@"_hint_", nil)];
-        [row.cellConfig setObject:[UIColor blackColor] forKey:@"textField.textColor"];
-        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textField.font"];
-        row.value = [CCUtility getHint];
-
-        [section addFormRow:row];
-
-        self.form = form;
-    
-        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(donePressed)];
-    }
-    
-    return self;
-}
-
-// Apparirà
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-    
-    self.tableView.backgroundColor = [NCBrandColor sharedInstance].tableBackground;
-    
-    // Color
-    [app aspectNavigationControllerBar:self.navigationController.navigationBar online:[app.reachability isReachable] hidden:NO];
-    [app aspectTabBar:self.tabBarController.tabBar hidden:NO];
-}
-
--(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
-{
-    [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark - ==== Done ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)donePressed
-{
-    XLFormRowDescriptor *rowMail = [self.form formRowWithTag:@"mail"];
-    XLFormRowDescriptor *rowHint = [self.form formRowWithTag:@"hint"];
-    
-    if ([CCUtility isValidEmail:rowMail.value])
-        [CCUtility setEmail:(NSString *)rowMail.value];
-    else
-        [CCUtility setEmail:@""];
-    
-    if ([rowHint.value length] >0)
-        [CCUtility setHint:(NSString *)rowHint.value];
-    else
-        [CCUtility setHint:@""];
-    
-    [self.delegate closeCryptoCloudSecurity];
-    
-    [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Mail ===
-#pragma --------------------------------------------------------------------------------------------
-
-- (void) mailComposeController:(MFMailComposeViewController *)vc didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
-{
-    switch (result) {
-            
-        case MFMailComposeResultCancelled:
-            [app messageNotification:@"_info_" description:@"_mail_deleted_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:error.code];
-            break;
-        case MFMailComposeResultSaved:
-            [app messageNotification:@"_info_" description:@"_mail_saved_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:error.code];
-            break;
-        case MFMailComposeResultSent:
-            [app messageNotification:@"_info_" description:@"_mail_sent_" visible:YES  delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:error.code];
-            break;
-        case MFMailComposeResultFailed: {
-            NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"_mail_failure_", nil), [error localizedDescription]];
-            [app messageNotification:@"_error_" description:msg visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
-        }
-            break;
-        default:
-            break;
-    }
-    
-    // Close the Mail Interface
-    [self dismissViewControllerAnimated:YES completion:NULL];
-    
-    // Close 
-    [self donePressed];
-}
-
-- (void)sendMailEncryptPass:(XLFormRowDescriptor *)sender
-{
-    [self deselectFormRow:sender];
-    
-    XLFormRowDescriptor *row = [self.form formRowWithTag:@"mail"];
-    
-    [CCUtility sendMailEncryptPass:row.value validateEmail:YES form:self nameImage:@"backgroundDetail"];
-}
-
-@end

+ 4 - 5
iOSClient/Settings/CCSettings.m

@@ -27,7 +27,6 @@
 #import "OCCapabilities.h"
 #import "CCSynchronize.h"
 #import "CCAdvanced.h"
-#import "CCManageCryptoCloud.h"
 #import "CCManageAccount.h"
 #import "NCManageEndToEndEncryption.h"
 #import "NCBridgeSwift.h"
@@ -285,7 +284,7 @@
     viewController.title = NSLocalizedString(@"_check_key_aes_256_", nil);
     
     viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-    viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
+    viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].encrypted;
     
     UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
     [self presentViewController:navigationController animated:YES completion:nil];
@@ -316,7 +315,7 @@
     viewController.touchIDManager = touchIDManager;
     
     viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-    viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
+    viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].encrypted;
     
     UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
     [self presentViewController:navigationController animated:YES completion:nil];
@@ -351,7 +350,7 @@
         viewController.title = NSLocalizedString(@"_passcode_activate_", nil);
         
         viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-        viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
+        viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].encrypted;
                
         UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
         [self presentViewController:navigationController animated:YES completion:nil];
@@ -383,7 +382,7 @@
         viewController.title = NSLocalizedString(@"_disabling_passcode_", nil);
             
         viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(passcodeViewCloseButtonPressed:)];
-        viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].cryptocloud;
+        viewController.navigationItem.leftBarButtonItem.tintColor = [NCBrandColor sharedInstance].encrypted;
         
         UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
         [self presentViewController:navigationController animated:YES completion:nil];