From a18406ccfde9be0bc54d57d1e16a52066509c778 Mon Sep 17 00:00:00 2001 From: Sasha Weiss Date: Wed, 3 Dec 2025 14:05:55 -0800 Subject: [PATCH] Always consider "no Backup in 7d" as a failure --- .../ChatListFYISheetCoordinator.swift | 3 --- .../Chat List/ChatListViewController.swift | 1 - .../translations/en.lproj/Localizable.strings | 2 +- .../Settings/BackupFailureStateManager.swift | 23 ++++++++----------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/Chat List/ChatListFYISheetCoordinator.swift b/Signal/src/ViewControllers/HomeView/Chat List/ChatListFYISheetCoordinator.swift index cd9e942de4..0d3e8b2bb1 100644 --- a/Signal/src/ViewControllers/HomeView/Chat List/ChatListFYISheetCoordinator.swift +++ b/Signal/src/ViewControllers/HomeView/Chat List/ChatListFYISheetCoordinator.swift @@ -46,7 +46,6 @@ class ChatListFYISheetCoordinator { } private let backupExportJobRunner: BackupExportJobRunner - private let backupFailureStateManager: BackupFailureStateManager private let backupSubscriptionIssueStore: BackupSubscriptionIssueStore private let donationReceiptCredentialResultStore: DonationReceiptCredentialResultStore private let donationSubscriptionManager: DonationSubscriptionManager.Type @@ -56,7 +55,6 @@ class ChatListFYISheetCoordinator { init( backupExportJobRunner: BackupExportJobRunner, - backupFailureStateManager: BackupFailureStateManager, backupSubscriptionIssueStore: BackupSubscriptionIssueStore, donationReceiptCredentialResultStore: DonationReceiptCredentialResultStore, donationSubscriptionManager: DonationSubscriptionManager.Type, @@ -65,7 +63,6 @@ class ChatListFYISheetCoordinator { profileManager: ProfileManager, ) { self.backupExportJobRunner = backupExportJobRunner - self.backupFailureStateManager = backupFailureStateManager self.backupSubscriptionIssueStore = backupSubscriptionIssueStore self.donationReceiptCredentialResultStore = donationReceiptCredentialResultStore self.donationSubscriptionManager = donationSubscriptionManager diff --git a/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController.swift b/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController.swift index d04bd584d7..af27ec2175 100644 --- a/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController.swift +++ b/Signal/src/ViewControllers/HomeView/Chat List/ChatListViewController.swift @@ -370,7 +370,6 @@ public class ChatListViewController: OWSViewController, HomeTabViewController { func showFYISheetIfNecessary() { let fyiSheetCoordinator = ChatListFYISheetCoordinator( backupExportJobRunner: DependenciesBridge.shared.backupExportJobRunner, - backupFailureStateManager: DependenciesBridge.shared.backupFailureStateManager, backupSubscriptionIssueStore: BackupSubscriptionIssueStore(), donationReceiptCredentialResultStore: DependenciesBridge.shared.donationReceiptCredentialResultStore, donationSubscriptionManager: DonationSubscriptionManager.self, diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 0df2d3ee8d..5cd1a1861d 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -689,7 +689,7 @@ "BACKUP_SETTINGS_BACKUP_EXPORT_PROGRESS_DESCRIPTION_PROCESSING_MEDIA" = "Processing media..."; /* Message describing to the user that the last backup failed. */ -"BACKUP_SETTINGS_BACKUP_FAILED_MESSAGE" = "Your last backup couldn't be completed. Make sure your phone is connected to Wi-Fi and tap \"Back Up Now\" to try again"; +"BACKUP_SETTINGS_BACKUP_FAILED_MESSAGE" = "Your last backup couldn't be completed. Tap \"Back Up Now\" to try again."; /* Title for a button allowing users to upgrade from a free to paid backup plan. */ "BACKUP_SETTINGS_BACKUP_PLAN_FREE_ACTION_BUTTON_TITLE" = "Upgrade"; diff --git a/SignalServiceKit/Backups/Settings/BackupFailureStateManager.swift b/SignalServiceKit/Backups/Settings/BackupFailureStateManager.swift index 03a4b35e13..dee242c599 100644 --- a/SignalServiceKit/Backups/Settings/BackupFailureStateManager.swift +++ b/SignalServiceKit/Backups/Settings/BackupFailureStateManager.swift @@ -27,7 +27,12 @@ public class BackupFailureStateManager { } // MARK: - + public func hasFailedBackup(tx: DBReadTransaction) -> Bool { + guard shouldBackupsBeRunning(tx: tx) else { + return false + } + if backupSettingsStore.getInteractiveBackupErrorCount(tx: tx) >= Constants.requiredInteractiveFailuresForBadge { return true } @@ -36,6 +41,10 @@ public class BackupFailureStateManager { return true } + if !lastBackupWasRecent(tx: tx) { + return true + } + return false } @@ -46,24 +55,12 @@ public class BackupFailureStateManager { target: BackupSettingsStore.ErrorBadgeTarget, tx: DBReadTransaction, ) -> Bool { - guard shouldBackupsBeRunning(tx: tx) else { - return false - } - // See if this badge has been muted if backupSettingsStore.getErrorBadgeMuted(target: target, tx: tx) { return false } - if hasFailedBackup(tx: tx) { - return true - } - - if !lastBackupWasRecent(tx: tx) { - return true - } - - return false + return hasFailedBackup(tx: tx) } // MARK: -