@capacitor/android 9.0.0-rc.1 → 9.0.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.
@@ -22,6 +22,8 @@ import com.getcapacitor.PluginMethod;
22
22
  import com.getcapacitor.WebViewListener;
23
23
  import com.getcapacitor.annotation.CapacitorPlugin;
24
24
  import java.util.Locale;
25
+ import java.util.regex.Matcher;
26
+ import java.util.regex.Pattern;
25
27
 
26
28
  @CapacitorPlugin
27
29
  public class SystemBars extends Plugin {
@@ -38,6 +40,7 @@ public class SystemBars extends Plugin {
38
40
 
39
41
  // https://issues.chromium.org/issues/40699457
40
42
  private static final int WEBVIEW_VERSION_WITH_SAFE_AREA_FIX = 140;
43
+ private static final Pattern WEBVIEW_MAJOR_VERSION_PATTERN = Pattern.compile("\\d+");
41
44
 
42
45
  static final String viewportMetaJSFunction = """
43
46
  function capacitorSystemBarsCheckMetaViewport() {
@@ -360,12 +363,24 @@ public class SystemBars extends Plugin {
360
363
 
361
364
  private Integer getWebViewMajorVersion() {
362
365
  PackageInfo info = WebViewCompat.getCurrentWebViewPackage(getContext());
363
- if (info != null && info.versionName != null) {
364
- String[] versionSegments = info.versionName.split("\\.");
365
- return Integer.valueOf(versionSegments[0]);
366
+ return info != null ? parseWebViewMajorVersion(info.versionName) : 0;
367
+ }
368
+
369
+ static int parseWebViewMajorVersion(String versionName) {
370
+ if (versionName == null) {
371
+ return 0;
366
372
  }
367
373
 
368
- return 0;
374
+ Matcher matcher = WEBVIEW_MAJOR_VERSION_PATTERN.matcher(versionName);
375
+ if (!matcher.find()) {
376
+ return 0;
377
+ }
378
+
379
+ try {
380
+ return Integer.parseInt(matcher.group());
381
+ } catch (NumberFormatException e) {
382
+ return 0;
383
+ }
369
384
  }
370
385
 
371
386
  private int getBottomInset(Insets systemBarsInsets, Insets imeInsets, boolean keyboardVisible) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/android",
3
- "version": "9.0.0-rc.1",
3
+ "version": "9.0.0",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -26,7 +26,7 @@
26
26
  "verify": "./gradlew :capacitor-android:clean :capacitor-android:lint :capacitor-android:build :capacitor-android:test"
27
27
  },
28
28
  "peerDependencies": {
29
- "@capacitor/core": "^9.0.0-rc.1"
29
+ "@capacitor/core": "^9.0.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"