Marino Faggiana 8 年 前
コミット
73df50fd7c

+ 4 - 1
iOSClient/Login/CCLogin.h

@@ -26,6 +26,7 @@
 #import "UIImage+animatedGIF.h"
 #import "UIImage+animatedGIF.h"
 #import "CCCertificate.h"
 #import "CCCertificate.h"
 #import "OCNetworking.h"
 #import "OCNetworking.h"
+#import "CCIntro.h"
 
 
 @protocol CCLoginDelegate <NSObject>
 @protocol CCLoginDelegate <NSObject>
 
 
@@ -33,7 +34,7 @@
 
 
 @end
 @end
 
 
-@interface CCLogin : UIViewController <UITextFieldDelegate, NSURLSessionTaskDelegate, NSURLSessionDelegate, CCCertificateDelegate, OCNetworkingDelegate>
+@interface CCLogin : UIViewController <UITextFieldDelegate, NSURLSessionTaskDelegate, NSURLSessionDelegate, CCCertificateDelegate, OCNetworkingDelegate, CCIntroDelegate>
 
 
 typedef enum {
 typedef enum {
     loginAdd = 0,
     loginAdd = 0,
@@ -52,6 +53,8 @@ typedef enum {
 @property (nonatomic, weak) IBOutlet UIButton *annulla;
 @property (nonatomic, weak) IBOutlet UIButton *annulla;
 @property (nonatomic, weak) IBOutlet UIButton *toggleVisiblePassword;
 @property (nonatomic, weak) IBOutlet UIButton *toggleVisiblePassword;
 
 
+@property (nonatomic, strong) CCIntro *intro;
+
 @property enumLoginType loginType;
 @property enumLoginType loginType;
 
 
 @end
 @end

+ 26 - 0
iOSClient/Login/CCLogin.m

@@ -83,12 +83,38 @@
         [self testUrl];
         [self testUrl];
 }
 }
 
 
+// E' apparsa
+- (void)viewDidAppear:(BOOL)animated
+{
+    [super viewDidAppear:animated];
+    
+    [self showIntro];
+}
+
 - (BOOL)textFieldShouldReturn:(UITextField *)textField
 - (BOOL)textFieldShouldReturn:(UITextField *)textField
 {
 {
     [textField resignFirstResponder];
     [textField resignFirstResponder];
     return YES;
     return YES;
 }
 }
 
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ===== Intro =====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)showIntro
+{
+    if ([CCUtility getIntro:@"1.0"] == NO) {
+        
+        _intro = [[CCIntro alloc] initWithDelegate:self delegateView:self.view];
+        [_intro showIntroCryptoCloud:2.0];
+    }
+}
+
+- (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
+{
+    [CCUtility setIntro:@"1.0"];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark == Chech Server URL ==
 #pragma mark == Chech Server URL ==
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------

+ 8 - 6
iOSClient/Main/CCSplit.m

@@ -55,6 +55,12 @@
     [self inizialize];
     [self inizialize];
 }
 }
 
 
+// Apparirà
+- (void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+}
+
 // E' apparsa
 // E' apparsa
 - (void)viewDidAppear:(BOOL)animated
 - (void)viewDidAppear:(BOOL)animated
 {
 {
@@ -70,7 +76,6 @@
     }
     }
 }
 }
 
 
-
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
 {
 {
     [coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
     [coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@@ -88,7 +93,6 @@
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
 }
 }
 
 
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== inizialization =====
 #pragma mark ===== inizialization =====
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------
@@ -99,7 +103,7 @@
     self.version = [CCUtility setVersionCryptoCloud];
     self.version = [CCUtility setVersionCryptoCloud];
     
     
     // view how to if exists
     // view how to if exists
-    [self showIntro];
+    //[self showIntro];
     
     
     // init home
     // init home
     [[NSNotificationCenter defaultCenter] postNotificationName:@"initializeMain" object:nil];
     [[NSNotificationCenter defaultCenter] postNotificationName:@"initializeMain" object:nil];
@@ -125,9 +129,7 @@
 
 
 - (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
 - (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
 {
 {
-    NSString *version = [CCUtility getVersionCryptoCloud];
-    
-    [CCUtility setIntro:version];
+    [CCUtility setIntro:[CCUtility getVersionCryptoCloud]];
 }
 }
 
 
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------

+ 3 - 3
iOSClient/Main/Main.storyboard

@@ -58,7 +58,7 @@
                         <segue destination="sOS-YU-Cbr" kind="show" identifier="CCManageOptimizationsSegue" id="JoS-OK-Poe"/>
                         <segue destination="sOS-YU-Cbr" kind="show" identifier="CCManageOptimizationsSegue" id="JoS-OK-Poe"/>
                         <segue destination="gTd-HL-PVY" kind="show" identifier="CCManageSynchronizationsSegue" id="MsD-Ag-XH5"/>
                         <segue destination="gTd-HL-PVY" kind="show" identifier="CCManageSynchronizationsSegue" id="MsD-Ag-XH5"/>
                         <segue destination="HU7-az-TgV" kind="show" identifier="CCManageHelpSegue" id="bfB-KM-85a"/>
                         <segue destination="HU7-az-TgV" kind="show" identifier="CCManageHelpSegue" id="bfB-KM-85a"/>
-                        <segue destination="Zc0-jh-3hD" kind="show" identifier="CCManagePhotosSegue" id="BZx-hA-Ydj"/>
+                        <segue destination="Zc0-jh-3hD" kind="show" identifier="CCManageCryptoCloudSegue" id="BZx-hA-Ydj"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="wVn-RD-GD2" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="wVn-RD-GD2" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -285,10 +285,10 @@
             </objects>
             </objects>
             <point key="canvasLocation" x="7213" y="3018"/>
             <point key="canvasLocation" x="7213" y="3018"/>
         </scene>
         </scene>
-        <!--Manage Photos-->
+        <!--Manage Crypto Cloud-->
         <scene sceneID="cbW-au-eCe">
         <scene sceneID="cbW-au-eCe">
             <objects>
             <objects>
-                <viewController id="Zc0-jh-3hD" customClass="CCManagePhotos" sceneMemberID="viewController">
+                <viewController id="Zc0-jh-3hD" customClass="CCManageCryptoCloud" sceneMemberID="viewController">
                     <layoutGuides>
                     <layoutGuides>
                         <viewControllerLayoutGuide type="top" id="Mj6-7r-ybC"/>
                         <viewControllerLayoutGuide type="top" id="Mj6-7r-ybC"/>
                         <viewControllerLayoutGuide type="bottom" id="qyW-zc-26J"/>
                         <viewControllerLayoutGuide type="bottom" id="qyW-zc-26J"/>

+ 6 - 1
iOSClient/Settings/CCManageCryptoCloud.h

@@ -23,7 +23,12 @@
 
 
 #import "XLFormViewController.h"
 #import "XLFormViewController.h"
 #import "XLForm.h"
 #import "XLForm.h"
+#import "BKPasscodeViewController.h"
+#import <MessageUI/MessageUI.h>
 
 
-@interface CCManageCryptoCloud : XLFormViewController
+@interface CCManageCryptoCloud : XLFormViewController <BKPasscodeViewControllerDelegate, MFMailComposeViewControllerDelegate>
+
+@property (nonatomic) NSUInteger failedAttempts;
+@property (strong, nonatomic) NSDate *lockUntilDate;
 
 
 @end
 @end

+ 94 - 1
iOSClient/Settings/CCManageCryptoCloud.m

@@ -22,8 +22,101 @@
 //
 //
 
 
 #import "CCManageCryptoCloud.h"
 #import "CCManageCryptoCloud.h"
-#import "CCUtility.h"
+#import "AppDelegate.h"
 
 
 @implementation CCManageCryptoCloud
 @implementation CCManageCryptoCloud
 
 
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+    self = [super initWithCoder:aDecoder];
+    
+    if (self) {
+        
+        [self initializeForm];
+    }
+    
+    return self;
+}
+
+- (void)initializeForm
+{
+    XLFormDescriptor *form ;
+    XLFormSectionDescriptor *section;
+    XLFormRowDescriptor *row;
+    
+    form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"Crypto Cloud", nil)];
+    
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    
+    if (!app.isCryptoCloudMode) {
+        
+        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"activate_cryptocloud" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_activation_crypto_cloud_", nil)];
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+        [row.cellConfig setObject:[UIImage imageNamed:image_settingsCryptoCloud] forKey:@"imageView.image"];
+        row.action.formSelector = @selector(activateCryptoCloud:);
+        [section addFormRow:row];
+    }
+    
+    if (app.isCryptoCloudMode) {
+        
+        // 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:COLOR_ENCRYPTED forKey:@"textLabel.textColor"];
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+        [row.cellConfig setObject:[UIImage imageNamed:image_settingsKeyMail] forKey:@"imageView.image"];
+        row.action.formSelector = @selector(checkEncryptPass:);
+        [section addFormRow:row];
+    }
+
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    
+    self.form = form;
+}
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    
+    // Color
+    [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
+    [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];    
+}
+
+// Apparirà
+- (void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+    
+    // Color
+    [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
+    [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];
+}
+
+- (void)activateCryptoCloud:(XLFormRowDescriptor *)sender
+{
+    [self deselectFormRow:sender];
+}
+
+- (void)checkEncryptPass:(XLFormRowDescriptor *)sender
+{
+    CCBKPasscode *viewController = [[CCBKPasscode alloc] initWithNibName:nil bundle:nil];
+    viewController.delegate = self;
+    viewController.fromType = CCBKPasscodeFromCheckCryptoKey;
+    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 = COLOR_ENCRYPTED;
+    
+    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
+    [self presentViewController:navigationController animated:YES completion:nil];
+}
+
 @end
 @end

+ 1 - 13
iOSClient/Settings/CCSettings.m

@@ -78,18 +78,6 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
     [section addFormRow:row];
 
 
-    if (app.isCryptoCloudMode) {
-        
-        // 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:COLOR_ENCRYPTED forKey:@"textLabel.textColor"];
-        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-        [row.cellConfig setObject:[UIImage imageNamed:image_settingsKeyMail] forKey:@"imageView.image"];
-        row.action.formSelector = @selector(checkEncryptPass:);
-        [section addFormRow:row];
-    }
-    
     // Section : CLOUD ACCOUNT --------------------------------------------------------------
     // Section : CLOUD ACCOUNT --------------------------------------------------------------
     
     
     section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_cloud_account_", nil)];
     section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_cloud_account_", nil)];
@@ -157,7 +145,7 @@
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"cryptocloud" rowType:XLFormRowDescriptorTypeButton title:@"Crypto Cloud"];
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"cryptocloud" rowType:XLFormRowDescriptorTypeButton title:@"Crypto Cloud"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [row.cellConfig setObject:[UIImage imageNamed:image_settingsCryptoCloud] forKey:@"imageView.image"];
     [row.cellConfig setObject:[UIImage imageNamed:image_settingsCryptoCloud] forKey:@"imageView.image"];
-    row.action.formSegueIdentifier = @"CCManageCryptoCloud";
+    row.action.formSegueIdentifier = @"CCManageCryptoCloudSegue";
     [section addFormRow:row];
     [section addFormRow:row];
     
     
     // Section : INFORMATION --------------------------------------------------------------
     // Section : INFORMATION --------------------------------------------------------------

+ 5 - 1
iOSClient/en.lproj/Localizable.strings

@@ -157,9 +157,13 @@
 "_upload_camera_create_subfolder_" = "Use subfolders";
 "_upload_camera_create_subfolder_" = "Use subfolders";
 "_upload_camera_create_subfolder_footer_" = "Store in subfolders based on year and month";
 "_upload_camera_create_subfolder_footer_" = "Store in subfolders based on year and month";
 
 
+// Manage Crypto Cloud
+
+"_activation_crypto_cloud_" = "Activation Crypto Cloud";
+
 // Manage Photos
 // Manage Photos
 
 
-"_change_folder_photos_" = "Change folder Photos";
+"_change_folder_photos_"    = "Change folder Photos";
 
 
 // Manage Help
 // Manage Help