From 2988e22612d91f5c401889d41ad7eb41d58f38c0 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Mon, 11 Aug 2025 13:34:17 -0300 Subject: [PATCH] Add logging when we display different alert sheets via the delegate. --- .../securesms/backup/v2/ui/BackupAlertDelegate.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/BackupAlertDelegate.kt b/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/BackupAlertDelegate.kt index 8bd2db1369..1bec25cd4c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/BackupAlertDelegate.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/BackupAlertDelegate.kt @@ -12,6 +12,7 @@ import androidx.lifecycle.repeatOnLifecycle import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.signal.core.util.concurrent.SignalDispatchers +import org.signal.core.util.logging.Log import org.thoughtcrime.securesms.backup.v2.BackupRepository import org.thoughtcrime.securesms.keyvalue.SignalStore import org.thoughtcrime.securesms.keyvalue.protos.BackupDownloadNotifierState @@ -22,21 +23,28 @@ import org.thoughtcrime.securesms.keyvalue.protos.BackupDownloadNotifierState object BackupAlertDelegate { private const val FRAGMENT_TAG = "BackupAlertFragmentTag" + private val TAG = Log.tag(BackupAlertDelegate::class) @JvmStatic fun delegate(fragmentManager: FragmentManager, lifecycle: Lifecycle) { lifecycle.coroutineScope.launch { lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) { if (BackupRepository.shouldDisplayBackupFailedSheet()) { + Log.d(TAG, "Displaying BackupFailed sheet.") BackupAlertBottomSheet.create(BackupAlert.BackupFailed).show(fragmentManager, FRAGMENT_TAG) } else if (BackupRepository.shouldDisplayCouldNotCompleteBackupSheet()) { + Log.d(TAG, "Displaying CouldNotCompleteBackup sheet.") BackupAlertBottomSheet.create(BackupAlert.CouldNotCompleteBackup(daysSinceLastBackup = SignalStore.backup.daysSinceLastBackup)).show(fragmentManager, FRAGMENT_TAG) } else if (BackupRepository.shouldDisplayBackupExpiredAndDowngradedSheet()) { + Log.d(TAG, "Displaying ExpiredAndDowngraded sheet.") BackupAlertBottomSheet.create(BackupAlert.ExpiredAndDowngraded).show(fragmentManager, FRAGMENT_TAG) } else if (BackupRepository.shouldDisplayNoManualBackupForTimeoutSheet()) { + Log.d(TAG, "Displaying NoManualBackupBottomSheet.") NoManualBackupBottomSheet().show(fragmentManager, FRAGMENT_TAG) BackupRepository.displayManualBackupNotCreatedInThresholdNotification() } else if (BackupRepository.shouldDisplayOutOfRemoteStorageSpaceSheet()) { + Log.d(TAG, "Displaying NoRemoteStorageSpaceAvailableBottomSheet.") + NoRemoteStorageSpaceAvailableBottomSheet().show(fragmentManager, FRAGMENT_TAG) } displayBackupDownloadNotifier(fragmentManager) @@ -48,9 +56,11 @@ object BackupAlertDelegate { val downloadYourBackupToday = withContext(SignalDispatchers.IO) { BackupRepository.getDownloadYourBackupData() } when (downloadYourBackupToday?.type) { BackupDownloadNotifierState.Type.SHEET -> { + Log.d(TAG, "Displaying 'Download your backup today' sheet.") BackupAlertBottomSheet.create(downloadYourBackupToday).show(fragmentManager, FRAGMENT_TAG) } BackupDownloadNotifierState.Type.DIALOG -> { + Log.d(TAG, "Displaying 'Download your backup today' dialog.") DownloadYourBackupTodayDialog.create(downloadYourBackupToday).show(fragmentManager, FRAGMENT_TAG) } null -> Unit