Visual tweaks

This commit is contained in:
James Magahern
2020-07-29 19:24:05 -07:00
parent c96cafd1ca
commit bba9efbbb6
4 changed files with 52 additions and 7 deletions

View File

@@ -9,7 +9,8 @@ import UIKit
class BrowserViewController: UIViewController,
SBRProcessBundleBridgeDelegate, WKNavigationDelegate,
UITextFieldDelegate, ScriptPolicyViewControllerDelegate
UITextFieldDelegate, ScriptPolicyViewControllerDelegate,
UIPopoverPresentationControllerDelegate
{
let bridge = SBRProcessBundleBridge()
let browserView = BrowserView()
@@ -37,6 +38,8 @@ class BrowserViewController: UIViewController,
bridge.delegate = self
bridge.policyDataSource = policyManager
addChild(toolbarController)
let webView = bridge.webView
webView.allowsBackForwardNavigationGestures = true
webView.navigationDelegate = self
@@ -66,6 +69,7 @@ class BrowserViewController: UIViewController,
let navController = UINavigationController(rootViewController: scriptViewController)
navController.modalPresentationStyle = .popover
navController.popoverPresentationController?.sourceView = self.toolbarController.scriptControllerIconView
navController.popoverPresentationController?.delegate = self
self.present(navController, animated: true, completion: nil)
}), for: .touchUpInside)
@@ -114,6 +118,13 @@ class BrowserViewController: UIViewController,
bridge.webView.load(request)
}
// MARK: UIPopoverPresentationControllerDelegate
func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
// Forces popovers to present on iPhone
return .none
}
// MARK: SBRProcessBundleBridgeDelegate
func webProcess(_ bridge: SBRProcessBundleBridge, didAllowScriptResourceFromOrigin origin: String) {