Save storage unconditionally on location set

The storage plugin cannot find USB backups for secondary users if it is not saved before checking if backups exist
This commit is contained in:
Oliver Scott 2022-03-29 14:05:30 +02:00
parent 00e50c76f2
commit 769b65aeb4

View file

@ -24,6 +24,7 @@ internal class RestoreStorageViewModel(
override fun onLocationSet(uri: Uri) {
viewModelScope.launch(Dispatchers.IO) {
saveStorage(uri)
val hasBackup = try {
storagePlugin.hasBackup(uri)
} catch (e: IOException) {
@ -31,7 +32,6 @@ internal class RestoreStorageViewModel(
false
}
if (hasBackup) {
saveStorage(uri)
mLocationChecked.postEvent(LocationResult())
} else {
Log.w(TAG, "Location was rejected: $uri")