From 2c218aaf9af95414a4d523fd282f50a28a344c82 Mon Sep 17 00:00:00 2001 From: ccr Date: Tue, 25 Dec 2018 11:34:50 +0545 Subject: [PATCH] wkwebview opened --- .../WkWebView/WkWebViewController.swift | 19 ++++++++++--------- .../View/AutoDebitViewController.swift | 15 +++++++++++++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift b/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift index 2a98b032..d37780c3 100644 --- a/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift +++ b/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift @@ -17,7 +17,7 @@ class WkWebViewController: UIViewController, WKUIDelegate { override func loadView() { let webConfiguration = WKWebViewConfiguration() - webView = WKWebView(frame: .zero, configuration: webConfiguration) + webView = WKWebView() webView.uiDelegate = self view = webView } @@ -28,13 +28,14 @@ class WkWebViewController: UIViewController, WKUIDelegate { - if let myURL = URL(string: self.url ?? "") { - var myRequest = URLRequest(url: myURL) - - headers.forEach({ - myRequest.setValue($0.key ?? "", forHTTPHeaderField: $0.value ?? "") - }) - +// if let myURL = URL(string: self.url ?? "") { +// var myRequest = URLRequest(url: myURL) +// +// headers.forEach({ +// myRequest.setValue($0.key ?? "", forHTTPHeaderField: $0.value ?? "") +// }) + let url = URL.init(string: "https://www.apple.com") + let myRequest = URLRequest.init(url: url!) webView.load(myRequest) } - }} + } diff --git a/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift b/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift index db359dac..663de081 100644 --- a/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift +++ b/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift @@ -41,8 +41,14 @@ class AutoDebitViewController: UIViewController { var url: String? var selectedLanguage: KftcLanguage? { didSet { - print(selectedLanguage) - let url = URL.init(string: "") + self.url = "oauth/2.0/authorize2?response_type=code&client_id=&redirect_uri=http://localhost:4948/Dashboard/AutoDebit&scope=login+inquiry+transfer&client_info=GME+CLIENT+INFORMATION&auth_type=1&bg_color=%23F4F8FB&txt_color=%23000000&btn1_color=%23EF343B&btn2_color=%2322246B&lang=&edit_option=off&invoke_type=ajax" + if var url = self.url { + let string = "&lang=\(selectedLanguage?.key ?? "")" + url.append(string) + openWkWebViewWith(url: url) + } + + } } @@ -68,6 +74,11 @@ class AutoDebitViewController: UIViewController { self.navigationItem.title = "" } + private func openWkWebViewWith(url: String) { + let viewcontroller = UIStoryboard.init(name: "WKWebView", bundle: nil).instantiateViewController(withIdentifier: "WkWebViewController") as! WkWebViewController + self.present(viewcontroller, animated: true, completion: nil) + } + // MARK:- IBAction @IBAction func loadMoreAction(_ sender: Any) {