From d7910a84b44164134e954481fa67ccfe47234c4d Mon Sep 17 00:00:00 2001 From: Oliver Scott Date: Tue, 29 Mar 2022 14:05:30 +0200 Subject: [PATCH] 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 --- .../stevesoltys/seedvault/ui/storage/RestoreStorageViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/RestoreStorageViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/RestoreStorageViewModel.kt index 011e1e10..b42473f1 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/RestoreStorageViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/RestoreStorageViewModel.kt @@ -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")