@capgo/capacitor-updater 7.27.5 → 7.27.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.
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +8 -8
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +5 -4
- package/package.json +1 -1
|
@@ -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 = "7.27.
|
|
74
|
+
private final String pluginVersion = "7.27.7";
|
|
75
75
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
76
76
|
|
|
77
77
|
private SharedPreferences.Editor editor;
|
|
@@ -439,11 +439,11 @@ public class CapgoUpdater {
|
|
|
439
439
|
this.flattenAssets(downloaded, idName);
|
|
440
440
|
downloaded.delete();
|
|
441
441
|
}
|
|
442
|
-
this.notifyDownload(id, 100);
|
|
443
442
|
// Remove old bundle info and set new one
|
|
444
443
|
this.saveBundleInfo(id, null);
|
|
445
444
|
BundleInfo next = new BundleInfo(id, version, BundleStatus.PENDING, new Date(System.currentTimeMillis()), checksum);
|
|
446
445
|
this.saveBundleInfo(id, next);
|
|
446
|
+
this.notifyDownload(id, 100);
|
|
447
447
|
|
|
448
448
|
final Map<String, Object> ret = new HashMap<>();
|
|
449
449
|
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 = "7.27.
|
|
57
|
+
private let pluginVersion: String = "7.27.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"
|
|
@@ -371,14 +371,14 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
371
371
|
UserDefaults.standard.synchronize()
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
@objc func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false) {
|
|
375
|
-
let
|
|
376
|
-
self.notifyListeners("download", data: ["percent": percent, "bundle":
|
|
374
|
+
@objc func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false, bundle: BundleInfo? = nil) {
|
|
375
|
+
let bundleInfo = bundle ?? self.implementation.getBundleInfo(id: id)
|
|
376
|
+
self.notifyListeners("download", data: ["percent": percent, "bundle": bundleInfo.toJSON()])
|
|
377
377
|
if percent == 100 {
|
|
378
|
-
self.notifyListeners("downloadComplete", data: ["bundle":
|
|
379
|
-
self.implementation.sendStats(action: "download_complete", versionName:
|
|
378
|
+
self.notifyListeners("downloadComplete", data: ["bundle": bundleInfo.toJSON()])
|
|
379
|
+
self.implementation.sendStats(action: "download_complete", versionName: bundleInfo.getVersionName())
|
|
380
380
|
} else if percent.isMultiple(of: 10) || ignoreMultipleOfTen {
|
|
381
|
-
self.implementation.sendStats(action: "download_\(percent)", versionName:
|
|
381
|
+
self.implementation.sendStats(action: "download_\(percent)", versionName: bundleInfo.getVersionName())
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
|
|
@@ -519,7 +519,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
519
519
|
self.logger.error("Failed to download from: \(String(describing: url)) \(error.localizedDescription)")
|
|
520
520
|
self.notifyListeners("downloadFailed", data: ["version": version])
|
|
521
521
|
self.implementation.sendStats(action: "download_fail")
|
|
522
|
-
call.reject("Failed to download from: \(url!)
|
|
522
|
+
call.reject("Failed to download from: \(url!) - \(error.localizedDescription)")
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
@@ -60,9 +60,9 @@ import UIKit
|
|
|
60
60
|
return Session(configuration: configuration)
|
|
61
61
|
}()
|
|
62
62
|
|
|
63
|
-
public var notifyDownloadRaw: (String, Int, Bool) -> Void = { _, _, _ in }
|
|
64
|
-
public func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false) {
|
|
65
|
-
notifyDownloadRaw(id, percent, ignoreMultipleOfTen)
|
|
63
|
+
public var notifyDownloadRaw: (String, Int, Bool, BundleInfo?) -> Void = { _, _, _, _ in }
|
|
64
|
+
public func notifyDownload(id: String, percent: Int, ignoreMultipleOfTen: Bool = false, bundle: BundleInfo? = nil) {
|
|
65
|
+
notifyDownloadRaw(id, percent, ignoreMultipleOfTen, bundle)
|
|
66
66
|
}
|
|
67
67
|
public var notifyDownload: (String, Int) -> Void = { _, _ in }
|
|
68
68
|
|
|
@@ -559,6 +559,7 @@ import UIKit
|
|
|
559
559
|
// Send stats for manifest download complete
|
|
560
560
|
self.sendStats(action: "download_manifest_complete", versionName: version)
|
|
561
561
|
|
|
562
|
+
self.notifyDownload(id: id, percent: 100, bundle: updatedBundle)
|
|
562
563
|
logger.info("downloadManifest done \(id)")
|
|
563
564
|
return updatedBundle
|
|
564
565
|
}
|
|
@@ -805,7 +806,7 @@ import UIKit
|
|
|
805
806
|
// Send stats for zip download complete
|
|
806
807
|
self.sendStats(action: "download_zip_complete", versionName: version)
|
|
807
808
|
|
|
808
|
-
self.notifyDownload(id: id, percent: 100)
|
|
809
|
+
self.notifyDownload(id: id, percent: 100, bundle: info)
|
|
809
810
|
logger.info("Downloading: 100% (complete)")
|
|
810
811
|
return info
|
|
811
812
|
}
|