|
@@ -40,6 +40,19 @@ public class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScroll
|
|
public override func viewDidLoad() {
|
|
public override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
super.viewDidLoad()
|
|
|
|
|
|
|
|
+ title = "Secure Browser".localized()
|
|
|
|
+
|
|
|
|
+ let attributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
|
|
|
|
+ let navBarAppearance = UINavigationBarAppearance()
|
|
|
|
+ navBarAppearance.configureWithOpaqueBackground()
|
|
|
|
+ navBarAppearance.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : UIColor.mainColor
|
|
|
|
+ navBarAppearance.titleTextAttributes = attributes
|
|
|
|
+ navigationController?.navigationBar.standardAppearance = navBarAppearance
|
|
|
|
+ navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
|
|
|
|
+
|
|
|
|
+ let backButton = UIBarButtonItem(image: UIImage(systemName: "chevron.backward"), style: .plain, target: self, action: #selector(self.didTapExit))
|
|
|
|
+ self.navigationItem.leftBarButtonItem = backButton
|
|
|
|
+
|
|
let configuration = WKWebViewConfiguration()
|
|
let configuration = WKWebViewConfiguration()
|
|
configuration.allowsInlineMediaPlayback = true
|
|
configuration.allowsInlineMediaPlayback = true
|
|
loadContentBlocker(into: configuration) { [self] in
|
|
loadContentBlocker(into: configuration) { [self] in
|
|
@@ -49,6 +62,10 @@ public class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScroll
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func didTapExit(sender: Any) {
|
|
|
|
+ self.dismiss(animated: true, completion: nil)
|
|
|
|
+ }
|
|
|
|
+
|
|
func initializeWebView(with configuration: WKWebViewConfiguration) {
|
|
func initializeWebView(with configuration: WKWebViewConfiguration) {
|
|
let customUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Mobile/15E148 Safari/604.1 \(Utils.getUserAgent())"
|
|
let customUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Mobile/15E148 Safari/604.1 \(Utils.getUserAgent())"
|
|
let finalUserAgent = "\(customUserAgent)"
|
|
let finalUserAgent = "\(customUserAgent)"
|
|
@@ -167,6 +184,10 @@ public class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScroll
|
|
if let url = URL(string: "\(stringQMS)") {
|
|
if let url = URL(string: "\(stringQMS)") {
|
|
if !isSecureBrowser {
|
|
if !isSecureBrowser {
|
|
loadURLWithCookie(url: url)
|
|
loadURLWithCookie(url: url)
|
|
|
|
+ } else {
|
|
|
|
+ if let url = URL(string: "https://google.com/") {
|
|
|
|
+ loadURLWithCookie(url: url)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -249,6 +270,7 @@ public class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScroll
|
|
for cookie in cookies {
|
|
for cookie in cookies {
|
|
webView.configuration.websiteDataStore.httpCookieStore.setCookie(cookie)
|
|
webView.configuration.websiteDataStore.httpCookieStore.setCookie(cookie)
|
|
}
|
|
}
|
|
|
|
+ textField.text = url.absoluteString
|
|
webView.load(urlRequest)
|
|
webView.load(urlRequest)
|
|
}
|
|
}
|
|
}
|
|
}
|