Browse Source

update library web

Marino Faggiana 6 years ago
parent
commit
09cdb23720

+ 2 - 1
iOSClient/Brand/Intro/CCIntro.m

@@ -236,7 +236,8 @@
 - (void)host:(id)sender
 {
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-    SwiftModalWebVC *webVC = [[SwiftModalWebVC alloc] initWithUrlString:[NCBrandOptions sharedInstance].linkLoginHost];
+    
+    SwiftModalWebVC *webVC = [[SwiftModalWebVC alloc] initWithUrlString:[NCBrandOptions sharedInstance].linkLoginHost colorText:[UIColor blackColor] doneButtonVisible:YES hideToolbar:NO];    
     webVC.delegateWeb = self;
     
     [appDelegate.window.rootViewController presentViewController:webVC animated:YES completion:nil];

+ 10 - 51
iOSClient/Library/SwiftWebVC/SwiftModalWebVC.swift

@@ -20,33 +20,14 @@ public class SwiftModalWebVC: UINavigationController {
     
     @objc public weak var delegateWeb: SwiftModalWebVCDelegate?
     
-    public enum SwiftModalWebVCTheme {
-        case lightBlue, lightBlack, dark, custom
-    }
-    
     weak var webViewDelegate: UIWebViewDelegate? = nil
     
-    @objc public convenience init(urlString: String) {
-        self.init(pageURL: URL(string: urlString)!, theme: .dark, color: UIColor.clear, colorText: UIColor.black, doneButtonVisible: true, hideToolbar: false)
-    }
-    
-    public convenience init(urlString: String, theme: SwiftModalWebVCTheme) {
-        self.init(pageURL: URL(string: urlString)!, theme: theme)
-    }
-    
-    public convenience init(urlString: String, theme: SwiftModalWebVCTheme, color: UIColor, colorText: UIColor, doneButtonVisible: Bool, hideToolbar: Bool = false) {
-        self.init(pageURL: URL(string: urlString)!, theme: theme, color: color, colorText: colorText, doneButtonVisible: doneButtonVisible, hideToolbar: hideToolbar)
+    @objc public convenience init(urlString: String, colorText: UIColor, doneButtonVisible: Bool, hideToolbar: Bool = false) {
+        let url = URL(string: urlString)!
+        self.init(request: URLRequest(url: url), colorText: colorText, doneButtonVisible: doneButtonVisible, hideToolbar: hideToolbar)
     }
     
-    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, doneButtonVisible: Bool = false, hideToolbar: Bool = false) {
-        self.init(request: URLRequest(url: pageURL), theme: theme, color: color, colorText: colorText, doneButtonVisible: doneButtonVisible, hideToolbar: hideToolbar)
-    }
-   
-    public init(request: URLRequest, theme: SwiftModalWebVCTheme = .dark, color: UIColor = UIColor.clear, colorText: UIColor = UIColor.black, doneButtonVisible: Bool = false, hideToolbar: Bool = false) {
+    public init(request: URLRequest, colorText: UIColor = UIColor.black, doneButtonVisible: Bool = false, hideToolbar: Bool = false) {
         
         let webViewController = SwiftWebVC(aRequest: request, hideToolbar: hideToolbar)
         webViewController.storedStatusColor = UINavigationBar.appearance().barStyle
@@ -55,34 +36,12 @@ public class SwiftModalWebVC: UINavigationController {
 
         let doneButton = UIBarButtonItem(image: SwiftWebVC.bundledImage(named: "SwiftWebVCDismiss"), style: UIBarButtonItem.Style.plain, target: webViewController, action: #selector(SwiftWebVC.doneButtonTapped))
     
-        switch theme {
-        case .lightBlue:
-            doneButton.tintColor = nil
-            webViewController.buttonColor = nil
-            webViewController.titleColor = UIColor.black
-            UINavigationBar.appearance().barStyle = UIBarStyle.default
-        case .lightBlack:
-            doneButton.tintColor = UIColor.darkGray
-            webViewController.buttonColor = UIColor.darkGray
-            webViewController.titleColor = UIColor.black
-            UINavigationBar.appearance().barStyle = UIBarStyle.default
-        case .dark:
-            doneButton.tintColor = UIColor.black
-            webViewController.buttonColor = UIColor.white
-            webViewController.titleColor = UIColor.black// groupTableViewBackground
-            UINavigationBar.appearance().barStyle = UIBarStyle.black
-        case .custom:
-            doneButton.tintColor = colorText
-            webViewController.buttonColor = colorText
-            webViewController.titleColor = colorText
-            webViewController.view.backgroundColor = color
-
-            self.navigationBar.isTranslucent = false
-            UINavigationBar.appearance().barTintColor = color
-            
-            self.toolbar.isTranslucent = false
-            self.toolbar.barTintColor = color
-        }
+        doneButton.tintColor = colorText
+        webViewController.buttonColor = colorText
+        webViewController.titleColor = colorText
+        webViewController.view.backgroundColor = UIColor.clear
+        
+        UINavigationBar.appearance().barStyle = UIBarStyle.default
         
         if (doneButtonVisible == true) {
             if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad) {

+ 1 - 1
iOSClient/Login/CCLoginWeb.swift

@@ -52,7 +52,7 @@ public class CCLoginWeb: UIViewController {
             urlString =  urlBase+k_flowEndpoint
         }
         
-        let webVC = SwiftModalWebVC(urlString: urlString, theme: .custom, color: NCBrandColor.sharedInstance.customer, colorText: NCBrandColor.sharedInstance.customerText, doneButtonVisible: doneButtonVisible, hideToolbar: true)
+        let webVC = SwiftModalWebVC(urlString: urlString, colorText: NCBrandColor.sharedInstance.nextcloud, doneButtonVisible: doneButtonVisible, hideToolbar: true)
         webVC.delegateWeb = self
 
         vc.present(webVC, animated: false, completion: nil)

+ 2 - 2
iOSClient/Main/CCMore.swift

@@ -408,7 +408,7 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
                 
             } else {
                 
-                let webVC = SwiftModalWebVC(urlString: item.url, theme: .dark, color: UIColor.clear, colorText: UIColor.black, doneButtonVisible: true)
+                let webVC = SwiftModalWebVC(urlString: item.url, colorText: UIColor.white, doneButtonVisible: true)
                 webVC.delegateWeb = self
                 self.present(webVC, animated: true, completion: nil)
             }
@@ -450,7 +450,7 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
                 
             } else {
                 
-                let webVC = SwiftModalWebVC(urlString: item.url)
+                let webVC = SwiftModalWebVC(urlString: item.url, colorText: UIColor.black, doneButtonVisible: true, hideToolbar: false)
                 webVC.delegateWeb = self
                 self.present(webVC, animated: true, completion: nil)
             }