@capgo/inappbrowser 8.1.20 → 8.1.22

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.
@@ -52,7 +52,7 @@ repositories {
52
52
  dependencies {
53
53
  implementation fileTree(dir: 'libs', include: ['*.jar'])
54
54
  implementation project(':capacitor-android')
55
- implementation 'com.caverock:androidsvg:1.4'
55
+ implementation 'com.caverock:androidsvg-aar:1.4'
56
56
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
57
57
  implementation "androidx.window:window:1.5.1"
58
58
  testImplementation "junit:junit:$junitVersion"
@@ -55,7 +55,7 @@ import org.json.JSONObject;
55
55
  )
56
56
  public class InAppBrowserPlugin extends Plugin implements WebViewDialog.PermissionHandler {
57
57
 
58
- private final String pluginVersion = "8.1.20";
58
+ private final String pluginVersion = "8.1.22";
59
59
 
60
60
  public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
61
61
  private CustomTabsClient customTabsClient;
@@ -29,7 +29,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
29
29
  case aware = "AWARE"
30
30
  case fakeVisible = "FAKE_VISIBLE"
31
31
  }
32
- private let pluginVersion: String = "8.1.20"
32
+ private let pluginVersion: String = "8.1.22"
33
33
  public let identifier = "InAppBrowserPlugin"
34
34
  public let jsName = "InAppBrowser"
35
35
  public let pluginMethods: [CAPPluginMethod] = [
@@ -946,7 +946,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
946
946
  self.navigationItem.title = webView?.url?.host
947
947
  }
948
948
  case "URL":
949
-
949
+ // Guard against notifications during cleanup when webView is being torn down
950
+ guard self.webView != nil else { return }
950
951
  emit("urlChangeEvent", data: ["url": webView?.url?.absoluteString ?? ""])
951
952
  self.injectJavaScriptInterface()
952
953
  default:
@@ -1042,17 +1043,19 @@ public extension WKWebViewController {
1042
1043
  open func cleanupWebView() {
1043
1044
  guard let webView = self.webView else { return }
1044
1045
  webView.stopLoading()
1045
- // Break delegate callbacks early
1046
- webView.navigationDelegate = nil
1047
- webView.uiDelegate = nil
1048
- webView.loadHTMLString("", baseURL: nil)
1049
1046
 
1047
+ // Remove KVO observers FIRST, before any operation that could trigger them
1050
1048
  webView.removeObserver(self, forKeyPath: estimatedProgressKeyPath)
1051
1049
  if websiteTitleInNavigationBar {
1052
1050
  webView.removeObserver(self, forKeyPath: titleKeyPath)
1053
1051
  }
1054
1052
  webView.removeObserver(self, forKeyPath: #keyPath(WKWebView.url))
1055
1053
 
1054
+ // Now safe to tear down
1055
+ webView.navigationDelegate = nil
1056
+ webView.uiDelegate = nil
1057
+ webView.loadHTMLString("", baseURL: nil)
1058
+
1056
1059
  webView.configuration.userContentController.removeAllUserScripts()
1057
1060
  webView.configuration.userContentController.removeScriptMessageHandler(forName: "messageHandler")
1058
1061
  webView.configuration.userContentController.removeScriptMessageHandler(forName: "close")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "8.1.20",
3
+ "version": "8.1.22",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",