@capacitor/android 5.6.0 → 5.7.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.
- package/capacitor/src/main/assets/native-bridge.js +4 -0
- package/capacitor/src/main/java/com/getcapacitor/PluginCall.java +7 -0
- package/capacitor/src/main/java/com/getcapacitor/plugin/CapacitorHttp.java +18 -9
- package/capacitor/src/main/java/com/getcapacitor/plugin/WebView.java +7 -0
- package/package.json +2 -2
|
@@ -279,6 +279,10 @@ var nativeBridge = (function (exports) {
|
|
|
279
279
|
callback(result.path);
|
|
280
280
|
});
|
|
281
281
|
};
|
|
282
|
+
IonicWebView.setServerAssetPath = (path) => {
|
|
283
|
+
var _a;
|
|
284
|
+
(_a = Plugins === null || Plugins === void 0 ? void 0 : Plugins.WebView) === null || _a === void 0 ? void 0 : _a.setServerAssetPath({ path });
|
|
285
|
+
};
|
|
282
286
|
IonicWebView.setServerBasePath = (path) => {
|
|
283
287
|
var _a;
|
|
284
288
|
(_a = Plugins === null || Plugins === void 0 ? void 0 : Plugins.WebView) === null || _a === void 0 ? void 0 : _a.setServerBasePath({ path });
|
|
@@ -370,6 +370,13 @@ public class PluginCall {
|
|
|
370
370
|
return defaultValue;
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
/**
|
|
374
|
+
* @param name of the option to check
|
|
375
|
+
* @return boolean indicating if the plugin call has an option for the provided name.
|
|
376
|
+
* @deprecated Presence of a key should not be considered significant.
|
|
377
|
+
* Use typed accessors to check the value instead.
|
|
378
|
+
*/
|
|
379
|
+
@Deprecated
|
|
373
380
|
public boolean hasOption(String name) {
|
|
374
381
|
return this.data.has(name);
|
|
375
382
|
}
|
|
@@ -24,7 +24,7 @@ import java.util.concurrent.Executors;
|
|
|
24
24
|
)
|
|
25
25
|
public class CapacitorHttp extends Plugin {
|
|
26
26
|
|
|
27
|
-
private Map<Runnable, PluginCall> activeRequests = new HashMap<>();
|
|
27
|
+
private final Map<Runnable, PluginCall> activeRequests = new HashMap<>();
|
|
28
28
|
private final ExecutorService executor = Executors.newCachedThreadPool();
|
|
29
29
|
|
|
30
30
|
@Override
|
|
@@ -59,17 +59,26 @@ public class CapacitorHttp extends Plugin {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
private void http(final PluginCall call, final String httpMethod) {
|
|
62
|
-
Runnable asyncHttpCall = ()
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
Runnable asyncHttpCall = new Runnable() {
|
|
63
|
+
@Override
|
|
64
|
+
public void run() {
|
|
65
|
+
try {
|
|
66
|
+
JSObject response = HttpRequestHandler.request(call, httpMethod, getBridge());
|
|
67
|
+
call.resolve(response);
|
|
68
|
+
} catch (Exception e) {
|
|
69
|
+
call.reject(e.getLocalizedMessage(), e.getClass().getSimpleName(), e);
|
|
70
|
+
} finally {
|
|
71
|
+
activeRequests.remove(this);
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
};
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
if (!executor.isShutdown()) {
|
|
77
|
+
activeRequests.put(asyncHttpCall, call);
|
|
78
|
+
executor.submit(asyncHttpCall);
|
|
79
|
+
} else {
|
|
80
|
+
call.reject("Failed to execute request - Http Plugin was shutdown");
|
|
81
|
+
}
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
@JavascriptInterface
|
|
@@ -14,6 +14,13 @@ public class WebView extends Plugin {
|
|
|
14
14
|
public static final String WEBVIEW_PREFS_NAME = "CapWebViewSettings";
|
|
15
15
|
public static final String CAP_SERVER_PATH = "serverBasePath";
|
|
16
16
|
|
|
17
|
+
@PluginMethod
|
|
18
|
+
public void setServerAssetPath(PluginCall call) {
|
|
19
|
+
String path = call.getString("path");
|
|
20
|
+
bridge.setServerAssetPath(path);
|
|
21
|
+
call.resolve();
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
@PluginMethod
|
|
18
25
|
public void setServerBasePath(PluginCall call) {
|
|
19
26
|
String path = call.getString("path");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/android",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.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)",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"verify": "./gradlew clean lint build test -b capacitor/build.gradle"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@capacitor/core": "^5.
|
|
26
|
+
"@capacitor/core": "^5.7.0"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|