From 18d83767b3e97075ddb962fa23b15b857ec4bd33 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 7 Aug 2020 16:57:27 -0300 Subject: [PATCH] Check for loading cursor also when checking if files exist Loading cursors can happen with cloud-based documents providers such as Nextcloud. When they return a cursor that is still loading, we might continue with stale information. So now we wait for a loading cursor to be fully loaded before continuing. --- .gitignore | 3 +- .idea/runConfigurations.xml | 12 ++ .idea/runConfigurations/Unit_Tests.xml | 17 ++ app/build.gradle | 6 +- .../seedvault/DocumentsStorageTest.kt | 73 ------- .../com/stevesoltys/seedvault/PluginTest.kt | 60 +++--- .../plugins/saf/DocumentsStorageTest.kt | 174 ++++++++++++++++ .../saf/DocumentsProviderBackupPlugin.kt | 21 +- .../saf/DocumentsProviderFullBackup.kt | 8 +- .../saf/DocumentsProviderFullRestorePlugin.kt | 4 +- .../plugins/saf/DocumentsProviderKVBackup.kt | 14 +- .../saf/DocumentsProviderKVRestorePlugin.kt | 2 +- .../plugins/saf/DocumentsProviderModule.kt | 2 +- .../saf/DocumentsProviderRestorePlugin.kt | 20 +- .../seedvault/plugins/saf/DocumentsStorage.kt | 197 +++++++++++------- .../seedvault/restore/RestoreViewModel.kt | 3 +- .../transport/ConfigurableBackupTransport.kt | 43 ++-- .../seedvault/transport/backup/ApkBackup.kt | 2 +- .../transport/backup/BackupCoordinator.kt | 25 ++- .../transport/backup/BackupPlugin.kt | 6 +- .../seedvault/transport/backup/FullBackup.kt | 13 +- .../transport/backup/FullBackupPlugin.kt | 2 +- .../seedvault/transport/backup/KVBackup.kt | 5 +- .../transport/backup/KVBackupPlugin.kt | 4 +- .../transport/restore/FullRestore.kt | 6 +- .../transport/restore/FullRestorePlugin.kt | 4 +- .../seedvault/transport/restore/KVRestore.kt | 2 +- .../transport/restore/KVRestorePlugin.kt | 2 +- .../transport/restore/RestoreCoordinator.kt | 7 +- .../transport/restore/RestorePlugin.kt | 7 +- .../ui/storage/RestoreStorageViewModel.kt | 32 ++- .../com/stevesoltys/seedvault/TestUtils.kt | 27 +++ .../transport/CoordinatorIntegrationTest.kt | 43 ++-- .../transport/backup/ApkBackupTest.kt | 23 +- .../transport/backup/BackupCoordinatorTest.kt | 70 ++++--- .../transport/backup/FullBackupTest.kt | 37 ++-- .../transport/backup/KVBackupTest.kt | 39 ++-- .../transport/restore/ApkRestoreTest.kt | 12 +- .../transport/restore/FullRestoreTest.kt | 41 ++-- .../transport/restore/KVRestoreTest.kt | 7 +- .../restore/RestoreCoordinatorTest.kt | 48 +++-- 41 files changed, 695 insertions(+), 428 deletions(-) create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/runConfigurations/Unit_Tests.xml delete mode 100644 app/src/androidTest/java/com/stevesoltys/seedvault/DocumentsStorageTest.kt create mode 100644 app/src/androidTest/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorageTest.kt diff --git a/.gitignore b/.gitignore index 8e59b12e..9e827658 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ hs_err_pid* ## Intellij out/ lib/ -.idea/ +.idea/* +!.idea/runConfigurations* *.ipr *.iws *.iml diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 00000000..7f68460d --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Unit_Tests.xml b/.idea/runConfigurations/Unit_Tests.xml new file mode 100644 index 00000000..14960c4b --- /dev/null +++ b/.idea/runConfigurations/Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + +