marinofaggiana 5 năm trước cách đây
mục cha
commit
9476c88f54

+ 1 - 1
iOSClient/AppDelegate.h

@@ -143,7 +143,7 @@
 - (void)startTimerErrorNetworking;
 
 // Login View
-- (void)openLoginView:(UIViewController *)viewController delegate:(id)delegate loginType:(NSInteger)loginType selector:(NSInteger)selector;
+- (void)openLoginView:(UIViewController *)viewController selector:(NSInteger)selector;
 
 // Setting Account
 - (void)settingActiveAccount:(NSString *)activeAccount activeUrl:(NSString *)activeUrl activeUser:(NSString *)activeUser activeUserID:(NSString *)activeUserID activePassword:(NSString *)activePassword;

+ 3 - 7
iOSClient/AppDelegate.m

@@ -269,7 +269,7 @@ PKPushRegistry *pushRegistry;
     
     // check unauthorized server (401)
     if ([CCUtility getPassword:self.activeAccount].length == 0) {
-        [self openLoginView:self.window.rootViewController delegate:self loginType:k_login_Add selector:k_intro_login];
+        [self openLoginView:self.window.rootViewController selector:k_intro_login];
     }
     
     // check certificate untrusted (-1202)
@@ -278,7 +278,7 @@ PKPushRegistry *pushRegistry;
     }
 }
 
-- (void)openLoginView:(UIViewController *)viewController delegate:(id)delegate loginType:(NSInteger)loginType selector:(NSInteger)selector
+- (void)openLoginView:(UIViewController *)viewController selector:(NSInteger)selector
 {
     @synchronized (self) {
 
@@ -305,7 +305,6 @@ PKPushRegistry *pushRegistry;
                 self.activeLoginWeb = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"NCLoginWeb"];
                 
                 self.activeLoginWeb.urlBase = [[NCBrandOptions sharedInstance] loginBaseUrl];
-                self.activeLoginWeb.loginType = loginType;
 
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
                     [viewController presentViewController:self.activeLoginWeb animated:YES completion:nil];
@@ -327,7 +326,6 @@ PKPushRegistry *pushRegistry;
                 } else {
                     self.activeLoginWeb.urlBase = self.activeUrl;
                 }
-                self.activeLoginWeb.loginType = loginType;
                 
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
                     [viewController presentViewController:self.activeLoginWeb animated:YES completion:nil];
@@ -339,7 +337,6 @@ PKPushRegistry *pushRegistry;
             self.activeLoginWeb = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"NCLoginWeb"];
             
             self.activeLoginWeb.urlBase = [[NCBrandOptions sharedInstance] loginBaseUrl];
-            self.activeLoginWeb.loginType = loginType;
             
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
                 [viewController presentViewController:self.activeLoginWeb animated:YES completion:nil];
@@ -350,7 +347,6 @@ PKPushRegistry *pushRegistry;
             if (!(_activeLogin.isViewLoaded && _activeLogin.view.window)) {
                 
                 _activeLogin = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
-                _activeLogin.loginType = loginType;
                 
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
                     [viewController presentViewController:_activeLogin animated:YES completion:nil];
@@ -407,7 +403,7 @@ PKPushRegistry *pushRegistry;
             [self settingActiveAccount:newAccount activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:[CCUtility getPassword:tableAccount.account]];
             [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
         } else {
-            [self openLoginView:self.window.rootViewController delegate:self loginType:k_login_Add_Forced selector:k_intro_login];
+            [self openLoginView:self.window.rootViewController selector:k_intro_login];
         }
     }
 }

+ 0 - 4
iOSClient/Brand/NCBrand.swift

@@ -134,10 +134,6 @@ class NCBrandColor: NSObject {
         if folderBrandAutoUpload != "" {
             folderDefaultAutoUpload = folderBrandAutoUpload
         }
-        
-        if use_configuration {
-            disable_intro = true
-        }
     }
 }
 

+ 0 - 2
iOSClient/Login/CCLogin.h

@@ -51,6 +51,4 @@
 
 @property (nonatomic, weak) IBOutlet UIButton *qrCode;
 
-@property NSInteger loginType;
-
 @end

+ 5 - 7
iOSClient/Login/CCLogin.m

@@ -103,20 +103,19 @@
         _imageBaseUrl.hidden = YES;
         _baseUrl.hidden = YES;
     }
-
-    if (_loginType == k_login_Add ) {
+    
+    NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
+    if ([listAccount count] == 0) {
         _imageUser.hidden = YES;
         _user.hidden = YES;
         _imagePassword.hidden = YES;
         _password.hidden = YES;
-    }
-    
-    if (_loginType == k_login_Add_Forced) {
+        _annulla.hidden = YES;
+    } else {
         _imageUser.hidden = YES;
         _user.hidden = YES;
         _imagePassword.hidden = YES;
         _password.hidden = YES;
-        _annulla.hidden = YES;
     }
 }
 
@@ -184,7 +183,6 @@
                 appDelegate.activeLoginWeb = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"NCLoginWeb"];
                 appDelegate.activeLoginWeb.delegate = self;
                 appDelegate.activeLoginWeb.urlBase = self.baseUrl.text;
-                appDelegate.activeLoginWeb.loginType = _loginType;
                 
                 [self presentViewController:appDelegate.activeLoginWeb animated:YES completion:nil];
             }

+ 2 - 2
iOSClient/Login/NCLoginWeb.swift

@@ -33,7 +33,6 @@ class NCLoginWeb: UIViewController {
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
     @objc var urlBase = ""
-    @objc var loginType: Int = 0
     @objc weak var delegate: NCLoginWebDelegate?
 
     @IBOutlet weak var buttonExit: UIButton!
@@ -59,7 +58,8 @@ class NCLoginWeb: UIViewController {
         }
         
         // button exit
-        if loginType == k_login_Add_Forced {
+        let listAccount = NCManageDatabase.sharedInstance.getAccounts()
+        if listAccount?.count == 0 {
             buttonExit.isHidden = true
         } else {
             self.view.bringSubviewToFront(buttonExit)

+ 1 - 1
iOSClient/Main/CCMain.m

@@ -2075,7 +2075,7 @@
 
 - (void)addNewAccount:(CCMenuItem *)sender
 {
-    [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
+    [appDelegate openLoginView:self selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 1 - 1
iOSClient/Main/CCMore.swift

@@ -436,7 +436,7 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
                 let manageAccount = CCManageAccount()
                 manageAccount.delete(self.appDelegate.activeAccount)
                 
-                self.appDelegate.openLoginView(self, delegate: self, loginType: Int(k_login_Add_Forced), selector: Int(k_intro_login)) 
+                self.appDelegate.openLoginView(self, selector: Int(k_intro_login)) 
             }
             
             let actionNo = UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (action:UIAlertAction) in

+ 5 - 6
iOSClient/Main/CCSplit.m

@@ -134,9 +134,8 @@
     if ([NCBrandOptions sharedInstance].disable_intro) {
         
         [CCUtility setIntro:YES];
-        if (appDelegate.activeAccount.length == 0) {
-            [appDelegate openLoginView:self delegate:self loginType:k_login_Add_Forced selector:k_intro_login];
-        }
+        [appDelegate openLoginView:self selector:k_intro_login];
+        
     
     } else {
     
@@ -147,7 +146,7 @@
         
         } else {
             if (appDelegate.activeAccount.length == 0) {
-                [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
+                [appDelegate openLoginView:self selector:k_intro_login];
             }
         }
     }
@@ -161,7 +160,7 @@
             {
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
                     if (appDelegate.activeAccount.length == 0) {
-                        [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
+                        [appDelegate openLoginView:self selector:k_intro_login];
                     }
                 });
             }
@@ -169,7 +168,7 @@
             
         case k_intro_signup:
             {
-                [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_signup];
+                [appDelegate openLoginView:self selector:k_intro_signup];
             }
             break;
     }

+ 3 - 3
iOSClient/Settings/CCManageAccount.m

@@ -338,7 +338,7 @@
     
     // Open Login
     if (listAccount.count == 0) {
-        [appDelegate openLoginView:self delegate:self loginType:k_login_Add_Forced selector:k_intro_login];
+        [appDelegate openLoginView:self selector:k_intro_login];
     }
 }
 
@@ -396,7 +396,7 @@
 {
     [self deselectFormRow:sender];
     
-    [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
+    [appDelegate openLoginView:self selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -407,7 +407,7 @@
 {    
     [self deselectFormRow:sender];
     
-    [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
+    [appDelegate openLoginView:self selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------