Browse Source

new Intro - Login system

Marino Faggiana 8 năm trước cách đây
mục cha
commit
3344659b5e

+ 1 - 0
iOSClient/Intro/CCIntro.h

@@ -41,6 +41,7 @@
 
 @protocol CCIntroDelegate <NSObject>
 
+@optional - (void)introWillFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped;
 @optional - (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped;
 
 @end

+ 6 - 0
iOSClient/Intro/CCIntro.m

@@ -45,6 +45,12 @@
     return self;
 }
 
+- (void)introWillFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
+{
+    if (self.delegate && [self.delegate respondsToSelector:@selector(introWillFinish:wasSkipped:)])
+        [self.delegate introWillFinish:introView wasSkipped:wasSkipped];
+}
+
 - (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
 {
     if (self.delegate && [self.delegate respondsToSelector:@selector(introDidFinish:wasSkipped:)])

+ 1 - 4
iOSClient/Login/CCLogin.h

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

+ 0 - 26
iOSClient/Login/CCLogin.m

@@ -116,8 +116,6 @@
 - (void)viewDidAppear:(BOOL)animated
 {
     [super viewDidAppear:animated];
-    
-    [self showIntro];
 }
 
 - (BOOL)textFieldShouldReturn:(UITextField *)textField
@@ -145,30 +143,6 @@
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
 }
 
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Intro =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)showIntro
-{
-    
-#ifdef OPTION_DISABLE_INTRO
-    [CCUtility setIntro:@"1.0"];
-#endif
-    
-    if ([CCUtility getIntro:@"1.0"] == NO) {
-        
-        _intro = [[CCIntro alloc] initWithDelegate:self delegateView:self.view];
-        [_intro showIntroCryptoCloud:0.0];
-    }
-}
-
-- (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
-{
-    [CCUtility setIntro:@"1.0"];
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark == Chech Server URL ==
 #pragma --------------------------------------------------------------------------------------------

+ 3 - 1
iOSClient/Main/CCSplit.h

@@ -25,9 +25,11 @@
 
 #import "CCLogin.h"
 #import "CCDetail.h"
+#import "CCIntro.h"
 
-@interface CCSplit : UISplitViewController <UISplitViewControllerDelegate, CCLoginDelegate>
+@interface CCSplit : UISplitViewController <UISplitViewControllerDelegate, CCLoginDelegate, CCIntroDelegate>
 
 @property (nonatomic, strong) NSString *version;
+@property (nonatomic, strong) CCIntro *intro;
 
 @end

+ 30 - 8
iOSClient/Main/CCSplit.m

@@ -59,14 +59,8 @@
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
-}
-
-// E' apparsa
-- (void)viewDidAppear:(BOOL)animated
-{
-    [super viewDidAppear:animated];
     
-    [self newAccount];
+    [self showIntro];
 }
 
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
@@ -99,6 +93,35 @@
     [[NSNotificationCenter defaultCenter] postNotificationName:@"initializeMain" object:nil];
 }
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ===== Intro =====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)showIntro
+{
+    
+#ifdef OPTION_DISABLE_INTRO
+    [CCUtility setIntro:@"1.0"];
+    [self newAccount];
+#endif
+    
+    if ([CCUtility getIntro:@"1.0"] == NO) {
+        
+        _intro = [[CCIntro alloc] initWithDelegate:self delegateView:self.view];
+        [_intro showIntroCryptoCloud:0.0];
+        
+    } else {
+        
+        [self newAccount];
+    }
+}
+
+- (void)introWillFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
+{
+    [CCUtility setIntro:@"1.0"];
+    [self newAccount];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== newAccount =====
 #pragma --------------------------------------------------------------------------------------------
@@ -110,7 +133,6 @@
 
 - (void)newAccount
 {
-    // test
     if (app.activeAccount.length == 0) {
     
         CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];