فهرست منبع

Modify LoginWeb for modify password

Marino Faggiana 8 سال پیش
والد
کامیت
a8f6000f92
4فایلهای تغییر یافته به همراه28 افزوده شده و 18 حذف شده
  1. 6 7
      iOSClient/Library/SwiftWebVC/SwiftModalWebVC.swift
  2. 7 1
      iOSClient/Login/CCLoginWeb.swift
  3. 15 7
      iOSClient/Main/CCMain.m
  4. 0 3
      iOSClient/Main/CCSplit.m

+ 6 - 7
iOSClient/Library/SwiftWebVC/SwiftModalWebVC.swift

@@ -17,7 +17,6 @@ public protocol SwiftModalWebVCDelegate: class {
 public class SwiftModalWebVC: UINavigationController {
     
     public weak var delegateWeb: SwiftModalWebVCDelegate?
-    var doneButtonHide: Bool! = true
     
     public enum SwiftModalWebVCTheme {
         case lightBlue, lightBlack, dark, custom
@@ -33,19 +32,19 @@ public class SwiftModalWebVC: UINavigationController {
         self.init(pageURL: URL(string: urlString)!, theme: theme)
     }
     
-    public convenience init(urlString: String, theme: SwiftModalWebVCTheme, color: UIColor, colorText: UIColor) {
-        self.init(pageURL: URL(string: urlString)!, theme: theme, color: color, colorText: colorText)
+    public convenience init(urlString: String, theme: SwiftModalWebVCTheme, color: UIColor, colorText: UIColor, doneButtonVisible: Bool) {
+        self.init(pageURL: URL(string: urlString)!, theme: theme, color: color, colorText: colorText, doneButtonVisible: doneButtonVisible)
     }
     
     public convenience init(pageURL: URL) {
         self.init(request: URLRequest(url: pageURL))
     }
     
-    public convenience init(pageURL: URL, theme: SwiftModalWebVCTheme, color : UIColor = UIColor.clear, colorText: UIColor = UIColor.black) {
-        self.init(request: URLRequest(url: pageURL), theme: theme, color: color, colorText: colorText)
+    public convenience init(pageURL: URL, theme: SwiftModalWebVCTheme, color : UIColor = UIColor.clear, colorText: UIColor = UIColor.black, doneButtonVisible: Bool = false) {
+        self.init(request: URLRequest(url: pageURL), theme: theme, color: color, colorText: colorText, doneButtonVisible: doneButtonVisible)
     }
    
-    public init(request: URLRequest, theme: SwiftModalWebVCTheme = .dark, color: UIColor = UIColor.clear, colorText: UIColor = UIColor.black) {
+    public init(request: URLRequest, theme: SwiftModalWebVCTheme = .dark, color: UIColor = UIColor.clear, colorText: UIColor = UIColor.black, doneButtonVisible: Bool = false) {
         
         let webViewController = SwiftWebVC(aRequest: request)
         webViewController.storedStatusColor = UINavigationBar.appearance().barStyle
@@ -85,7 +84,7 @@ public class SwiftModalWebVC: UINavigationController {
             self.toolbar.barTintColor = color
         }
         
-        if (doneButtonHide == false) {
+        if (doneButtonVisible == true) {
             if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad) {
                 webViewController.navigationItem.leftBarButtonItem = doneButton
             }

+ 7 - 1
iOSClient/Login/CCLoginWeb.swift

@@ -25,13 +25,19 @@ public class CCLoginWeb: UIViewController {
     var viewController : UIViewController?
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     var loginType = loginAdd
+    var doneButtonVisible: Bool = false
     
     func presentModalWithDefaultTheme(_ vc: UIViewController) {
         
         self.viewController = vc
         
-        let webVC = SwiftModalWebVC(urlString: k_loginBaseUrl, theme: .custom, color: Constant.GlobalConstants.k_Color_NavigationBar, colorText: Constant.GlobalConstants.k_Color_NavigationBar_Text)
+        if (loginType == loginAdd || loginType == loginModifyPasswordUser) {
+            doneButtonVisible = true
+        }
+        
+        let webVC = SwiftModalWebVC(urlString: k_loginBaseUrl, theme: .custom, color: Constant.GlobalConstants.k_Color_NavigationBar, colorText: Constant.GlobalConstants.k_Color_NavigationBar_Text, doneButtonVisible: doneButtonVisible)
         webVC.delegateWeb = self
+
         vc.present(webVC, animated: false, completion: nil)
     }
 }

+ 15 - 7
iOSClient/Main/CCMain.m

@@ -90,6 +90,10 @@
     NSString *_searchFileName;
     NSMutableArray *_searchResultMetadatas;
     NSString *_depth;
+    
+    // Login
+    CCLoginWeb *_loginWeb;
+    CCLogin *_loginVC;
 }
 @end
 
@@ -984,12 +988,19 @@
 - (void)changePasswordAccount
 {
 #ifdef LOGIN_WEB
+    _loginWeb = [CCLoginWeb new];
+    _loginWeb.delegate = self;
+    _loginWeb.loginType = loginModifyPasswordUser;
+    
+    dispatch_async(dispatch_get_main_queue(), ^ {
+        [_loginWeb presentModalWithDefaultTheme:self];
+    });
 #else
-    CCLogin *loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
-    loginVC.delegate = self;
-    loginVC.loginType = loginModifyPasswordUser;
+    _loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
+    _loginVC.delegate = self;
+    _loginVC.loginType = loginModifyPasswordUser;
     
-    [self presentViewController:loginVC animated:YES completion:nil];
+    [self presentViewController:_loginVC animated:YES completion:nil];
 #endif
 }
 
@@ -5066,9 +5077,6 @@
     // è una directory
     if (metadata.directory) {
         
-        NSString *directoryServerUrl = [CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileNameData];
-
-        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
         cell.labelInfoFile.text = [CCUtility dateDiff:metadata.date];
         
         lunghezzaFile = @" ";

+ 0 - 3
iOSClient/Main/CCSplit.m

@@ -156,16 +156,13 @@
         _loginWeb.loginType = loginAddForced;
         
         [_loginWeb presentModalWithDefaultTheme:self];
-        
 #else
         _loginVC = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
         _loginVC.delegate = self;
         _loginVC.loginType = loginAddForced;
         
         [self presentViewController:_loginVC animated:YES completion:nil];
-
 #endif
-    
     }
 }