@capacitor/android 9.0.0-alpha.3 → 9.0.0-alpha.4

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.
@@ -20,7 +20,7 @@ buildscript {
20
20
  }
21
21
  }
22
22
  dependencies {
23
- classpath 'com.android.tools.build:gradle:8.13.0'
23
+ classpath 'com.android.tools.build:gradle:9.2.1'
24
24
 
25
25
  if (System.getenv("CAP_PUBLISH") == "true") {
26
26
  classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
@@ -40,10 +40,9 @@ if (System.getenv("CAP_PUBLISH") == "true") {
40
40
 
41
41
  android {
42
42
  namespace = "com.getcapacitor.android"
43
- compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
43
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 37
44
44
  defaultConfig {
45
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
46
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
45
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 26
47
46
  versionCode 1
48
47
  versionName "1.0"
49
48
  consumerProguardFiles 'proguard-rules.pro'
@@ -11,7 +11,6 @@ import android.content.pm.PackageInfo;
11
11
  import android.content.pm.PackageManager;
12
12
  import android.content.res.Configuration;
13
13
  import android.net.Uri;
14
- import android.os.Build;
15
14
  import android.os.Bundle;
16
15
  import android.os.Handler;
17
16
  import android.os.HandlerThread;
@@ -51,7 +50,6 @@ import java.util.LinkedList;
51
50
  import java.util.List;
52
51
  import java.util.Map;
53
52
  import java.util.Set;
54
- import java.util.function.Function;
55
53
  import java.util.regex.Matcher;
56
54
  import java.util.regex.Pattern;
57
55
  import org.json.JSONException;
@@ -294,63 +292,19 @@ public class Bridge {
294
292
 
295
293
  @SuppressLint("WebViewApiAvailability")
296
294
  public boolean isMinimumWebViewInstalled() {
297
- PackageManager pm = getContext().getPackageManager();
298
-
299
- // Check getCurrentWebViewPackage() directly if above Android 8
300
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
301
- PackageInfo info = WebView.getCurrentWebViewPackage();
302
- Pattern pattern = Pattern.compile("(\\d+)");
303
- Matcher matcher = pattern.matcher(info.versionName);
304
- if (matcher.find()) {
305
- String majorVersionStr = matcher.group(0);
306
- int majorVersion = Integer.parseInt(majorVersionStr);
307
- if (info.packageName.equals("com.huawei.webview")) {
308
- return majorVersion >= config.getMinHuaweiWebViewVersion();
309
- }
310
- return majorVersion >= config.getMinWebViewVersion();
311
- } else {
312
- return false;
313
- }
314
- }
315
-
316
- // Otherwise manually check WebView versions
317
- try {
318
- PackageInfo info = InternalUtils.getPackageInfo(pm, "com.android.chrome");
319
- String majorVersionStr = info.versionName.split("\\.")[0];
320
- int majorVersion = Integer.parseInt(majorVersionStr);
321
- return majorVersion >= config.getMinWebViewVersion();
322
- } catch (Exception ex) {
323
- Logger.warn("Unable to get package info for 'com.google.android.webview'" + ex.toString());
324
- }
325
-
326
- try {
327
- PackageInfo info = InternalUtils.getPackageInfo(pm, "com.android.webview");
328
- String majorVersionStr = info.versionName.split("\\.")[0];
295
+ PackageInfo info = WebView.getCurrentWebViewPackage();
296
+ Pattern pattern = Pattern.compile("(\\d+)");
297
+ Matcher matcher = pattern.matcher(info.versionName);
298
+ if (matcher.find()) {
299
+ String majorVersionStr = matcher.group(0);
329
300
  int majorVersion = Integer.parseInt(majorVersionStr);
301
+ if (info.packageName.equals("com.huawei.webview")) {
302
+ return majorVersion >= config.getMinHuaweiWebViewVersion();
303
+ }
330
304
  return majorVersion >= config.getMinWebViewVersion();
331
- } catch (Exception ex) {
332
- Logger.warn("Unable to get package info for 'com.android.webview'" + ex.toString());
333
- }
334
-
335
- final int amazonFireMajorWebViewVersion = extractWebViewMajorVersion(pm, "com.amazon.webview.chromium");
336
- if (amazonFireMajorWebViewVersion >= config.getMinWebViewVersion()) {
337
- return true;
338
- }
339
-
340
- // Could not detect any webview, return false
341
- return false;
342
- }
343
-
344
- private int extractWebViewMajorVersion(final PackageManager pm, final String webViewPackageName) {
345
- try {
346
- final PackageInfo info = InternalUtils.getPackageInfo(pm, webViewPackageName);
347
- final String majorVersionStr = info.versionName.split("\\.")[0];
348
- final int majorVersion = Integer.parseInt(majorVersionStr);
349
- return majorVersion;
350
- } catch (Exception ex) {
351
- Logger.warn(String.format("Unable to get package info for '%s' with err '%s'", webViewPackageName, ex));
305
+ } else {
306
+ return false;
352
307
  }
353
- return 0;
354
308
  }
355
309
 
356
310
  public boolean launchIntent(Uri url) {
@@ -1,6 +1,5 @@
1
1
  package com.getcapacitor.plugin.util;
2
2
 
3
- import android.os.Build;
4
3
  import android.os.LocaleList;
5
4
  import android.text.TextUtils;
6
5
  import com.getcapacitor.Bridge;
@@ -211,9 +210,7 @@ public class CapacitorHttpUrlConnection implements ICapacitorHttpUrlConnection {
211
210
  this.writeRequestBody(dataString != null ? dataString : "");
212
211
  } else if (bodyType != null && bodyType.equals("file")) {
213
212
  try (DataOutputStream os = new DataOutputStream(connection.getOutputStream())) {
214
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
215
- os.write(Base64.getDecoder().decode(body.toString()));
216
- }
213
+ os.write(Base64.getDecoder().decode(body.toString()));
217
214
  os.flush();
218
215
  }
219
216
  } else if (contentType.contains("application/x-www-form-urlencoded")) {
@@ -295,13 +292,7 @@ public class CapacitorHttpUrlConnection implements ICapacitorHttpUrlConnection {
295
292
  os.writeBytes("Content-Type: " + fileContentType + lineEnd);
296
293
  os.writeBytes("Content-Transfer-Encoding: binary" + lineEnd);
297
294
  os.writeBytes(lineEnd);
298
-
299
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
300
- os.write(Base64.getDecoder().decode(value));
301
- } else {
302
- os.write(android.util.Base64.decode(value, android.util.Base64.DEFAULT));
303
- }
304
-
295
+ os.write(Base64.getDecoder().decode(value));
305
296
  os.writeBytes(lineEnd);
306
297
  }
307
298
  }
@@ -9,7 +9,7 @@ buildscript {
9
9
  mavenCentral()
10
10
  }
11
11
  dependencies {
12
- classpath 'com.android.tools.build:gradle:8.13.0'
12
+ classpath 'com.android.tools.build:gradle:9.2.1'
13
13
  }
14
14
  }
15
15
 
@@ -17,10 +17,9 @@ apply plugin: 'com.android.library'
17
17
 
18
18
  android {
19
19
  namespace = "com.getcapacitor.cordova"
20
- compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
20
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 37
21
21
  defaultConfig {
22
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
23
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
22
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 26
24
23
  versionCode 1
25
24
  versionName "1.0"
26
25
  consumerProguardFiles 'proguard-rules.pro'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/android",
3
- "version": "9.0.0-alpha.3",
3
+ "version": "9.0.0-alpha.4",
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 clean lint build test -b capacitor/build.gradle"
27
27
  },
28
28
  "peerDependencies": {
29
- "@capacitor/core": "^9.0.0-alpha.3"
29
+ "@capacitor/core": "^9.0.0-alpha.4"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"