Refactor how archive service access is managed during restore.

This commit is contained in:
Cody Henthorne
2024-11-06 10:30:54 -05:00
committed by Greyson Parrelli
parent c878da30ae
commit 743e2aaa82
7 changed files with 174 additions and 184 deletions

View File

@@ -548,9 +548,13 @@ class InternalBackupPlaygroundViewModel : ViewModel() {
SignalExecutors.BOUNDED_IO.execute {
Log.d(TAG, "Downloading file...")
val tempBackupFile = BlobProvider.getInstance().forNonAutoEncryptingSingleSessionOnDisk(AppDependencies.application)
if (!BackupRepository.downloadBackupFile(tempBackupFile)) {
Log.e(TAG, "Failed to download backup file")
throw IOException()
when (val result = BackupRepository.downloadBackupFile(tempBackupFile)) {
is NetworkResult.Success -> Log.i(TAG, "Download successful")
else -> {
Log.w(TAG, "Failed to download backup file", result.getCause())
throw IOException(result.getCause())
}
}
val encryptedStream = tempBackupFile.inputStream()