@capgo/capacitor-updater 4.0.1 → 4.1.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.
@@ -47,7 +47,7 @@ public class CapacitorUpdater {
47
47
  private static final String bundleDirectory = "versions";
48
48
 
49
49
  public static final String TAG = "Capacitor-updater";
50
- public static final String pluginVersion = "4.0.1";
50
+ public static final String pluginVersion = "4.1.0";
51
51
 
52
52
  public SharedPreferences.Editor editor;
53
53
  public SharedPreferences prefs;
@@ -261,7 +261,7 @@ public class CapacitorUpdater {
261
261
 
262
262
  public Boolean delete(final String id, final Boolean removeInfo) throws IOException {
263
263
  final BundleInfo deleted = this.getBundleInfo(id);
264
- if (deleted.isBuiltin() || this.getCurrentBundleId() == id) {
264
+ if (deleted.isBuiltin() || this.getCurrentBundleId().equals(id)) {
265
265
  Log.e(TAG, "Cannot delete " + id);
266
266
  return false;
267
267
  }
@@ -460,7 +460,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
460
460
 
461
461
  private void _checkCancelDelay(Boolean killed) {
462
462
  final String delayUpdate = this.prefs.getString(DELAY_UPDATE, "");
463
- if ("".equals(delayUpdate)) {
463
+ if (!"".equals(delayUpdate)) {
464
464
  if ("background".equals(delayUpdate) && !killed) {
465
465
  this._cancelDelay("background check");
466
466
  } else if ("kill".equals(delayUpdate) && killed) {
@@ -557,7 +557,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
557
557
  return;
558
558
  }
559
559
 
560
- if (!res.has("url") || CapacitorUpdaterPlugin.this.isValidURL((String)res.get("url"))) {
560
+ if (!res.has("url") || !CapacitorUpdaterPlugin.this.isValidURL((String)res.get("url"))) {
561
561
  Log.e(CapacitorUpdater.TAG, "Error no url or wrong format");
562
562
  final JSObject retNoNeed = new JSObject();
563
563
  retNoNeed.put("bundle", current.toJSON());
@@ -146,7 +146,7 @@ extension CustomError: LocalizedError {
146
146
 
147
147
  public let TAG = "✨ Capacitor-updater:";
148
148
  public let CAP_SERVER_PATH = "serverBasePath"
149
- public let pluginVersion = "4.0.1"
149
+ public let pluginVersion = "4.1.0"
150
150
  public var statsUrl = ""
151
151
  public var appId = ""
152
152
  public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
@@ -463,10 +463,16 @@ extension CustomError: LocalizedError {
463
463
  "plugin_version": self.pluginVersion,
464
464
  "app_id": self.appId
465
465
  ]
466
-
467
466
  DispatchQueue.global(qos: .background).async {
468
- let _ = AF.request(self.statsUrl, method: .post,parameters: parameters, encoder: JSONParameterEncoder.default)
469
- print("\(self.TAG) Stats send for \(action), version \(versionName)")
467
+ let request = AF.request(self.statsUrl, method: .post,parameters: parameters, encoder: JSONParameterEncoder.default)
468
+ request.responseData { response in
469
+ switch response.result {
470
+ case .success():
471
+ print("\(self.TAG) Stats send for \(action), version \(versionName)")
472
+ case .failure(error):
473
+ print("\(self.TAG) Error sending stats: ", error )
474
+ }
475
+ }
470
476
  }
471
477
  }
472
478
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "license": "LGPL-3.0-only",
5
5
  "description": "OTA update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",