@capgo/capacitor-updater 5.3.5 → 5.3.7

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.
@@ -322,7 +322,7 @@ public class CapacitorUpdater {
322
322
  }
323
323
  };
324
324
 
325
- public void finishDownload(
325
+ public Boolean finishDownload(
326
326
  String id,
327
327
  String dest,
328
328
  String version,
@@ -393,7 +393,9 @@ public class CapacitorUpdater {
393
393
  "download_fail",
394
394
  CapacitorUpdater.this.getCurrentBundle().getVersionName()
395
395
  );
396
+ return false;
396
397
  }
398
+ return true;
397
399
  }
398
400
 
399
401
  private void downloadFileBackground(
@@ -592,11 +594,15 @@ public class CapacitorUpdater {
592
594
  this.notifyDownload(id, 5);
593
595
  final String dest = this.randomString(10);
594
596
  final File downloaded = this.downloadFile(id, url, dest);
595
- this.finishDownload(id, dest, version, sessionKey, checksum, false);
597
+ final Boolean finished =
598
+ this.finishDownload(id, dest, version, sessionKey, checksum, false);
599
+ final BundleStatus status = finished
600
+ ? BundleStatus.PENDING
601
+ : BundleStatus.ERROR;
596
602
  BundleInfo info = new BundleInfo(
597
603
  id,
598
604
  version,
599
- BundleStatus.PENDING,
605
+ status,
600
606
  new Date(System.currentTimeMillis()),
601
607
  checksum
602
608
  );
@@ -58,7 +58,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
58
58
  private static final String channelUrlDefault =
59
59
  "https://api.capgo.app/channel_self";
60
60
 
61
- private final String PLUGIN_VERSION = "5.3.5";
61
+ private final String PLUGIN_VERSION = "5.3.7";
62
62
  private static final String DELAY_CONDITION_PREFERENCES = "";
63
63
 
64
64
  private SharedPreferences.Editor editor;
@@ -522,8 +522,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
522
522
  sessionKey,
523
523
  checksum
524
524
  );
525
-
526
- call.resolve(downloaded.toJSON());
525
+ if (downloaded.isErrorStatus()) {
526
+ throw new RuntimeException(
527
+ "Download failed: " + downloaded.getStatus()
528
+ );
529
+ } else {
530
+ call.resolve(downloaded.toJSON());
531
+ }
527
532
  } catch (final IOException e) {
528
533
  Log.e(CapacitorUpdater.TAG, "Failed to download from: " + url, e);
529
534
  call.reject("Failed to download from: " + url, e);
@@ -15,7 +15,7 @@ import Version
15
15
  @objc(CapacitorUpdaterPlugin)
16
16
  public class CapacitorUpdaterPlugin: CAPPlugin {
17
17
  public var implementation = CapacitorUpdater()
18
- private let PLUGIN_VERSION: String = "5.3.5"
18
+ private let PLUGIN_VERSION: String = "5.3.7"
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "5.3.5",
3
+ "version": "5.3.7",
4
4
  "packageManager": "pnpm@8.8.0",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",