Skip to content

Commit c698566

Browse files
authored
Merge branch 'main' into fix-vname-crash
2 parents 2e92530 + 9d08df6 commit c698566

File tree

31 files changed

+212
-335
lines changed

31 files changed

+212
-335
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [7.0.0-rc.0](https://github.com/ionic-team/capacitor/compare/7.0.0-beta.0...7.0.0-rc.0) (2024-12-20)
7+
8+
**Note:** Version bump only for package capacitor
9+
10+
# [7.0.0-beta.0](https://github.com/ionic-team/capacitor/compare/7.0.0-alpha.2...7.0.0-beta.0) (2024-12-20)
11+
12+
### Bug Fixes
13+
14+
- **cli:** correct rimraf import ([#7811](https://github.com/ionic-team/capacitor/issues/7811)) ([0891624](https://github.com/ionic-team/capacitor/commit/0891624c46b78a0fd39f617f834d5cdd1f54f5e6))
15+
- **cli:** update link to telemetry information ([e922e2b](https://github.com/ionic-team/capacitor/commit/e922e2b718f5c6f2e4062cdccdeb92da3321e67d))
16+
- **ios:** Make Bridge webView first responder ([#7753](https://github.com/ionic-team/capacitor/issues/7753)) ([77e4668](https://github.com/ionic-team/capacitor/commit/77e4668fa8dbb24b4561387e101547f74e37538e))
17+
18+
### Features
19+
20+
- Add global initialFocus configuration ([#7775](https://github.com/ionic-team/capacitor/issues/7775)) ([61d0165](https://github.com/ionic-team/capacitor/commit/61d01653685d8e3594d2d8a6bd870fa9643ba95c))
21+
622
# [7.0.0-alpha.2](https://github.com/ionic-team/capacitor/compare/7.0.0-alpha.1...7.0.0-alpha.2) (2024-11-19)
723

824
### Bug Fixes

android/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [7.0.0-rc.0](https://github.com/ionic-team/capacitor/compare/7.0.0-beta.0...7.0.0-rc.0) (2024-12-20)
7+
8+
**Note:** Version bump only for package @capacitor/android
9+
10+
# [7.0.0-beta.0](https://github.com/ionic-team/capacitor/compare/7.0.0-alpha.2...7.0.0-beta.0) (2024-12-20)
11+
12+
### Features
13+
14+
- Add global initialFocus configuration ([#7775](https://github.com/ionic-team/capacitor/issues/7775)) ([61d0165](https://github.com/ionic-team/capacitor/commit/61d01653685d8e3594d2d8a6bd870fa9643ba95c))
15+
616
# [7.0.0-alpha.2](https://github.com/ionic-team/capacitor/compare/7.0.0-alpha.1...7.0.0-alpha.2) (2024-11-19)
717

818
**Note:** Version bump only for package @capacitor/android

android/capacitor/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ android {
6464
lintConfig file('lint.xml')
6565
}
6666
compileOptions {
67-
sourceCompatibility JavaVersion.VERSION_17
68-
targetCompatibility JavaVersion.VERSION_17
67+
sourceCompatibility JavaVersion.VERSION_21
68+
targetCompatibility JavaVersion.VERSION_21
6969
}
7070
publishing {
7171
singleVariant("release")

android/capacitor/src/main/java/com/getcapacitor/Bridge.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
import android.os.Bundle;
1616
import android.os.Handler;
1717
import android.os.HandlerThread;
18+
import android.webkit.ServiceWorkerClient;
19+
import android.webkit.ServiceWorkerController;
1820
import android.webkit.ValueCallback;
21+
import android.webkit.WebResourceRequest;
22+
import android.webkit.WebResourceResponse;
1923
import android.webkit.WebSettings;
2024
import android.webkit.WebView;
2125
import androidx.activity.result.ActivityResultCallback;
@@ -274,6 +278,18 @@ private void loadWebView() {
274278
webView.setWebChromeClient(new BridgeWebChromeClient(this));
275279
webView.setWebViewClient(this.webViewClient);
276280

281+
if (Build.VERSION.SDK_INT >= 24 && config.isResolveServiceWorkerRequests()) {
282+
ServiceWorkerController swController = ServiceWorkerController.getInstance();
283+
swController.setServiceWorkerClient(
284+
new ServiceWorkerClient() {
285+
@Override
286+
public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
287+
return getLocalServer().shouldInterceptRequest(request);
288+
}
289+
}
290+
);
291+
}
292+
277293
if (!isDeployDisabled() && !isNewBinary()) {
278294
SharedPreferences prefs = getContext()
279295
.getSharedPreferences(com.getcapacitor.plugin.WebView.WEBVIEW_PREFS_NAME, Activity.MODE_PRIVATE);

android/capacitor/src/main/java/com/getcapacitor/BridgeFragment.java

Lines changed: 0 additions & 133 deletions
This file was deleted.

android/capacitor/src/main/java/com/getcapacitor/CapConfig.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class CapConfig {
5353
private int minHuaweiWebViewVersion = DEFAULT_HUAWEI_WEBVIEW_VERSION;
5454
private String errorPath;
5555
private boolean zoomableWebView = false;
56+
private boolean resolveServiceWorkerRequests = true;
5657

5758
// Embedded
5859
private String startPath;
@@ -179,6 +180,7 @@ private CapConfig(Builder builder) {
179180
this.minHuaweiWebViewVersion = builder.minHuaweiWebViewVersion;
180181
this.errorPath = builder.errorPath;
181182
this.zoomableWebView = builder.zoomableWebView;
183+
this.resolveServiceWorkerRequests = builder.resolveServiceWorkerRequests;
182184

183185
// Embedded
184186
this.startPath = builder.startPath;
@@ -282,6 +284,7 @@ private void deserializeConfig(@Nullable Context context) {
282284
useLegacyBridge = JSONUtils.getBoolean(configJSON, "android.useLegacyBridge", useLegacyBridge);
283285
webContentsDebuggingEnabled = JSONUtils.getBoolean(configJSON, "android.webContentsDebuggingEnabled", isDebug);
284286
zoomableWebView = JSONUtils.getBoolean(configJSON, "android.zoomEnabled", JSONUtils.getBoolean(configJSON, "zoomEnabled", false));
287+
resolveServiceWorkerRequests = JSONUtils.getBoolean(configJSON, "android.resolveServiceWorkerRequests", true);
285288

286289
String logBehavior = JSONUtils.getString(
287290
configJSON,
@@ -299,7 +302,11 @@ private void deserializeConfig(@Nullable Context context) {
299302
loggingEnabled = isDebug;
300303
}
301304

302-
initialFocus = JSONUtils.getBoolean(configJSON, "android.initialFocus", initialFocus);
305+
initialFocus = JSONUtils.getBoolean(
306+
configJSON,
307+
"android.initialFocus",
308+
JSONUtils.getBoolean(configJSON, "initialFocus", initialFocus)
309+
);
303310

304311
// Plugins
305312
pluginsConfiguration = deserializePluginsConfig(JSONUtils.getObject(configJSON, "plugins"));
@@ -370,6 +377,10 @@ public boolean isInputCaptured() {
370377
return captureInput;
371378
}
372379

380+
public boolean isResolveServiceWorkerRequests() {
381+
return resolveServiceWorkerRequests;
382+
}
383+
373384
public boolean isWebContentsDebuggingEnabled() {
374385
return webContentsDebuggingEnabled;
375386
}
@@ -569,6 +580,7 @@ public static class Builder {
569580
private int minWebViewVersion = DEFAULT_ANDROID_WEBVIEW_VERSION;
570581
private int minHuaweiWebViewVersion = DEFAULT_HUAWEI_WEBVIEW_VERSION;
571582
private boolean zoomableWebView = false;
583+
private boolean resolveServiceWorkerRequests = true;
572584

573585
// Embedded
574586
private String startPath = null;
@@ -668,6 +680,11 @@ public Builder setUseLegacyBridge(boolean useLegacyBridge) {
668680
return this;
669681
}
670682

683+
public Builder setResolveServiceWorkerRequests(boolean resolveServiceWorkerRequests) {
684+
this.resolveServiceWorkerRequests = resolveServiceWorkerRequests;
685+
return this;
686+
}
687+
671688
public Builder setWebContentsDebuggingEnabled(boolean webContentsDebuggingEnabled) {
672689
this.webContentsDebuggingEnabled = webContentsDebuggingEnabled;
673690
return this;

android/capacitor/src/main/res/layout/fragment_bridge.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

android/capacitor/src/main/res/values/attrs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

android/capacitor/src/test/java/com/getcapacitor/ConfigBuildingTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void setup() {
5454
.setBackgroundColor("red")
5555
.setPluginsConfiguration(pluginConfig)
5656
.setServerUrl("http://www.google.com")
57+
.setResolveServiceWorkerRequests(false)
5758
.create();
5859
} catch (Exception e) {
5960
fail();
@@ -73,6 +74,7 @@ public void getCoreConfigValues() {
7374
assertTrue(config.isWebContentsDebuggingEnabled());
7475
assertEquals("red", config.getBackgroundColor());
7576
assertEquals("http://www.google.com", config.getServerUrl());
77+
assertFalse(config.isResolveServiceWorkerRequests());
7678
}
7779

7880
@Test

android/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@capacitor/android",
3-
"version": "7.0.0-alpha.2",
3+
"version": "7.0.0-rc.0",
44
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
55
"homepage": "https://capacitorjs.com",
66
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -23,7 +23,7 @@
2323
"verify": "./gradlew clean lint build test -b capacitor/build.gradle"
2424
},
2525
"peerDependencies": {
26-
"@capacitor/core": "^7.0.0-alpha.2"
26+
"@capacitor/core": "^7.0.0-rc.0"
2727
},
2828
"publishConfig": {
2929
"access": "public"

0 commit comments

Comments
 (0)