Always consider "no Backup in 7d" as a failure

This commit is contained in:
Sasha Weiss
2025-12-03 14:05:55 -08:00
committed by GitHub
parent 1f8d58e3fa
commit a18406ccfd
4 changed files with 11 additions and 18 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -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";

View File

@@ -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: -