Marino Faggiana 6 жил өмнө
parent
commit
9c92c296fd

+ 38 - 12
iOSClient/Brand/Intro/CCIntro.m

@@ -64,18 +64,6 @@
 {
 }
 
-- (void)login:(id)sender
-{
-    selector = k_intro_login;
-    [self.intro hideWithFadeOutDuration:0.7];
-}
-
-- (void)signUp:(id)sender
-{
-    selector = k_intro_signup;
-    [self.intro hideWithFadeOutDuration:0.7];
-}
-
 - (void)show
 {
     [self showIntro];
@@ -229,4 +217,42 @@
     [self.intro showInView:self.rootView animateDuration:0];
 }
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ===== Action =====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)login:(id)sender
+{
+    selector = k_intro_login;
+    [self.intro hideWithFadeOutDuration:0.7];
+}
+
+- (void)signUp:(id)sender
+{
+    selector = k_intro_signup;
+    [self.intro hideWithFadeOutDuration:0.7];
+}
+
+- (void)host:(id)sender
+{
+    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    
+    SwiftModalWebVC *webVC = [[SwiftModalWebVC alloc] initWithUrlString:[NCBrandOptions sharedInstance].linkLoginHost colorText:[UIColor whiteColor] colorDoneButton:[UIColor blackColor] doneButtonVisible:YES hideToolbar:NO useRedirectCookieHandling:false];
+    webVC.delegateWeb = self;
+    
+    [appDelegate.window.rootViewController presentViewController:webVC animated:YES completion:nil];
+}
+- (void)didStartLoading
+{
+}
+- (void)didReceiveServerRedirectForProvisionalNavigationWithUrl:(NSURL *)url
+{
+}
+- (void)didFinishLoadingWithSuccess:(BOOL)success url:(NSURL *)url
+{
+}
+- (void)webDismiss
+{
+}
+
 @end

+ 6 - 0
iOSClient/Library/SwiftWebVC/WKCookieWebView.swift

@@ -41,6 +41,12 @@ class WKCookieWebView : WKWebView {
     }
 
     override func load(_ request: URLRequest) -> WKNavigation? {
+        
+        var request = request
+        let language = NSLocale.preferredLanguages[0] as String
+
+        request.setValue(CCUtility.getUserAgent(), forHTTPHeaderField: "User-Agent")
+
         guard useRedirectCookieHandling else {
             return super.load(request)
         }

+ 1 - 0
iOSClient/Login/CCLogin.m

@@ -127,6 +127,7 @@
         _user.hidden = YES;
         _imagePassword.hidden = YES;
         _password.hidden = YES;
+        _annulla.hidden = YES;
     }
     
     if (_loginType == k_login_Modify_Password) {

+ 6 - 1
iOSClient/Login/CCLoginWeb.swift

@@ -34,6 +34,7 @@ public class CCLoginWeb: UIViewController {
     @objc var loginType: NSInteger = Int(k_login_Add)
     @objc var urlBase = ""
     
+    var doneButtonVisible: Bool = true
     var viewController: UIViewController?
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     
@@ -42,12 +43,16 @@ public class CCLoginWeb: UIViewController {
         var urlString = urlBase
         self.viewController = vc
         
+        if loginType == k_login_Add_Forced {
+            doneButtonVisible = false
+        }
+        
         // ADD k_flowEndpoint for Web Flow
         if (NCBrandOptions.sharedInstance.use_login_web_personalized == false && urlBase != NCBrandOptions.sharedInstance.linkloginPreferredProviders) {
             urlString =  urlBase+k_flowEndpoint
         }
         
-        let webVC = SwiftModalWebVC(urlString: urlString, colorText: UIColor.black, colorDoneButton: UIColor.black, doneButtonVisible: true, hideToolbar: true, useRedirectCookieHandling: true)
+        let webVC = SwiftModalWebVC(urlString: urlString, colorText: UIColor.black, colorDoneButton: UIColor.black, doneButtonVisible: doneButtonVisible, hideToolbar: true, useRedirectCookieHandling: true)
         webVC.delegateWeb = self
 
         vc.present(webVC, animated: false, completion: nil)

+ 4 - 4
iOSClient/Main/CCSplit.m

@@ -133,7 +133,7 @@
         
         [CCUtility setIntro:YES];
         if (appDelegate.activeAccount.length == 0) {
-            [appDelegate openLoginView:self loginType:k_login_Add_Forced selector:k_intro_login];
+            [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
         }
     
     } else {
@@ -145,7 +145,7 @@
         
         } else {
             if (appDelegate.activeAccount.length == 0) {
-                [appDelegate openLoginView:self loginType:k_login_Add_Forced selector:k_intro_login];
+                [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
             }
         }
     }
@@ -159,7 +159,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 loginType:k_login_Add_Forced selector:k_intro_login];
+                        [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
                     }
                 });
             }
@@ -167,7 +167,7 @@
             
         case k_intro_signup:
             {
-                [appDelegate openLoginView:self loginType:k_login_Add_Forced selector:k_intro_signup];
+                [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_signup];
             }
             break;
     }