From 7f5287062e601e7beee7c154c6fbf803fac1ae44 Mon Sep 17 00:00:00 2001 From: martindonadieu Date: Sun, 28 Aug 2022 13:52:27 +0100 Subject: [PATCH] fix: disable delete active --- .../main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java | 3 ++- ios/Plugin/CapacitorUpdater.swift | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java b/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java index ddfdfe15..adc0c672 100644 --- a/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +++ b/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java @@ -261,7 +261,8 @@ public List list() { public Boolean delete(final String id, final Boolean removeInfo) throws IOException { final BundleInfo deleted = this.getBundleInfo(id); - if (deleted.isBuiltin()) { + if (deleted.isBuiltin() || self.getCurrentBundleId() == id) { + Log.e(TAG, "Cannot delete " + id); return false; } final File bundle = new File(this.documentsDir, bundleDirectory + "/" + id); diff --git a/ios/Plugin/CapacitorUpdater.swift b/ios/Plugin/CapacitorUpdater.swift index 1b6de187..7608bdda 100644 --- a/ios/Plugin/CapacitorUpdater.swift +++ b/ios/Plugin/CapacitorUpdater.swift @@ -343,7 +343,8 @@ extension CustomError: LocalizedError { public func delete(id: String, removeInfo: Bool) -> Bool { let deleted: BundleInfo = self.getBundleInfo(id: id) - if (deleted.isBuiltin()) { + if (deleted.isBuiltin() || self.getCurrentBundleId() == id) { + print("\(self.TAG) Cannot delete \(id)") return false } let destHot = documentsDir.appendingPathComponent(bundleDirectoryHot).appendingPathComponent(id)