Marino Faggiana 8 жил өмнө
parent
commit
9de05df7df

+ 2 - 2
iOSClient/Login/CCLoginWeb.swift

@@ -8,13 +8,13 @@
 
 import UIKit
 
-@objc protocol CCLoginWebDelegate: class {
+@objc protocol CCLoginDelegate: class {
     func loginSuccess(_: NSInteger)
 }
 
 public class CCLoginWeb: UIViewController {
 
-    weak var delegate: CCLoginWebDelegate?
+    weak var delegate: CCLoginDelegate?
     
     var viewController : UIViewController?
     let appDelegate = UIApplication.shared.delegate as! AppDelegate

+ 3 - 0
iOSClient/Main/CCMain.m

@@ -990,11 +990,14 @@
 
 - (void)changePasswordAccount
 {
+#ifdef LOGIN_WEB
+#else
     CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
     loginVC.delegate = self;
     loginVC.loginType = loginModifyPasswordUser;
     
     [self presentViewController:loginVC animated:YES completion:nil];
+#endif
 }
 
 #pragma mark -

+ 1 - 1
iOSClient/Main/CCSplit.m

@@ -31,7 +31,7 @@
     #import "Nextcloud-Swift.h"
 #endif
 
-@interface CCSplit () <CCLoginWebDelegate>
+@interface CCSplit ()
 {
     CCLoginWeb *_loginWeb;
     CCLogin *_loginVC;

+ 59 - 13
iOSClient/Settings/CCManageAccount.m

@@ -25,8 +25,22 @@
 #import "AppDelegate.h"
 #import "CCLogin.h"
 
+#ifdef CUSTOM_BUILD
+#import "CustomSwift.h"
+#else
+#import "Nextcloud-Swift.h"
+#endif
+
 #define actionSheetCancellaAccount 1
 
+@interface CCManageAccount ()
+{
+    CCLoginWeb *_loginWeb;
+    CCLogin *_loginVC;
+}
+@end
+
+
 @implementation CCManageAccount
 
 -  (id)initWithCoder:(NSCoder *)aDecoder
@@ -148,22 +162,42 @@
     [app cancelAllOperations];
     [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
     
-    CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
-    loginVC.delegate = self;
-    loginVC.loginType = loginAdd;
+#ifdef LOGIN_WEB
     
-    [self presentViewController:loginVC animated:YES completion:nil];
+    _loginWeb = [CCLoginWeb new];
+    _loginWeb.delegate = self;
+    
+    [_loginWeb presentModalWithDefaultTheme:self];
+    
+#else
+    _loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
+    _loginVC.delegate = self;
+    _loginVC.loginType = loginAdd;
+    
+    [self presentViewController:_loginVC animated:YES completion:nil];
+    
+#endif
 }
 
 - (void)addAccountFoced
 {
-    CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
-    loginVC.delegate = self;
-    loginVC.loginType = loginAddForced;
+#ifdef LOGIN_WEB
+    
+    _loginWeb = [CCLoginWeb new];
+    _loginWeb.delegate = self;
     
     dispatch_async(dispatch_get_main_queue(), ^ {
-        [self presentViewController:loginVC animated:YES completion:nil];
+        [_loginWeb presentModalWithDefaultTheme:self];
     });
+#else
+    _loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
+    _loginVC.delegate = self;
+    _loginVC.loginType = loginAddForced;
+    
+    dispatch_async(dispatch_get_main_queue(), ^ {
+        [self presentViewController:_loginVC animated:YES completion:nil];
+    });
+#endif
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -177,11 +211,23 @@
     [app cancelAllOperations];
     [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
     
-    CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier: @"CCLoginNextcloud"];
-    loginVC.delegate = self;
-    loginVC.loginType = loginModifyPasswordUser;
-        
-    [self presentViewController:loginVC animated:YES completion:nil];
+#ifdef LOGIN_WEB
+    
+    _loginWeb = [CCLoginWeb new];
+    _loginWeb.delegate = self;
+    
+    dispatch_async(dispatch_get_main_queue(), ^ {
+        [_loginWeb presentModalWithDefaultTheme:self];
+    });
+#else
+    _loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
+    _loginVC.delegate = self;
+    _loginVC.loginType = loginModifyPasswordUser;
+    
+    dispatch_async(dispatch_get_main_queue(), ^ {
+        [self presentViewController:_loginVC animated:YES completion:nil];
+    });
+#endif
     
     [self UpdateForm];
 }