From c5674a37b53beb5b711ce661d45221ea6c933ede Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 20 Nov 2024 19:47:41 -0500 Subject: [PATCH] Improve error reporting in storage service playground. --- .../storage/InternalStorageServicePlaygroundFragment.kt | 3 +++ .../storage/InternalStorageServicePlaygroundViewModel.kt | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundFragment.kt index 01c14c23d3..bfe6b5b300 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundFragment.kt @@ -204,6 +204,9 @@ fun ViewScreen( OneOffEvent.StorageRecordDecryptionError -> { Toast.makeText(context, "Failed to decrypt storage records!", Toast.LENGTH_SHORT).show() } + OneOffEvent.ManifestNotFoundError -> { + Toast.makeText(context, "Manifest not found!", Toast.LENGTH_SHORT).show() + } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundViewModel.kt index c19a7ce348..cf30c3856c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/storage/InternalStorageServicePlaygroundViewModel.kt @@ -46,6 +46,11 @@ class InternalStorageServicePlaygroundViewModel : ViewModel() { val manifest = when (val result = repository.getStorageManifest(storageKey)) { is StorageServiceRepository.ManifestResult.Success -> result.manifest + is StorageServiceRepository.ManifestResult.NotFoundError -> { + Log.w(TAG, "Manifest not found!") + _oneOffEvents.value = OneOffEvent.ManifestNotFoundError + return@withContext + } else -> { Log.w(TAG, "Failed to fetch manifest!") _oneOffEvents.value = OneOffEvent.ManifestDecryptionError @@ -69,6 +74,6 @@ class InternalStorageServicePlaygroundViewModel : ViewModel() { } enum class OneOffEvent { - None, ManifestDecryptionError, StorageRecordDecryptionError + None, ManifestDecryptionError, StorageRecordDecryptionError, ManifestNotFoundError } }