@capgo/inappbrowser 7.27.3 → 7.28.0
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 +22 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +9 -0
- package/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +1 -1
- package/ios/Sources/InAppBrowserPlugin/WKWebViewController.swift +13 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,28 @@ Add the following to your `Info.plist` file:
|
|
|
91
91
|
<string>We need access to the microphone to record audio.</string>
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
### Location usage
|
|
95
|
+
|
|
96
|
+
#### Android
|
|
97
|
+
|
|
98
|
+
Add the following to your `AndroidManifest.xml` file:
|
|
99
|
+
|
|
100
|
+
```xml
|
|
101
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
102
|
+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then the permission will be asked when location is requested by a website in the webview.
|
|
106
|
+
|
|
107
|
+
#### iOS
|
|
108
|
+
|
|
109
|
+
Add the following to your `Info.plist` file:
|
|
110
|
+
|
|
111
|
+
```xml
|
|
112
|
+
<key>NSLocationWhenInUseUsageDescription</key>
|
|
113
|
+
<string>We need access to your location to provide location-based services.</string>
|
|
114
|
+
```
|
|
115
|
+
|
|
94
116
|
### Two way communication
|
|
95
117
|
|
|
96
118
|
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.
|
|
53
|
+
private final String pluginVersion = "7.28.0";
|
|
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
|
+
private let pluginVersion: String = "7.28.0"
|
|
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
|