Merge branch 'dns-cache' into 'master'

Get all mirrors before deleting repo

See merge request fdroid/fdroidclient!1507
This commit is contained in:
Torsten Grote
2025-02-13 13:56:39 +00:00

View File

@@ -61,7 +61,6 @@ class RepoDetailsViewModel(
}
private val repoId = initialRepo.repoId
private val repoMirrors = initialRepo.getMirrors()
private val repoManager = FDroidApp.getRepoManager(app)
private val appDao = DBHelper.getDb(app).getAppDao()
@@ -104,14 +103,13 @@ class RepoDetailsViewModel(
}
fun deleteRepository() {
val cache = DnsCache.get()
val mirrors = repoFlow.value?.getAllMirrors() ?: emptyList()
mirrors.forEach { cache.remove(it.url.host) }
viewModelScope.launch(Dispatchers.IO) {
repoManager.deleteRepository(repoId)
}
// clean up dns cache
val cache = DnsCache.get()
for (mirror in repoMirrors) {
cache.remove(mirror.url.host)
}
}
fun updateUsernameAndPassword(username: String, password: String) {