@capgo/capacitor-updater 8.43.3 → 8.43.4

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.
@@ -84,7 +84,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
84
84
  private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
85
85
  private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
86
86
 
87
- private final String pluginVersion = "8.43.3";
87
+ private final String pluginVersion = "8.43.4";
88
88
  private static final String DELAY_CONDITION_PREFERENCES = "";
89
89
 
90
90
  private SharedPreferences.Editor editor;
@@ -1179,8 +1179,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
1179
1179
  final BundleInfo downloaded;
1180
1180
  if (manifest != null) {
1181
1181
  // For manifest downloads, we need to handle this asynchronously
1182
- // since there's no synchronous downloadManifest method in Java
1183
- CapacitorUpdaterPlugin.this.implementation.downloadBackground(url, version, sessionKey, checksum, manifest);
1182
+ // to avoid automatically scheduling/applying the downloaded bundle.
1183
+ // Manual download must not schedule/apply the bundle automatically.
1184
+ CapacitorUpdaterPlugin.this.implementation.downloadBackground(url, version, sessionKey, checksum, manifest, false);
1184
1185
  // Return immediately with a pending status - the actual result will come via listeners
1185
1186
  final String id = CapacitorUpdaterPlugin.this.implementation.randomString();
1186
1187
  downloaded = new BundleInfo(id, version, BundleStatus.DOWNLOADING, new Date(System.currentTimeMillis()), "");
@@ -345,7 +345,7 @@ public class CapgoUpdater {
345
345
  }
346
346
  }
347
347
 
348
- private void observeWorkProgress(Context context, String id) {
348
+ private void observeWorkProgress(Context context, String id, boolean setNext) {
349
349
  if (!(context instanceof LifecycleOwner)) {
350
350
  logger.error("Context is not a LifecycleOwner, cannot observe work progress");
351
351
  return;
@@ -375,7 +375,7 @@ public class CapgoUpdater {
375
375
  boolean isManifest = outputData.getBoolean(DownloadService.IS_MANIFEST, false);
376
376
 
377
377
  io.execute(() -> {
378
- boolean success = finishDownload(id, dest, version, sessionKey, checksum, true, isManifest);
378
+ boolean success = finishDownload(id, dest, version, sessionKey, checksum, setNext, isManifest);
379
379
  BundleInfo resultBundle;
380
380
  if (!success) {
381
381
  logger.error("Finish download failed");
@@ -454,13 +454,14 @@ public class CapgoUpdater {
454
454
  final String version,
455
455
  final String sessionKey,
456
456
  final String checksum,
457
- final JSONArray manifest
457
+ final JSONArray manifest,
458
+ final boolean setNext
458
459
  ) {
459
460
  if (this.activity == null) {
460
461
  logger.error("Activity is null, cannot observe work progress");
461
462
  return;
462
463
  }
463
- observeWorkProgress(this.activity, id);
464
+ observeWorkProgress(this.activity, id, setNext);
464
465
 
465
466
  DownloadWorkerManager.enqueueDownload(
466
467
  this.activity,
@@ -763,6 +764,17 @@ public class CapgoUpdater {
763
764
  final String sessionKey,
764
765
  final String checksum,
765
766
  final JSONArray manifest
767
+ ) {
768
+ downloadBackground(url, version, sessionKey, checksum, manifest, true);
769
+ }
770
+
771
+ public void downloadBackground(
772
+ final String url,
773
+ final String version,
774
+ final String sessionKey,
775
+ final String checksum,
776
+ final JSONArray manifest,
777
+ final boolean setNext
766
778
  ) {
767
779
  final String id = this.randomString();
768
780
 
@@ -784,7 +796,7 @@ public class CapgoUpdater {
784
796
  this.notifyDownload(id, 0);
785
797
  this.notifyDownload(id, 5);
786
798
 
787
- this.download(id, url, this.randomString(), version, sessionKey, checksum, manifest);
799
+ this.download(id, url, this.randomString(), version, sessionKey, checksum, manifest, setNext);
788
800
  }
789
801
 
790
802
  public BundleInfo download(final String url, final String version, final String sessionKey, final String checksum) throws IOException {
@@ -806,7 +818,7 @@ public class CapgoUpdater {
806
818
  downloadFutures.put(id, downloadFuture);
807
819
 
808
820
  // Start the download
809
- this.download(id, url, dest, version, sessionKey, checksum, null);
821
+ this.download(id, url, dest, version, sessionKey, checksum, null, false);
810
822
 
811
823
  // Wait for completion without timeout
812
824
  try {
@@ -858,7 +870,7 @@ public class CapgoUpdater {
858
870
  downloadFutures.put(id, downloadFuture);
859
871
 
860
872
  // Start the download
861
- this.download(id, url, dest, version, sessionKey, checksum, manifest);
873
+ this.download(id, url, dest, version, sessionKey, checksum, manifest, false);
862
874
 
863
875
  // Wait for completion without timeout
864
876
  try {
@@ -73,7 +73,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
73
73
  CAPPluginMethod(name: "completeFlexibleUpdate", returnType: CAPPluginReturnPromise)
74
74
  ]
75
75
  public var implementation = CapgoUpdater()
76
- private let pluginVersion: String = "8.43.3"
76
+ private let pluginVersion: String = "8.43.4"
77
77
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
78
78
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
79
79
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "8.43.3",
3
+ "version": "8.43.4",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",