mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-19 14:10:38 -04:00
Get all mirrors before deleting repo
1. Get ALL mirrors and not just the non-disabled ones. 2. Get them freshly before deleting the repo (in the very rare/should-not-happen case that they have changed since the ViewModel was created). Follow-up to fdroid/fdroidclient!1499
This commit is contained in:
committed by
Torsten Grote
parent
0fd81915e7
commit
f61e9971ab
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user