diff --git a/src/main/kotlin/com/machiav3lli/fdroid/installer/DefaultInstaller.kt b/src/main/kotlin/com/machiav3lli/fdroid/installer/DefaultInstaller.kt index 97784a3f..522a382c 100644 --- a/src/main/kotlin/com/machiav3lli/fdroid/installer/DefaultInstaller.kt +++ b/src/main/kotlin/com/machiav3lli/fdroid/installer/DefaultInstaller.kt @@ -6,6 +6,7 @@ import android.content.Intent import android.content.pm.PackageInstaller.SessionParams import android.util.Log import com.machiav3lli.fdroid.content.Cache +import com.machiav3lli.fdroid.content.Preferences import com.machiav3lli.fdroid.utility.extension.android.Android import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -111,7 +112,7 @@ class DefaultInstaller(context: Context) : BaseInstaller(context) { if (!hasErrors) { session.commit(PendingIntent.getService(context, id, intent, flags).intentSender) - cacheFile.delete() + if (Preferences[Preferences.Key.ReleasesCacheRetention] == 0) cacheFile.delete() } } diff --git a/src/main/kotlin/com/machiav3lli/fdroid/installer/RootInstaller.kt b/src/main/kotlin/com/machiav3lli/fdroid/installer/RootInstaller.kt index 4345584d..455f02da 100644 --- a/src/main/kotlin/com/machiav3lli/fdroid/installer/RootInstaller.kt +++ b/src/main/kotlin/com/machiav3lli/fdroid/installer/RootInstaller.kt @@ -116,7 +116,10 @@ class RootInstaller(context: Context) : BaseInstaller(context) { } else { Shell.su(cacheFile.install) - .submit { if (it.isSuccess) Shell.su(cacheFile.deletePackage).submit() } + .submit { + if (it.isSuccess && Preferences[Preferences.Key.ReleasesCacheRetention] == 0) + Shell.su(cacheFile.deletePackage).submit() + } } } }