@capgo/capacitor-updater 4.58.0 → 4.61.1

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.
@@ -1,5 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="ee.forgr.capacitor_updater">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
  <application>
4
3
  <service android:name="ee.forgr.capacitor_updater.DownloadService" />
5
4
  </application>
@@ -342,14 +342,14 @@ public class CapacitorUpdater {
342
342
  this.flattenAssets(unzipped, idName);
343
343
  this.notifyDownload(id, 100);
344
344
  this.saveBundleInfo(id, null);
345
- BundleInfo info = new BundleInfo(
345
+ BundleInfo next = new BundleInfo(
346
346
  id,
347
347
  version,
348
348
  BundleStatus.PENDING,
349
349
  new Date(System.currentTimeMillis()),
350
350
  checksum
351
351
  );
352
- this.saveBundleInfo(id, info);
352
+ this.saveBundleInfo(id, next);
353
353
  if (
354
354
  checksumRes != null &&
355
355
  !checksumRes.isEmpty() &&
@@ -357,23 +357,23 @@ public class CapacitorUpdater {
357
357
  ) {
358
358
  Log.e(
359
359
  CapacitorUpdater.TAG,
360
- "Error checksum " + info.getChecksum() + " " + checksum
360
+ "Error checksum " + next.getChecksum() + " " + checksum
361
361
  );
362
362
  this.sendStats("checksum_fail", getCurrentBundle().getVersionName());
363
- final Boolean res = this.delete(info.getId());
363
+ final Boolean res = this.delete(id);
364
364
  if (res) {
365
365
  Log.i(
366
366
  CapacitorUpdater.TAG,
367
- "Failed bundle deleted: " + info.getVersionName()
367
+ "Failed bundle deleted: " + next.getVersionName()
368
368
  );
369
369
  }
370
- return;
370
+ throw new IOException("Checksum failed: " + id);
371
371
  }
372
372
  final JSObject ret = new JSObject();
373
- ret.put("bundle", info.toJSON());
373
+ ret.put("bundle", next.toJSON());
374
374
  CapacitorUpdater.this.notifyListeners("updateAvailable", ret);
375
375
  if (setNext) {
376
- this.setNextBundle(info.getId());
376
+ this.setNextBundle(next.getId());
377
377
  }
378
378
  } catch (IOException e) {
379
379
  e.printStackTrace();
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin
55
55
  private static final String channelUrlDefault =
56
56
  "https://api.capgo.app/channel_self";
57
57
 
58
- private final String PLUGIN_VERSION = "4.58.0";
58
+ private final String PLUGIN_VERSION = "4.61.1";
59
59
  private static final String DELAY_CONDITION_PREFERENCES = "";
60
60
 
61
61
  private SharedPreferences.Editor editor;
@@ -15,7 +15,7 @@ import Version
15
15
  @objc(CapacitorUpdaterPlugin)
16
16
  public class CapacitorUpdaterPlugin: CAPPlugin {
17
17
  private var implementation = CapacitorUpdater()
18
- private let PLUGIN_VERSION: String = "4.58.0"
18
+ private let PLUGIN_VERSION: String = "4.61.1"
19
19
  static let updateUrlDefault = "https://api.capgo.app/updates"
20
20
  static let statsUrlDefault = "https://api.capgo.app/stats"
21
21
  static let channelUrlDefault = "https://api.capgo.app/channel_self"
@@ -129,11 +129,12 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
129
129
  if checksum != "" && next.getChecksum() != checksum {
130
130
  print("\(self.implementation.TAG) Error checksum", next.getChecksum(), checksum)
131
131
  self.implementation.sendStats(action: "checksum_fail", versionName: next.getVersionName())
132
- let resDel = self.implementation.delete(id: next.getId())
132
+ let id = next.getId()
133
+ let resDel = self.implementation.delete(id: id)
133
134
  if !resDel {
134
- print("\(self.implementation.TAG) Delete failed, id \(next.getId()) doesn't exist")
135
+ print("\(self.implementation.TAG) Delete failed, id \(id) doesn't exist")
135
136
  }
136
- return
137
+ throw ObjectSavableError.checksum
137
138
  }
138
139
  self.notifyListeners("updateAvailable", data: ["bundle": next.toJSON()])
139
140
  call.resolve(next.toJSON())
@@ -560,12 +561,13 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
560
561
  if res.checksum != "" && next.getChecksum() != res.checksum {
561
562
  print("\(self.implementation.TAG) Error checksum", next.getChecksum(), res.checksum)
562
563
  self.implementation.sendStats(action: "checksum_fail", versionName: next.getVersionName())
563
- let resDel = self.implementation.delete(id: next.getId())
564
+ let id = next.getId()
565
+ let resDel = self.implementation.delete(id: id)
564
566
  if !resDel {
565
- print("\(self.implementation.TAG) Delete failed, id \(next.getId()) doesn't exist")
567
+ print("\(self.implementation.TAG) Delete failed, id \(id) doesn't exist")
566
568
  }
567
569
  self.endBackGroundTask()
568
- return
570
+ throw ObjectSavableError.checksum
569
571
  }
570
572
  self.notifyListeners("updateAvailable", data: ["bundle": next.toJSON()])
571
573
  _ = self.implementation.setNextBundle(next: next.getId())
@@ -15,6 +15,7 @@ enum ObjectSavableError: String, LocalizedError {
15
15
  case unableToEncode = "Unable to encode object into data"
16
16
  case noValue = "No data object found for the given key"
17
17
  case unableToDecode = "Unable to decode object into given type"
18
+ case checksum = "Checksum failed"
18
19
 
19
20
  var errorDescription: String? {
20
21
  rawValue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "4.58.0",
3
+ "version": "4.61.1",
4
4
  "packageManager": "pnpm@8.3.1",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",
@@ -53,11 +53,11 @@
53
53
  "prepublishOnly": "npm run build"
54
54
  },
55
55
  "devDependencies": {
56
- "@capacitor/android": "^4.7.3",
57
- "@capacitor/cli": "^4.7.3",
58
- "@capacitor/core": "^4.7.3",
56
+ "@capacitor/android": "^4.8.0",
57
+ "@capacitor/cli": "^4.8.0",
58
+ "@capacitor/core": "^4.8.0",
59
59
  "@capacitor/docgen": "^0.2.1",
60
- "@capacitor/ios": "^4.7.3",
60
+ "@capacitor/ios": "^4.8.0",
61
61
  "@ionic/eslint-config": "^0.3.0",
62
62
  "@ionic/prettier-config": "^2.0.0",
63
63
  "@ionic/swiftlint-config": "^1.1.2",
@@ -68,13 +68,13 @@
68
68
  "eslint-plugin-import": "^2.27.5",
69
69
  "prettier": "^2.8.7",
70
70
  "prettier-plugin-java": "^2.1.0",
71
- "rimraf": "^4.4.1",
71
+ "rimraf": "^5.0.0",
72
72
  "rollup": "^3.20.7",
73
73
  "swiftlint": "^1.0.1",
74
74
  "typescript": "^5.0.4"
75
75
  },
76
76
  "peerDependencies": {
77
- "@capacitor/core": "^4.0.0 || ^5.0.0"
77
+ "@capacitor/core": "^5.0.0"
78
78
  },
79
79
  "prettier": "@ionic/prettier-config",
80
80
  "swiftlint": "@ionic/swiftlint-config",