Force recreate download index cache on upgrade

Fixes #10187

(cherry picked from commit ccadfc8fe53ff1b8ab66b0e91a4fa5a21481bcda)

# Conflicts:
#	app/build.gradle.kts
This commit is contained in:
arkon 2023-12-03 14:58:08 -05:00 committed by Jobobby04
parent fc5021c79d
commit 3a75f7718a
3 changed files with 10 additions and 1 deletions

View File

@ -419,6 +419,11 @@ object Migrations {
newKey = { Preference.appStateKey(it) }, newKey = { Preference.appStateKey(it) },
) )
} }
if (oldVersion < 111) {
File(context.cacheDir, "dl_index_cache")
.takeIf { it.exists() }
?.delete()
}
return true return true
} }

View File

@ -94,7 +94,7 @@ class DownloadCache(
.stateIn(scope, SharingStarted.WhileSubscribed(), false) .stateIn(scope, SharingStarted.WhileSubscribed(), false)
private val diskCacheFile: File private val diskCacheFile: File
get() = File(context.cacheDir, "dl_index_cache") get() = File(context.cacheDir, "dl_index_cache_v2")
private val rootDownloadsDirLock = Mutex() private val rootDownloadsDirLock = Mutex()
private var rootDownloadsDir = RootDirectory(provider.downloadsDir) private var rootDownloadsDir = RootDirectory(provider.downloadsDir)

View File

@ -665,6 +665,10 @@ object EXHMigrations {
filterPredicate = { it.key in privatePrefsToReplace }, filterPredicate = { it.key in privatePrefsToReplace },
newKey = { Preference.privateKey(it) }, newKey = { Preference.privateKey(it) },
) )
File(context.cacheDir, "dl_index_cache")
.takeIf { it.exists() }
?.delete()
} }
// if (oldVersion under 1) { } (1 is current release version) // if (oldVersion under 1) { } (1 is current release version)