From a5ec4f5ed512255ed00cb0e2d74c7e3b8b1ace4f Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 18 Nov 2022 16:18:07 -0500 Subject: [PATCH] Allow deletion of managed sites on Android (#94) --- .../app/src/main/kotlin/net/defined/mobile_nebula/Sites.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/kotlin/net/defined/mobile_nebula/Sites.kt b/android/app/src/main/kotlin/net/defined/mobile_nebula/Sites.kt index 227a5c0..7517d86 100644 --- a/android/app/src/main/kotlin/net/defined/mobile_nebula/Sites.kt +++ b/android/app/src/main/kotlin/net/defined/mobile_nebula/Sites.kt @@ -49,7 +49,11 @@ class Sites(private var engine: FlutterEngine) { } fun deleteSite(id: String) { - val siteDir = MainActivity.getContext()!!.filesDir.resolve("sites").resolve(id) + val context = MainActivity.getContext()!! + val site = containers[id]!!.site + + val baseDir = if(site.managed == true) context.noBackupFilesDir else context.filesDir + val siteDir = baseDir.resolve("sites").resolve(id) siteDir.deleteRecursively() refreshSites() //TODO: make sure you stop the vpn