@capacitor/android 3.2.5 → 3.3.3

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 CHANGED
@@ -3,6 +3,52 @@
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
+ ## [3.3.3](https://github.com/ionic-team/capacitor/compare/3.3.2...3.3.3) (2021-12-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **android:** Prevent crash in restoreInstanceState if bundleData is null ([#5289](https://github.com/ionic-team/capacitor/issues/5289)) ([622d62f](https://github.com/ionic-team/capacitor/commit/622d62fc0d7cd79558bf6f11331bd7d6690aa4f9))
12
+
13
+
14
+
15
+
16
+
17
+ ## [3.3.2](https://github.com/ionic-team/capacitor/compare/3.3.1...3.3.2) (2021-11-17)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **android:** Allow web geolocation if only COARSE_LOCATION is granted ([#5236](https://github.com/ionic-team/capacitor/issues/5236)) ([bc7b24e](https://github.com/ionic-team/capacitor/commit/bc7b24e9b58b194b32b750c5816c8d8ef180834a))
23
+
24
+
25
+
26
+
27
+
28
+ ## [3.3.1](https://github.com/ionic-team/capacitor/compare/3.3.0...3.3.1) (2021-11-05)
29
+
30
+ **Note:** Version bump only for package @capacitor/android
31
+
32
+
33
+
34
+
35
+
36
+ # [3.3.0](https://github.com/ionic-team/capacitor/compare/3.2.5...3.3.0) (2021-11-03)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **core:** avoid crash on logging circular objects ([#5186](https://github.com/ionic-team/capacitor/issues/5186)) ([1451ec8](https://github.com/ionic-team/capacitor/commit/1451ec850a9ef73267a032638e73f1fc440647b9))
42
+
43
+
44
+ ### Features
45
+
46
+ * **android:** ability to reload the webview ([#5184](https://github.com/ionic-team/capacitor/issues/5184)) ([c495bed](https://github.com/ionic-team/capacitor/commit/c495bed216ddf05450f185d2d3f09b4052b281a8))
47
+
48
+
49
+
50
+
51
+
6
52
  ## [3.2.5](https://github.com/ionic-team/capacitor/compare/3.2.4...3.2.5) (2021-10-13)
7
53
 
8
54
 
@@ -167,21 +167,6 @@ const nativeBridge = (function (exports) {
167
167
  win.Capacitor = cap;
168
168
  win.Ionic.WebView = IonicWebView;
169
169
  };
170
- const safeStringify = (value) => {
171
- const seen = new Set();
172
- return JSON.stringify(value, (_k, v) => {
173
- if (seen.has(v)) {
174
- if (v === null)
175
- return null;
176
- else
177
- return '...';
178
- }
179
- if (typeof v === 'object') {
180
- seen.add(v);
181
- }
182
- return v;
183
- });
184
- };
185
170
  const initLogger = (win, cap) => {
186
171
  const BRIDGED_CONSOLE_METHODS = [
187
172
  'debug',
@@ -248,7 +233,7 @@ const nativeBridge = (function (exports) {
248
233
  const serializeConsoleMessage = (msg) => {
249
234
  if (typeof msg === 'object') {
250
235
  try {
251
- msg = safeStringify(msg);
236
+ msg = JSON.stringify(msg);
252
237
  }
253
238
  catch (e) {
254
239
  // ignore
@@ -317,7 +302,7 @@ const nativeBridge = (function (exports) {
317
302
  postToNative = data => {
318
303
  var _a;
319
304
  try {
320
- win.androidBridge.postMessage(safeStringify(data));
305
+ win.androidBridge.postMessage(JSON.stringify(data));
321
306
  }
322
307
  catch (e) {
323
308
  (_a = win === null || win === void 0 ? void 0 : win.console) === null || _a === void 0 ? void 0 : _a.error(e);
@@ -348,7 +333,7 @@ const nativeBridge = (function (exports) {
348
333
  url: url,
349
334
  line: lineNo,
350
335
  col: columnNo,
351
- errorObject: safeStringify(err),
336
+ errorObject: JSON.stringify(err),
352
337
  },
353
338
  };
354
339
  if (err !== null) {
@@ -807,8 +807,10 @@ public class Bridge {
807
807
  // Let the plugin restore any state it needs
808
808
  Bundle bundleData = savedInstanceState.getBundle(BUNDLE_PLUGIN_CALL_BUNDLE_KEY);
809
809
  PluginHandle lastPlugin = getPlugin(lastPluginId);
810
- if (lastPlugin != null) {
810
+ if (bundleData != null && lastPlugin != null) {
811
811
  lastPlugin.getInstance().restoreState(bundleData);
812
+ } else {
813
+ Logger.error("Unable to restore last plugin call");
812
814
  }
813
815
  }
814
816
  }
@@ -823,10 +825,15 @@ public class Bridge {
823
825
  PluginHandle handle = getPlugin(call.getPluginId());
824
826
 
825
827
  if (handle != null) {
826
- outState.putString(BUNDLE_LAST_PLUGIN_ID_KEY, call.getPluginId());
827
- outState.putString(BUNDLE_LAST_PLUGIN_CALL_METHOD_NAME_KEY, call.getMethodName());
828
- outState.putString(BUNDLE_PLUGIN_CALL_OPTIONS_SAVED_KEY, call.getData().toString());
829
- outState.putBundle(BUNDLE_PLUGIN_CALL_BUNDLE_KEY, handle.getInstance().saveInstanceState());
828
+ Bundle bundle = handle.getInstance().saveInstanceState();
829
+ if (bundle != null) {
830
+ outState.putString(BUNDLE_LAST_PLUGIN_ID_KEY, call.getPluginId());
831
+ outState.putString(BUNDLE_LAST_PLUGIN_CALL_METHOD_NAME_KEY, call.getMethodName());
832
+ outState.putString(BUNDLE_PLUGIN_CALL_OPTIONS_SAVED_KEY, call.getData().toString());
833
+ outState.putBundle(BUNDLE_PLUGIN_CALL_BUNDLE_KEY, bundle);
834
+ } else {
835
+ Logger.error("Couldn't save last " + call.getPluginId() + "'s Plugin " + call.getMethodName() + " call");
836
+ }
830
837
  }
831
838
  }
832
839
  }
@@ -1148,6 +1155,13 @@ public class Bridge {
1148
1155
  webView.post(() -> webView.loadUrl(appUrl));
1149
1156
  }
1150
1157
 
1158
+ /**
1159
+ * Reload the WebView
1160
+ */
1161
+ public void reload() {
1162
+ webView.post(() -> webView.loadUrl(appUrl));
1163
+ }
1164
+
1151
1165
  public String getLocalUrl() {
1152
1166
  return localUrl;
1153
1167
  }
@@ -7,6 +7,7 @@ import android.app.AlertDialog;
7
7
  import android.content.ActivityNotFoundException;
8
8
  import android.content.Intent;
9
9
  import android.net.Uri;
10
+ import android.os.Build;
10
11
  import android.os.Environment;
11
12
  import android.provider.MediaStore;
12
13
  import android.view.View;
@@ -280,7 +281,13 @@ public class BridgeWebChromeClient extends WebChromeClient {
280
281
  if (isGranted) {
281
282
  callback.invoke(origin, true, false);
282
283
  } else {
283
- callback.invoke(origin, false, false);
284
+ final String[] coarsePermission = { Manifest.permission.ACCESS_COARSE_LOCATION };
285
+ // TODO replace with Build.VERSION_CODES.S once we target SDK 31
286
+ if (Build.VERSION.SDK_INT >= 31 && PermissionHelper.hasPermissions(bridge.getContext(), coarsePermission)) {
287
+ callback.invoke(origin, true, false);
288
+ } else {
289
+ callback.invoke(origin, false, false);
290
+ }
284
291
  }
285
292
  };
286
293
  permissionLauncher.launch(geoPermissions);
@@ -146,7 +146,7 @@ public class FileUtils {
146
146
  */
147
147
  static String readFile(AssetManager assetManager, String fileName) throws IOException {
148
148
  try (BufferedReader reader = new BufferedReader(new InputStreamReader(assetManager.open(fileName)))) {
149
- StringBuffer buffer = new StringBuffer();
149
+ StringBuilder buffer = new StringBuilder();
150
150
  String line;
151
151
  while ((line = reader.readLine()) != null) {
152
152
  buffer.append(line + "\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/android",
3
- "version": "3.2.5",
3
+ "version": "3.3.3",
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)",
@@ -22,10 +22,10 @@
22
22
  "verify": "./gradlew clean lint build test -b capacitor/build.gradle"
23
23
  },
24
24
  "peerDependencies": {
25
- "@capacitor/core": "^3.2.0"
25
+ "@capacitor/core": "^3.3.0"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "cc2960572ad70a0272c3ea1c44dbee14acf6e2ec"
30
+ "gitHead": "cd8221ed0162454d2ee01dc3bc164de38a81bf43"
31
31
  }