@capgo/capacitor-inappbrowser 8.7.2 → 8.7.3

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.
@@ -98,7 +98,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
98
98
  case aware = "AWARE"
99
99
  case fakeVisible = "FAKE_VISIBLE"
100
100
  }
101
- private let pluginVersion: String = "8.7.2"
101
+ private let pluginVersion: String = "8.7.3"
102
102
  public let identifier = "CapgoInAppBrowserPlugin"
103
103
  public let jsName = "CapgoInAppBrowser"
104
104
  public let pluginMethods: [CAPPluginMethod] = [
@@ -756,40 +756,62 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
756
756
  return windowScene?.statusBarManager?.statusBarFrame.height ?? 0
757
757
  }
758
758
 
759
- // Make status bar background with colored view underneath
760
- open func setupStatusBarBackground(color: UIColor) {
761
- // Remove any existing status bar view
762
- statusBarBackgroundView?.removeFromSuperview()
759
+ private func applyNavigationBarBackground(color: UIColor) {
760
+ guard let navigationBar = navigationController?.navigationBar else {
761
+ return
762
+ }
763
763
 
764
- // Create a new view to cover both status bar and navigation bar
765
- 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")
766
770
 
767
- if let navView = navigationController?.view {
768
- // Add to back of view hierarchy
769
- navView.insertSubview(statusBarBackgroundView!, at: 0)
770
- 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()
771
778
 
772
- // Calculate total height - status bar + navigation bar
773
- let navBarHeight = navigationController?.navigationBar.frame.height ?? 44
774
- 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
+ }
775
785
 
776
- // Position from top of screen to bottom of navigation bar
777
- NSLayoutConstraint.activate([
778
- statusBarBackgroundView!.topAnchor.constraint(equalTo: navView.topAnchor),
779
- statusBarBackgroundView!.leadingAnchor.constraint(equalTo: navView.leadingAnchor),
780
- statusBarBackgroundView!.trailingAnchor.constraint(equalTo: navView.trailingAnchor),
781
- statusBarBackgroundView!.heightAnchor.constraint(equalToConstant: totalHeight)
782
- ])
786
+ navigationBar.standardAppearance = appearance
787
+ navigationBar.compactAppearance = appearance
788
+ navigationBar.scrollEdgeAppearance = appearance
789
+ navigationBar.compactScrollEdgeAppearance = appearance
790
+ }
791
+ }
783
792
 
784
- // Set background color
785
- statusBarBackgroundView?.backgroundColor = color
793
+ // Make status bar background with colored view underneath
794
+ open func setupStatusBarBackground(color: UIColor) {
795
+ statusBarBackgroundView?.removeFromSuperview()
796
+ statusBarBackgroundView = UIView()
786
797
 
787
- // Make navigation bar transparent to show our view underneath
788
- navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
789
- navigationController?.navigationBar.shadowImage = UIImage()
790
- navigationController?.navigationBar.isTranslucent = true
791
- navigationController?.navigationBar.isTranslucent = true
798
+ guard let navController = navigationController,
799
+ let navView = navController.view,
800
+ let statusBarBackgroundView else {
801
+ return
792
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)
793
815
  }
794
816
 
795
817
  // Override to use our custom status bar style
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-inappbrowser",
3
- "version": "8.7.2",
3
+ "version": "8.7.3",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",