@capgo/capacitor-updater 7.15.2 → 7.15.3
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.
|
@@ -58,7 +58,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
58
58
|
private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
|
|
59
59
|
private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
|
|
60
60
|
|
|
61
|
-
private final String PLUGIN_VERSION = "7.15.
|
|
61
|
+
private final String PLUGIN_VERSION = "7.15.3";
|
|
62
62
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
63
63
|
|
|
64
64
|
private SharedPreferences.Editor editor;
|
|
@@ -354,6 +354,7 @@ public class CapgoUpdater {
|
|
|
354
354
|
Boolean isManifest
|
|
355
355
|
) {
|
|
356
356
|
File downloaded = null;
|
|
357
|
+
File extractedDir = null;
|
|
357
358
|
String checksum = "";
|
|
358
359
|
|
|
359
360
|
try {
|
|
@@ -385,6 +386,9 @@ public class CapgoUpdater {
|
|
|
385
386
|
}
|
|
386
387
|
// Remove the decryption for manifest downloads
|
|
387
388
|
} catch (Exception e) {
|
|
389
|
+
if (!isManifest) {
|
|
390
|
+
safeDelete(downloaded);
|
|
391
|
+
}
|
|
388
392
|
final Boolean res = this.delete(id);
|
|
389
393
|
if (!res) {
|
|
390
394
|
logger.info("Double error, cannot cleanup: " + version);
|
|
@@ -400,10 +404,10 @@ public class CapgoUpdater {
|
|
|
400
404
|
|
|
401
405
|
try {
|
|
402
406
|
if (!isManifest) {
|
|
403
|
-
|
|
407
|
+
extractedDir = this.unzip(id, downloaded, this.randomString());
|
|
404
408
|
this.notifyDownload(id, 91);
|
|
405
409
|
final String idName = bundleDirectory + "/" + id;
|
|
406
|
-
this.flattenAssets(
|
|
410
|
+
this.flattenAssets(extractedDir, idName);
|
|
407
411
|
} else {
|
|
408
412
|
this.notifyDownload(id, 91);
|
|
409
413
|
final String idName = bundleDirectory + "/" + id;
|
|
@@ -431,6 +435,10 @@ public class CapgoUpdater {
|
|
|
431
435
|
}
|
|
432
436
|
}
|
|
433
437
|
} catch (IOException e) {
|
|
438
|
+
if (!isManifest) {
|
|
439
|
+
safeDelete(extractedDir);
|
|
440
|
+
safeDelete(downloaded);
|
|
441
|
+
}
|
|
434
442
|
e.printStackTrace();
|
|
435
443
|
final Map<String, Object> ret = new HashMap<>();
|
|
436
444
|
ret.put("version", version);
|
|
@@ -438,6 +446,9 @@ public class CapgoUpdater {
|
|
|
438
446
|
CapgoUpdater.this.sendStats("download_fail");
|
|
439
447
|
return false;
|
|
440
448
|
}
|
|
449
|
+
if (!isManifest) {
|
|
450
|
+
safeDelete(downloaded);
|
|
451
|
+
}
|
|
441
452
|
return true;
|
|
442
453
|
}
|
|
443
454
|
|
|
@@ -455,6 +466,21 @@ public class CapgoUpdater {
|
|
|
455
466
|
}
|
|
456
467
|
}
|
|
457
468
|
|
|
469
|
+
private void safeDelete(final File target) {
|
|
470
|
+
if (target == null || !target.exists()) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
try {
|
|
474
|
+
if (target.isDirectory()) {
|
|
475
|
+
this.deleteDirectory(target);
|
|
476
|
+
} else if (!target.delete()) {
|
|
477
|
+
logger.warn("Failed to delete file: " + target.getAbsolutePath());
|
|
478
|
+
}
|
|
479
|
+
} catch (IOException cleanupError) {
|
|
480
|
+
logger.warn("Cleanup failed for " + target.getAbsolutePath() + ": " + cleanupError.getMessage());
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
458
484
|
private void setCurrentBundle(final File bundle) {
|
|
459
485
|
this.editor.putString(this.CAP_SERVER_PATH, bundle.getPath());
|
|
460
486
|
logger.info("Current bundle set to: " + bundle);
|
|
@@ -50,7 +50,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
50
50
|
CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
|
|
51
51
|
]
|
|
52
52
|
public var implementation = CapgoUpdater()
|
|
53
|
-
private let PLUGIN_VERSION: String = "7.15.
|
|
53
|
+
private let PLUGIN_VERSION: String = "7.15.3"
|
|
54
54
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
55
55
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
56
56
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|