diff --git a/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt b/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt index 8e5151c5..b766ed03 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt @@ -33,6 +33,7 @@ class MicrogDownloadService: Service() { private fun downloadMicrog() { runBlocking { launch { + getExternalFilesDir("apk")?.delete() val url = getObjectFromJson( "${PreferenceManager.getDefaultSharedPreferences(this@MicrogDownloadService) .getString("install_url", baseUrl)}/microg.json", "url" diff --git a/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt b/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt index 225647e9..dd6c06ce 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt @@ -41,6 +41,7 @@ class VancedDownloadService: Service() { val context = this runBlocking { launch { + getExternalFilesDir("apks")?.delete() val defPrefs = PreferenceManager.getDefaultSharedPreferences(context) val installUrl = defPrefs.getString("install_url", baseUrl) val vancedVer = getObjectFromJson("$installUrl/vanced.json", "version") diff --git a/app/src/main/java/com/vanced/manager/ui/fragments/SettingsFragment.kt b/app/src/main/java/com/vanced/manager/ui/fragments/SettingsFragment.kt index 0c1aaed0..7986c446 100644 --- a/app/src/main/java/com/vanced/manager/ui/fragments/SettingsFragment.kt +++ b/app/src/main/java/com/vanced/manager/ui/fragments/SettingsFragment.kt @@ -91,6 +91,15 @@ class SettingsFragment : PreferenceFragmentCompat() { true } + findPreference("clear_files")?.setOnPreferenceClickListener { + with(requireActivity()) { + getExternalFilesDir("apk")?.delete() + getExternalFilesDir("apks")?.delete() + Toast.makeText(this, getString(R.string.cleared_files), Toast.LENGTH_SHORT) + } + true + } + } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c148fb91..45a791dc 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,12 +49,14 @@ Purple Red Yellow - Check for updates Interface Manager + Check for updates Chosen installation preferences Language(s): %1$s Theme: %1$s + Clear downloaded files + Successfully cleared files Use Chrome Custom Tabs Links will open in Chrome Custom Tabs Links will open in an External Browser diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 57424920..135f1973 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -67,6 +67,10 @@ android:title="@string/update_url" android:key="install_url" /> + + \ No newline at end of file