@capacitor/android 4.0.0-alpha.1 → 4.0.0-alpha.2
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.
- package/CHANGELOG.md +20 -0
- package/capacitor/build.gradle +2 -2
- package/capacitor/src/main/java/com/getcapacitor/Bridge.java +4 -1
- package/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java +4 -2
- package/capacitor/src/main/java/com/getcapacitor/CapConfig.java +23 -2
- package/capacitor/src/main/java/com/getcapacitor/JSExport.java +1 -1
- package/capacitor/src/main/java/com/getcapacitor/Plugin.java +2 -1
- package/capacitor/src/main/java/com/getcapacitor/cordova/CapacitorCordovaCookieManager.java +1 -2
- package/capacitor/src/main/java/com/getcapacitor/cordova/MockCordovaWebViewImpl.java +5 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.0.0-alpha.2](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.2) (2022-05-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **android:** make removeAllListeners return a promise ([#5527](https://github.com/ionic-team/capacitor/issues/5527)) ([6f4d858](https://github.com/ionic-team/capacitor/commit/6f4d858ea879d97109c0c7da2d664d04806adc2a))
|
|
12
|
+
* **android:** prevent app from loading if server.url is invalid ([d4a0dea](https://github.com/ionic-team/capacitor/commit/d4a0deaa37eda4476f0be030e266c2c1260fc6e8))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **android:** don't allow server.androidScheme to be set to schemes handled by WebView ([01285ba](https://github.com/ionic-team/capacitor/commit/01285ba253d602b08a41240ad2ccf370730d51a3))
|
|
18
|
+
* **android:** set default targetSDK to 31 ([#5442](https://github.com/ionic-team/capacitor/issues/5442)) ([4442459](https://github.com/ionic-team/capacitor/commit/4442459b24cdbac25cb1e4de11583d22c21452b3))
|
|
19
|
+
* **android:** Upgrade gradle to 7.4 ([#5445](https://github.com/ionic-team/capacitor/issues/5445)) ([28eaf18](https://github.com/ionic-team/capacitor/commit/28eaf1851fa7a912917dbb40c68fb4dd583d08ad))
|
|
20
|
+
* **android:** Use java 11 ([#5552](https://github.com/ionic-team/capacitor/issues/5552)) ([e47959f](https://github.com/ionic-team/capacitor/commit/e47959fcbd6a89b97b1275a5814fdb4e7ce30672))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
# [4.0.0-alpha.1](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.1) (2022-03-25)
|
|
7
27
|
|
|
8
28
|
|
package/capacitor/build.gradle
CHANGED
|
@@ -47,8 +47,8 @@ android {
|
|
|
47
47
|
warningsAsErrors true
|
|
48
48
|
}
|
|
49
49
|
compileOptions {
|
|
50
|
-
sourceCompatibility JavaVersion.
|
|
51
|
-
targetCompatibility JavaVersion.
|
|
50
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
51
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -215,7 +215,10 @@ public class Bridge {
|
|
|
215
215
|
try {
|
|
216
216
|
URL appUrlObject = new URL(appUrlConfig);
|
|
217
217
|
authorities.add(appUrlObject.getAuthority());
|
|
218
|
-
} catch (Exception ex) {
|
|
218
|
+
} catch (Exception ex) {
|
|
219
|
+
Logger.error("Provided server url is invalid: " + ex.getMessage());
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
219
222
|
localUrl = appUrlConfig;
|
|
220
223
|
appUrl = appUrlConfig;
|
|
221
224
|
} else {
|
|
@@ -286,8 +286,10 @@ public class BridgeWebChromeClient extends WebChromeClient {
|
|
|
286
286
|
callback.invoke(origin, true, false);
|
|
287
287
|
} else {
|
|
288
288
|
final String[] coarsePermission = { Manifest.permission.ACCESS_COARSE_LOCATION };
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
if (
|
|
290
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
|
|
291
|
+
PermissionHelper.hasPermissions(bridge.getContext(), coarsePermission)
|
|
292
|
+
) {
|
|
291
293
|
callback.invoke(origin, true, false);
|
|
292
294
|
} else {
|
|
293
295
|
callback.invoke(origin, false, false);
|
|
@@ -9,8 +9,10 @@ import android.content.res.AssetManager;
|
|
|
9
9
|
import androidx.annotation.Nullable;
|
|
10
10
|
import com.getcapacitor.util.JSONUtils;
|
|
11
11
|
import java.io.IOException;
|
|
12
|
+
import java.util.Arrays;
|
|
12
13
|
import java.util.HashMap;
|
|
13
14
|
import java.util.Iterator;
|
|
15
|
+
import java.util.List;
|
|
14
16
|
import java.util.Locale;
|
|
15
17
|
import java.util.Map;
|
|
16
18
|
import org.json.JSONException;
|
|
@@ -105,7 +107,11 @@ public class CapConfig {
|
|
|
105
107
|
this.html5mode = builder.html5mode;
|
|
106
108
|
this.serverUrl = builder.serverUrl;
|
|
107
109
|
this.hostname = builder.hostname;
|
|
108
|
-
|
|
110
|
+
|
|
111
|
+
if (this.validateScheme(builder.androidScheme)) {
|
|
112
|
+
this.androidScheme = builder.androidScheme;
|
|
113
|
+
}
|
|
114
|
+
|
|
109
115
|
this.allowNavigation = builder.allowNavigation;
|
|
110
116
|
|
|
111
117
|
// Android Config
|
|
@@ -148,7 +154,12 @@ public class CapConfig {
|
|
|
148
154
|
html5mode = JSONUtils.getBoolean(configJSON, "server.html5mode", html5mode);
|
|
149
155
|
serverUrl = JSONUtils.getString(configJSON, "server.url", null);
|
|
150
156
|
hostname = JSONUtils.getString(configJSON, "server.hostname", hostname);
|
|
151
|
-
|
|
157
|
+
|
|
158
|
+
String configSchema = JSONUtils.getString(configJSON, "server.androidScheme", androidScheme);
|
|
159
|
+
if (this.validateScheme(configSchema)) {
|
|
160
|
+
androidScheme = configSchema;
|
|
161
|
+
}
|
|
162
|
+
|
|
152
163
|
allowNavigation = JSONUtils.getArray(configJSON, "server.allowNavigation", null);
|
|
153
164
|
|
|
154
165
|
// Android
|
|
@@ -191,6 +202,16 @@ public class CapConfig {
|
|
|
191
202
|
pluginsConfiguration = deserializePluginsConfig(JSONUtils.getObject(configJSON, "plugins"));
|
|
192
203
|
}
|
|
193
204
|
|
|
205
|
+
private boolean validateScheme(String scheme) {
|
|
206
|
+
List<String> invalidSchemes = Arrays.asList("file", "ftp", "ftps", "ws", "wss", "about", "blob", "data");
|
|
207
|
+
if (invalidSchemes.contains(scheme)) {
|
|
208
|
+
Logger.warn(scheme + " is not an allowed scheme. Defaulting to http.");
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
|
|
194
215
|
public boolean isHTML5Mode() {
|
|
195
216
|
return html5mode;
|
|
196
217
|
}
|
|
@@ -745,9 +745,10 @@ public class Plugin {
|
|
|
745
745
|
* @param call
|
|
746
746
|
*/
|
|
747
747
|
@SuppressWarnings("unused")
|
|
748
|
-
@PluginMethod(returnType = PluginMethod.
|
|
748
|
+
@PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
|
|
749
749
|
public void removeAllListeners(PluginCall call) {
|
|
750
750
|
eventListeners.clear();
|
|
751
|
+
call.resolve();
|
|
751
752
|
}
|
|
752
753
|
|
|
753
754
|
/**
|
|
@@ -12,7 +12,6 @@ class CapacitorCordovaCookieManager implements ICordovaCookieManager {
|
|
|
12
12
|
public CapacitorCordovaCookieManager(WebView webview) {
|
|
13
13
|
webView = webview;
|
|
14
14
|
cookieManager = CookieManager.getInstance();
|
|
15
|
-
CookieManager.setAcceptFileSchemeCookies(true);
|
|
16
15
|
cookieManager.setAcceptThirdPartyCookies(webView, true);
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -33,7 +32,7 @@ class CapacitorCordovaCookieManager implements ICordovaCookieManager {
|
|
|
33
32
|
|
|
34
33
|
@Override
|
|
35
34
|
public void clearCookies() {
|
|
36
|
-
cookieManager.
|
|
35
|
+
cookieManager.removeAllCookies(null);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
@Override
|
|
@@ -112,6 +112,7 @@ public class MockCordovaWebViewImpl implements CordovaWebView {
|
|
|
112
112
|
@Override
|
|
113
113
|
public void clearCache() {}
|
|
114
114
|
|
|
115
|
+
@Deprecated
|
|
115
116
|
@Override
|
|
116
117
|
public void clearCache(boolean b) {}
|
|
117
118
|
|
|
@@ -181,6 +182,7 @@ public class MockCordovaWebViewImpl implements CordovaWebView {
|
|
|
181
182
|
this.pluginManager.onDestroy();
|
|
182
183
|
}
|
|
183
184
|
|
|
185
|
+
@Deprecated
|
|
184
186
|
@Override
|
|
185
187
|
public void sendJavascript(String statememt) {
|
|
186
188
|
nativeToJsMessageQueue.addJavaScript(statememt);
|
|
@@ -198,14 +200,17 @@ public class MockCordovaWebViewImpl implements CordovaWebView {
|
|
|
198
200
|
@Override
|
|
199
201
|
public void showWebPage(String url, boolean openExternal, boolean clearHistory, Map<String, Object> params) {}
|
|
200
202
|
|
|
203
|
+
@Deprecated
|
|
201
204
|
@Override
|
|
202
205
|
public boolean isCustomViewShowing() {
|
|
203
206
|
return false;
|
|
204
207
|
}
|
|
205
208
|
|
|
209
|
+
@Deprecated
|
|
206
210
|
@Override
|
|
207
211
|
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {}
|
|
208
212
|
|
|
213
|
+
@Deprecated
|
|
209
214
|
@Override
|
|
210
215
|
public void hideCustomView() {}
|
|
211
216
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/android",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.2",
|
|
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)",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "5c588d5bd15b2b939c6efc25b7db9d6af29afae0"
|
|
31
31
|
}
|