@capgo/capacitor-updater 6.25.6 → 6.25.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.
@@ -71,7 +71,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
71
71
  private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
72
72
  private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
73
73
 
74
- private final String pluginVersion = "6.25.6";
74
+ private final String pluginVersion = "6.25.7";
75
75
  private static final String DELAY_CONDITION_PREFERENCES = "";
76
76
 
77
77
  private SharedPreferences.Editor editor;
@@ -446,11 +446,11 @@ public class CapgoUpdater {
446
446
  this.flattenAssets(downloaded, idName);
447
447
  downloaded.delete();
448
448
  }
449
- this.notifyDownload(id, 100);
450
449
  // Remove old bundle info and set new one
451
450
  this.saveBundleInfo(id, null);
452
451
  BundleInfo next = new BundleInfo(id, version, BundleStatus.PENDING, new Date(System.currentTimeMillis()), checksum);
453
452
  this.saveBundleInfo(id, next);
453
+ this.notifyDownload(id, 100);
454
454
 
455
455
  final Map<String, Object> ret = new HashMap<>();
456
456
  ret.put("bundle", next.toJSONMap());
@@ -54,7 +54,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
54
54
  CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
55
55
  ]
56
56
  public var implementation = CapgoUpdater()
57
- private let pluginVersion: String = "6.25.6"
57
+ private let pluginVersion: String = "6.25.7"
58
58
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
59
59
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
60
60
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
@@ -377,14 +377,14 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
377
377
  UserDefaults.standard.synchronize()
378
378
  }
379
379
 
380
- @objc func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false) {
381
- let bundle = self.implementation.getBundleInfo(id: id)
382
- self.notifyListeners("download", data: ["percent": percent, "bundle": bundle.toJSON()])
380
+ @objc func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false, bundle: BundleInfo? = nil) {
381
+ let bundleInfo = bundle ?? self.implementation.getBundleInfo(id: id)
382
+ self.notifyListeners("download", data: ["percent": percent, "bundle": bundleInfo.toJSON()])
383
383
  if percent == 100 {
384
- self.notifyListeners("downloadComplete", data: ["bundle": bundle.toJSON()])
385
- self.implementation.sendStats(action: "download_complete", versionName: bundle.getVersionName())
384
+ self.notifyListeners("downloadComplete", data: ["bundle": bundleInfo.toJSON()])
385
+ self.implementation.sendStats(action: "download_complete", versionName: bundleInfo.getVersionName())
386
386
  } else if percent.isMultiple(of: 10) || ignoreMultipleOfTen {
387
- self.implementation.sendStats(action: "download_\(percent)", versionName: bundle.getVersionName())
387
+ self.implementation.sendStats(action: "download_\(percent)", versionName: bundleInfo.getVersionName())
388
388
  }
389
389
  }
390
390
 
@@ -62,9 +62,9 @@ import UIKit
62
62
  return Session(configuration: configuration)
63
63
  }()
64
64
 
65
- public var notifyDownloadRaw: (String, Int, Bool) -> Void = { _, _, _ in }
66
- public func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false) {
67
- notifyDownloadRaw(id, percent, ignoreMultipleOfTen)
65
+ public var notifyDownloadRaw: (String, Int, Bool, BundleInfo?) -> Void = { _, _, _, _ in }
66
+ public func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false, bundle: BundleInfo? = nil) {
67
+ notifyDownloadRaw(id, percent, ignoreMultipleOfTen, bundle)
68
68
  }
69
69
  public var notifyDownload: (String, Int) -> Void = { _, _ in }
70
70
 
@@ -576,6 +576,7 @@ import UIKit
576
576
  // Send stats for manifest download complete
577
577
  self.sendStats(action: "download_manifest_complete", versionName: version)
578
578
 
579
+ self.notifyDownload(id: id, percent: 100, bundle: updatedBundle)
579
580
  logger.info("downloadManifest done \(id)")
580
581
  return updatedBundle
581
582
  }
@@ -828,7 +829,7 @@ import UIKit
828
829
  // Send stats for zip download complete
829
830
  self.sendStats(action: "download_zip_complete", versionName: version)
830
831
 
831
- self.notifyDownload(id: id, percent: 100)
832
+ self.notifyDownload(id: id, percent: 100, bundle: info)
832
833
  logger.info("Downloading: 100% (complete)")
833
834
  return info
834
835
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "6.25.6",
3
+ "version": "6.25.7",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",