@capgo/capacitor-updater 5.2.1 → 5.2.2

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.
@@ -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 = "5.2.1";
58
+ private final String PLUGIN_VERSION = "5.2.2";
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 = "5.2.1"
18
+ private let PLUGIN_VERSION: String = "5.2.2"
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"
@@ -530,20 +530,20 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
530
530
  let latest = self.implementation.getBundleInfoByVersionName(version: latestVersionName)
531
531
  do {
532
532
  print("\(self.implementation.TAG) New bundle: \(latestVersionName) found. Current is: \(current.getVersionName()). Update will occur next time app moves to background.")
533
- let next = self.implementation.getBundleInfoByVersionName(version: latestVersionName)
534
- if next == nil || ((next?.isDeleted()) != nil) {
535
- if (next?.isDeleted()) != nil {
533
+ var nextImpl = self.implementation.getBundleInfoByVersionName(version: latestVersionName)
534
+ if nextImpl == nil || ((nextImpl?.isDeleted()) != nil) {
535
+ if (nextImpl?.isDeleted()) != nil {
536
536
  print("\(self.implementation.TAG) Latest bundle already exists and will be deleted, download will overwrite it.")
537
- let res = self.implementation.delete(id: next!.getId(), removeInfo: true)
538
- if !res {
539
- print("\(self.implementation.TAG) Delete version deleted: \(next!.toString())")
537
+ let res = self.implementation.delete(id: nextImpl!.getId(), removeInfo: true)
538
+ if res {
539
+ print("\(self.implementation.TAG) Delete version deleted: \(nextImpl!.toString())")
540
540
  } else {
541
- print("\(self.implementation.TAG) Failed to delete failed bundle: \(next!.toString())")
541
+ print("\(self.implementation.TAG) Failed to delete failed bundle: \(nextImpl!.toString())")
542
542
  }
543
543
  }
544
- let next = try self.implementation.download(url: downloadUrl, version: latestVersionName, sessionKey: sessionKey)
544
+ nextImpl = try self.implementation.download(url: downloadUrl, version: latestVersionName, sessionKey: sessionKey)
545
545
  }
546
- guard let next = next else {
546
+ guard let next = nextImpl else {
547
547
  print("\(self.implementation.TAG) Error downloading file")
548
548
  self.notifyListeners("downloadFailed", data: ["version": latestVersionName])
549
549
  self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "packageManager": "pnpm@8.6.12",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",