@capgo/capacitor-inappbrowser 8.6.35 → 8.7.0-beta.pr598.346.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -387,6 +387,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
387
387
  open var allowWebViewJsVisibilityControl = false
388
388
  open var allowScreenshotsFromWebPage = false
389
389
  open var captureConsoleLogs = false
390
+ open var persistWebViewData = true
390
391
  open var handleDownloads = false
391
392
  open var delegate: WKWebViewControllerDelegate?
392
393
  open var bypassedSSLHosts: [String]?
@@ -432,6 +433,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
432
433
  var waitsForPopupNavigation = false
433
434
  var hiddenPopupWindow = false
434
435
  var opensHidden = false
436
+ var isLayeredBehind = false
437
+ var transparentHostBackground = true
435
438
 
436
439
  // Dimension properties
437
440
  var customWidth: CGFloat?
@@ -748,45 +751,67 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
748
751
  .compactMap { $0 as? UIWindowScene }
749
752
  .first { $0.activationState == .foregroundActive }
750
753
  ?? UIApplication.shared.connectedScenes
751
- .compactMap { $0 as? UIWindowScene }
752
- .first
754
+ .compactMap { $0 as? UIWindowScene }
755
+ .first
753
756
  return windowScene?.statusBarManager?.statusBarFrame.height ?? 0
754
757
  }
755
758
 
756
- // Make status bar background with colored view underneath
757
- open func setupStatusBarBackground(color: UIColor) {
758
- // Remove any existing status bar view
759
- statusBarBackgroundView?.removeFromSuperview()
759
+ private func applyNavigationBarBackground(color: UIColor) {
760
+ guard let navigationBar = navigationController?.navigationBar else {
761
+ return
762
+ }
760
763
 
761
- // Create a new view to cover both status bar and navigation bar
762
- statusBarBackgroundView = UIView()
764
+ navigationBar.backgroundColor = color
765
+ navigationBar.barTintColor = color
766
+ navigationBar.isTranslucent = false
767
+ navigationBar.setBackgroundImage(UIImage(), for: .default)
768
+ navigationBar.shadowImage = UIImage()
769
+ navigationBar.setValue(true, forKey: "hidesShadow")
763
770
 
764
- if let navView = navigationController?.view {
765
- // Add to back of view hierarchy
766
- navView.insertSubview(statusBarBackgroundView!, at: 0)
767
- statusBarBackgroundView?.translatesAutoresizingMaskIntoConstraints = false
771
+ if #available(iOS 13.0, *) {
772
+ let appearance = UINavigationBarAppearance()
773
+ appearance.configureWithOpaqueBackground()
774
+ appearance.backgroundColor = color
775
+ appearance.backgroundEffect = nil
776
+ appearance.shadowColor = .clear
777
+ appearance.shadowImage = UIImage()
768
778
 
769
- // Calculate total height - status bar + navigation bar
770
- let navBarHeight = navigationController?.navigationBar.frame.height ?? 44
771
- let totalHeight = (navigationController?.view.safeAreaInsets.top ?? CGFloat(0)) + navBarHeight
779
+ if let titleTextAttributes = navigationBar.titleTextAttributes {
780
+ appearance.titleTextAttributes = titleTextAttributes
781
+ }
782
+ if let largeTitleTextAttributes = navigationBar.largeTitleTextAttributes {
783
+ appearance.largeTitleTextAttributes = largeTitleTextAttributes
784
+ }
772
785
 
773
- // Position from top of screen to bottom of navigation bar
774
- NSLayoutConstraint.activate([
775
- statusBarBackgroundView!.topAnchor.constraint(equalTo: navView.topAnchor),
776
- statusBarBackgroundView!.leadingAnchor.constraint(equalTo: navView.leadingAnchor),
777
- statusBarBackgroundView!.trailingAnchor.constraint(equalTo: navView.trailingAnchor),
778
- statusBarBackgroundView!.heightAnchor.constraint(equalToConstant: totalHeight)
779
- ])
786
+ navigationBar.standardAppearance = appearance
787
+ navigationBar.compactAppearance = appearance
788
+ navigationBar.scrollEdgeAppearance = appearance
789
+ navigationBar.compactScrollEdgeAppearance = appearance
790
+ }
791
+ }
780
792
 
781
- // Set background color
782
- statusBarBackgroundView?.backgroundColor = color
793
+ // Make status bar background with colored view underneath
794
+ open func setupStatusBarBackground(color: UIColor) {
795
+ statusBarBackgroundView?.removeFromSuperview()
796
+ statusBarBackgroundView = UIView()
783
797
 
784
- // Make navigation bar transparent to show our view underneath
785
- navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
786
- navigationController?.navigationBar.shadowImage = UIImage()
787
- navigationController?.navigationBar.isTranslucent = true
788
- navigationController?.navigationBar.isTranslucent = true
798
+ guard let navController = navigationController,
799
+ let navView = navController.view,
800
+ let statusBarBackgroundView else {
801
+ return
789
802
  }
803
+ navView.insertSubview(statusBarBackgroundView, at: 0)
804
+ statusBarBackgroundView.translatesAutoresizingMaskIntoConstraints = false
805
+ statusBarBackgroundView.backgroundColor = color
806
+
807
+ NSLayoutConstraint.activate([
808
+ statusBarBackgroundView.topAnchor.constraint(equalTo: navView.topAnchor),
809
+ statusBarBackgroundView.leadingAnchor.constraint(equalTo: navView.leadingAnchor),
810
+ statusBarBackgroundView.trailingAnchor.constraint(equalTo: navView.trailingAnchor),
811
+ statusBarBackgroundView.bottomAnchor.constraint(equalTo: navController.navigationBar.bottomAnchor, constant: 1)
812
+ ])
813
+
814
+ applyNavigationBarBackground(color: color)
790
815
  }
791
816
 
792
817
  // Override to use our custom status bar style
@@ -1513,6 +1538,9 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
1513
1538
  self.edgesForExtendedLayout = [.bottom]
1514
1539
 
1515
1540
  let webConfiguration = initialWebConfiguration ?? WKWebViewConfiguration()
1541
+ if !persistWebViewData {
1542
+ webConfiguration.websiteDataStore = .nonPersistent()
1543
+ }
1516
1544
  let userContentController = webConfiguration.userContentController
1517
1545
  userContentController.removeAllUserScripts()
1518
1546
  userContentController.removeScriptMessageHandler(forName: "messageHandler")
@@ -1763,6 +1791,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
1763
1791
  self.blockedHosts = parent.blockedHosts
1764
1792
  self.authorizedAppLinks = parent.authorizedAppLinks
1765
1793
  self.activeNativeNavigationForWebview = parent.activeNativeNavigationForWebview
1794
+ self.initialWebConfiguration = configuration
1795
+ self.persistWebViewData = parent.persistWebViewData
1766
1796
  self.disableOverscroll = parent.disableOverscroll
1767
1797
  self.proxyRequests = parent.proxyRequests
1768
1798
  self.proxySchemeHandler = proxySchemeHandler
@@ -1935,7 +1965,6 @@ public extension WKWebViewController {
1935
1965
  return false
1936
1966
  }
1937
1967
 
1938
-
1939
1968
  func load(source sourceValue: WKWebSource) {
1940
1969
  switch sourceValue {
1941
1970
  case .remote(let url):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-inappbrowser",
3
- "version": "8.6.35",
3
+ "version": "8.7.0-beta.pr598.346.1",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",