@capgo/capacitor-updater 6.14.23 → 6.14.24
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 +28 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/ios/Plugin/BundleStatus.swift +1 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -315,6 +315,7 @@ public class CapacitorUpdater {
|
|
|
315
315
|
Boolean isManifest
|
|
316
316
|
) {
|
|
317
317
|
File downloaded = null;
|
|
318
|
+
File extractedDir = null;
|
|
318
319
|
String checksum = "";
|
|
319
320
|
|
|
320
321
|
try {
|
|
@@ -339,6 +340,9 @@ public class CapacitorUpdater {
|
|
|
339
340
|
}
|
|
340
341
|
// Remove the decryption for manifest downloads
|
|
341
342
|
} catch (Exception e) {
|
|
343
|
+
if (!isManifest) {
|
|
344
|
+
safeDelete(downloaded);
|
|
345
|
+
}
|
|
342
346
|
final Boolean res = this.delete(id);
|
|
343
347
|
if (!res) {
|
|
344
348
|
Log.i(CapacitorUpdater.TAG, "Double error, cannot cleanup: " + version);
|
|
@@ -354,10 +358,10 @@ public class CapacitorUpdater {
|
|
|
354
358
|
|
|
355
359
|
try {
|
|
356
360
|
if (!isManifest) {
|
|
357
|
-
|
|
361
|
+
extractedDir = this.unzip(id, downloaded, this.randomString());
|
|
358
362
|
this.notifyDownload(id, 91);
|
|
359
363
|
final String idName = bundleDirectory + "/" + id;
|
|
360
|
-
this.flattenAssets(
|
|
364
|
+
this.flattenAssets(extractedDir, idName);
|
|
361
365
|
} else {
|
|
362
366
|
this.notifyDownload(id, 91);
|
|
363
367
|
final String idName = bundleDirectory + "/" + id;
|
|
@@ -381,6 +385,10 @@ public class CapacitorUpdater {
|
|
|
381
385
|
}
|
|
382
386
|
}
|
|
383
387
|
} catch (IOException e) {
|
|
388
|
+
if (!isManifest) {
|
|
389
|
+
safeDelete(extractedDir);
|
|
390
|
+
safeDelete(downloaded);
|
|
391
|
+
}
|
|
384
392
|
e.printStackTrace();
|
|
385
393
|
final JSObject ret = new JSObject();
|
|
386
394
|
ret.put("version", CapacitorUpdater.this.getCurrentBundle().getVersionName());
|
|
@@ -388,6 +396,9 @@ public class CapacitorUpdater {
|
|
|
388
396
|
CapacitorUpdater.this.sendStats("download_fail");
|
|
389
397
|
return false;
|
|
390
398
|
}
|
|
399
|
+
if (!isManifest) {
|
|
400
|
+
safeDelete(downloaded);
|
|
401
|
+
}
|
|
391
402
|
return true;
|
|
392
403
|
}
|
|
393
404
|
|
|
@@ -405,6 +416,21 @@ public class CapacitorUpdater {
|
|
|
405
416
|
}
|
|
406
417
|
}
|
|
407
418
|
|
|
419
|
+
private void safeDelete(final File target) {
|
|
420
|
+
if (target == null || !target.exists()) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
try {
|
|
424
|
+
if (target.isDirectory()) {
|
|
425
|
+
this.deleteDirectory(target);
|
|
426
|
+
} else if (!target.delete()) {
|
|
427
|
+
Log.w(TAG, "Failed to delete file: " + target.getAbsolutePath());
|
|
428
|
+
}
|
|
429
|
+
} catch (IOException cleanupError) {
|
|
430
|
+
Log.w(TAG, "Cleanup failed for " + target.getAbsolutePath() + ": " + cleanupError.getMessage());
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
408
434
|
private void setCurrentBundle(final File bundle) {
|
|
409
435
|
this.editor.putString(WebView.CAP_SERVER_PATH, bundle.getPath());
|
|
410
436
|
Log.i(TAG, "Current bundle set to: " + bundle);
|
|
@@ -57,7 +57,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
57
57
|
private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
|
|
58
58
|
private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
|
|
59
59
|
|
|
60
|
-
private final String PLUGIN_VERSION = "6.14.
|
|
60
|
+
private final String PLUGIN_VERSION = "6.14.24";
|
|
61
61
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
62
62
|
|
|
63
63
|
private SharedPreferences.Editor editor;
|
|
@@ -45,7 +45,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
45
45
|
CAPPluginMethod(name: "getNextBundle", returnType: CAPPluginReturnPromise)
|
|
46
46
|
]
|
|
47
47
|
public var implementation = CapacitorUpdater()
|
|
48
|
-
private let PLUGIN_VERSION: String = "6.14.
|
|
48
|
+
private let PLUGIN_VERSION: String = "6.14.24"
|
|
49
49
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
50
50
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
51
51
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|