@capgo/inappbrowser 6.14.0 → 6.14.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.
@@ -7,6 +7,5 @@
7
7
  <data android:scheme="http" />
8
8
  </intent>
9
9
  </queries>
10
- <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
11
10
  <uses-permission android:name="android.permission.CAMERA"/>
12
11
  </manifest>
@@ -505,6 +505,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
505
505
  userContentController.add(self, name: "close")
506
506
  webConfiguration.allowsInlineMediaPlayback = true
507
507
  webConfiguration.userContentController = userContentController
508
+ webConfiguration.allowsInlineMediaPlayback = true
508
509
  let webView = WKWebView(frame: .zero, configuration: webConfiguration)
509
510
 
510
511
  if webView.responds(to: Selector(("setInspectable:"))) {
@@ -1242,13 +1243,38 @@ fileprivate extension WKWebViewController {
1242
1243
  // MARK: - WKUIDelegate
1243
1244
  extension WKWebViewController: WKUIDelegate {
1244
1245
  public func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
1246
+ // Create a strong reference to the completion handler to ensure it's called
1247
+ let strongCompletionHandler = completionHandler
1248
+
1245
1249
  // Ensure UI updates are on the main thread
1246
- DispatchQueue.main.async {
1250
+ DispatchQueue.main.async { [weak self] in
1251
+ guard let self = self else {
1252
+ // View controller was deallocated
1253
+ strongCompletionHandler()
1254
+ return
1255
+ }
1256
+
1257
+ // Check if view is available and ready for presentation
1258
+ guard self.view.window != nil, !self.isBeingDismissed, !self.isMovingFromParent else {
1259
+ print("[InAppBrowser] Cannot present alert - view not in window hierarchy or being dismissed")
1260
+ strongCompletionHandler()
1261
+ return
1262
+ }
1263
+
1247
1264
  let alertController = UIAlertController(title: nil, message: message, preferredStyle: .alert)
1248
1265
  alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in
1249
- completionHandler()
1266
+ strongCompletionHandler()
1250
1267
  }))
1251
- self.present(alertController, animated: true, completion: nil)
1268
+
1269
+ // Try to present the alert
1270
+ do {
1271
+ self.present(alertController, animated: true, completion: nil)
1272
+ } catch {
1273
+ // This won't typically be triggered as present doesn't throw,
1274
+ // but adding as a safeguard
1275
+ print("[InAppBrowser] Error presenting alert: \(error)")
1276
+ strongCompletionHandler()
1277
+ }
1252
1278
  }
1253
1279
  }
1254
1280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "6.14.0",
3
+ "version": "6.14.1",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",