@capgo/inappbrowser 7.27.3 → 7.28.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.
package/README.md CHANGED
@@ -8,6 +8,19 @@
8
8
 
9
9
  Capacitor plugin in app browser with urlChangeEvent, two way communication, camera and microphone usage, etc.
10
10
 
11
+ ## Why InAppBrowser?
12
+
13
+ The official Capacitor Browser plugin has strict security limitations that prevent advanced features. InAppBrowser removes these restrictions, enabling:
14
+
15
+ - **Two-way communication** between your app and the browser
16
+ - **JavaScript injection** for dynamic content manipulation
17
+ - **Camera and microphone access** within the browser context
18
+ - **URL change monitoring** for navigation tracking
19
+ - **Custom toolbars and UI** for branded experiences
20
+ - **Cookie and cache management** for session control
21
+
22
+ Perfect for OAuth flows, embedded web apps, video calls, and any scenario requiring deep integration with web content.
23
+
11
24
  ## Documentation
12
25
 
13
26
  The most complete doc is available here: https://capgo.app/docs/plugins/inappbrowser/
@@ -91,6 +104,28 @@ Add the following to your `Info.plist` file:
91
104
  <string>We need access to the microphone to record audio.</string>
92
105
  ```
93
106
 
107
+ ### Location usage
108
+
109
+ #### Android
110
+
111
+ Add the following to your `AndroidManifest.xml` file:
112
+
113
+ ```xml
114
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
115
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
116
+ ```
117
+
118
+ Then the permission will be asked when location is requested by a website in the webview.
119
+
120
+ #### iOS
121
+
122
+ Add the following to your `Info.plist` file:
123
+
124
+ ```xml
125
+ <key>NSLocationWhenInUseUsageDescription</key>
126
+ <string>We need access to your location to provide location-based services.</string>
127
+ ```
128
+
94
129
  ### Two way communication
95
130
 
96
131
  With this plugin you can send events from the main app to the inappbrowser and vice versa.
@@ -50,7 +50,7 @@ import org.json.JSONObject;
50
50
  )
51
51
  public class InAppBrowserPlugin extends Plugin implements WebViewDialog.PermissionHandler {
52
52
 
53
- private final String pluginVersion = "7.27.3";
53
+ private final String pluginVersion = "7.28.1";
54
54
 
55
55
  public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
56
56
  private CustomTabsClient customTabsClient;
@@ -732,6 +732,15 @@ public class WebViewDialog extends Dialog {
732
732
  }
733
733
  }
734
734
 
735
+ // Handle geolocation permission requests
736
+ @Override
737
+ public void onGeolocationPermissionsShowPrompt(String origin, android.webkit.GeolocationPermissions.Callback callback) {
738
+ Log.i("INAPPBROWSER", "onGeolocationPermissionsShowPrompt for origin: " + origin);
739
+ // Grant geolocation permission automatically for openWebView
740
+ // This allows websites to access location when opened with openWebView
741
+ callback.invoke(origin, true, false);
742
+ }
743
+
735
744
  // This method will be called at page load, a good place to inject customizations
736
745
  @Override
737
746
  public void onProgressChanged(WebView view, int newProgress) {
@@ -24,7 +24,7 @@ extension UIColor {
24
24
  */
25
25
  @objc(InAppBrowserPlugin)
26
26
  public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
27
- private let pluginVersion: String = "7.27.3"
27
+ private let pluginVersion: String = "7.28.1"
28
28
  public let identifier = "InAppBrowserPlugin"
29
29
  public let jsName = "InAppBrowser"
30
30
  public let pluginMethods: [CAPPluginMethod] = [
@@ -1578,13 +1578,13 @@ extension WKWebViewController: WKUIDelegate {
1578
1578
  }
1579
1579
  }
1580
1580
  }
1581
-
1581
+
1582
1582
  public func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
1583
1583
  // Handle target="_blank" links and popup windows
1584
1584
  // When preventDeeplink is true, we should load these in the same webview instead of opening externally
1585
1585
  if let url = navigationAction.request.url {
1586
1586
  print("[InAppBrowser] Handling popup/new window request for URL: \(url.absoluteString)")
1587
-
1587
+
1588
1588
  // If preventDeeplink is true, load the URL in the current webview
1589
1589
  if preventDeeplink {
1590
1590
  print("[InAppBrowser] preventDeeplink is true, loading popup URL in current webview")
@@ -1593,14 +1593,23 @@ extension WKWebViewController: WKUIDelegate {
1593
1593
  }
1594
1594
  return nil
1595
1595
  }
1596
-
1596
+
1597
1597
  // Otherwise, check if we should handle it externally
1598
1598
  // But since preventDeeplink is false here, we won't block it
1599
1599
  return nil
1600
1600
  }
1601
-
1601
+
1602
1602
  return nil
1603
1603
  }
1604
+
1605
+ @available(iOS 15.0, *)
1606
+ public func webView(_ webView: WKWebView, requestGeolocationPermissionFor origin: WKSecurityOrigin, initiatedByFrame frame: WKFrameInfo, decisionHandler: @escaping (WKPermissionDecision) -> Void) {
1607
+ print("[InAppBrowser] Geolocation permission requested for origin: \(origin.host)")
1608
+
1609
+ // Grant geolocation permission automatically for openWebView
1610
+ // This allows websites to access location when opened with openWebView
1611
+ decisionHandler(.grant)
1612
+ }
1604
1613
  }
1605
1614
 
1606
1615
  // MARK: - Host Blocking Utilities
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "7.27.3",
3
+ "version": "7.28.1",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",