@capgo/capacitor-updater 4.0.0-alpha.50 → 4.0.0-alpha.53
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/CapacitorUpdater.java +5 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +6 -3
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ public class CapacitorUpdater {
|
|
|
47
47
|
private static final String bundleDirectory = "versions";
|
|
48
48
|
|
|
49
49
|
public static final String TAG = "Capacitor-updater";
|
|
50
|
-
public static final String pluginVersion = "4.0.0-alpha.
|
|
50
|
+
public static final String pluginVersion = "4.0.0-alpha.53";
|
|
51
51
|
|
|
52
52
|
public SharedPreferences.Editor editor;
|
|
53
53
|
public SharedPreferences prefs;
|
|
@@ -261,6 +261,9 @@ public class CapacitorUpdater {
|
|
|
261
261
|
|
|
262
262
|
public Boolean delete(final String id, final Boolean removeInfo) throws IOException {
|
|
263
263
|
final BundleInfo deleted = this.getBundleInfo(id);
|
|
264
|
+
if (deleted.isBuiltin()) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
264
267
|
final File bundle = new File(this.documentsDir, bundleDirectory + "/" + id);
|
|
265
268
|
if (bundle.exists()) {
|
|
266
269
|
this.deleteDirectory(bundle);
|
|
@@ -320,8 +323,8 @@ public class CapacitorUpdater {
|
|
|
320
323
|
this.setBundleStatus(bundle.getId(), BundleStatus.SUCCESS);
|
|
321
324
|
final BundleInfo fallback = this.getFallbackBundle();
|
|
322
325
|
Log.d(CapacitorUpdater.TAG, "Fallback bundle is: " + fallback);
|
|
326
|
+
Log.i(CapacitorUpdater.TAG, "Version successfully loaded: " + bundle.getVersionName());
|
|
323
327
|
if(autoDeletePrevious && !fallback.isBuiltin()) {
|
|
324
|
-
Log.i(CapacitorUpdater.TAG, "Version successfully loaded: " + bundle.getVersionName());
|
|
325
328
|
try {
|
|
326
329
|
final Boolean res = this.delete(fallback.getId());
|
|
327
330
|
if (res) {
|
|
@@ -678,7 +678,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
678
678
|
this.implementation.sendStats("update_fail", current.getVersionName());
|
|
679
679
|
this.implementation.setError(current);
|
|
680
680
|
this._reset(true);
|
|
681
|
-
if (CapacitorUpdaterPlugin.this.autoDeleteFailed) {
|
|
681
|
+
if (CapacitorUpdaterPlugin.this.autoDeleteFailed && !current.isBuiltin()) {
|
|
682
682
|
Log.i(CapacitorUpdater.TAG, "Deleting failing bundle: " + current.getVersionName());
|
|
683
683
|
try {
|
|
684
684
|
final Boolean res = this.implementation.delete(current.getId(), false);
|
|
@@ -146,7 +146,7 @@ extension CustomError: LocalizedError {
|
|
|
146
146
|
|
|
147
147
|
public let TAG = "✨ Capacitor-updater:";
|
|
148
148
|
public let CAP_SERVER_PATH = "serverBasePath"
|
|
149
|
-
public let pluginVersion = "4.0.0-alpha.
|
|
149
|
+
public let pluginVersion = "4.0.0-alpha.53"
|
|
150
150
|
public var statsUrl = ""
|
|
151
151
|
public var appId = ""
|
|
152
152
|
public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
|
@@ -343,6 +343,9 @@ extension CustomError: LocalizedError {
|
|
|
343
343
|
|
|
344
344
|
public func delete(id: String, removeInfo: Bool) -> Bool {
|
|
345
345
|
let deleted: BundleInfo = self.getBundleInfo(id: id)
|
|
346
|
+
if (deleted.isBuiltin()) {
|
|
347
|
+
return false
|
|
348
|
+
}
|
|
346
349
|
let destHot = documentsDir.appendingPathComponent(bundleDirectoryHot).appendingPathComponent(id)
|
|
347
350
|
let destPersist = libraryDir.appendingPathComponent(bundleDirectory).appendingPathComponent(id)
|
|
348
351
|
do {
|
|
@@ -430,8 +433,8 @@ extension CustomError: LocalizedError {
|
|
|
430
433
|
self.setBundleStatus(id: bundle.getId(), status: BundleStatus.SUCCESS)
|
|
431
434
|
let fallback: BundleInfo = self.getFallbackBundle()
|
|
432
435
|
print("\(self.TAG) Fallback bundle is: \(fallback.toString())")
|
|
433
|
-
|
|
434
|
-
|
|
436
|
+
print("\(self.TAG) Version successfully loaded: \(bundle.toString())")
|
|
437
|
+
if(autoDeletePrevious && !fallback.isBuiltin()) {
|
|
435
438
|
let res = self.delete(id: fallback.getId())
|
|
436
439
|
if (res) {
|
|
437
440
|
print("\(self.TAG) Deleted previous bundle: \(fallback.toString())")
|
|
@@ -341,7 +341,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
341
341
|
self.implementation.sendStats(action: "update_fail", versionName: current.getVersionName())
|
|
342
342
|
self.implementation.setError(bundle: current)
|
|
343
343
|
_ = self._reset(toLastSuccessful: true)
|
|
344
|
-
if (self.autoDeleteFailed) {
|
|
344
|
+
if (self.autoDeleteFailed && !current.isBuiltin()) {
|
|
345
345
|
print("\(self.implementation.TAG) Deleting failing bundle: \(current.toString())")
|
|
346
346
|
let res = self.implementation.delete(id: current.getId(), removeInfo: false)
|
|
347
347
|
if (!res) {
|