From 24cc95585f3919639ef2400e9c83609b2dfdc78d Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Sat, 17 Mar 2018 08:50:09 -0300 Subject: [PATCH] Respond to CR. --- .../AppSettings/OWSBackupSettingsViewController.m | 11 ++++++----- Signal/src/util/OWSBackupAPI.swift | 6 +++--- Signal/translations/en.lproj/Localizable.strings | 9 +++------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/OWSBackupSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/OWSBackupSettingsViewController.m index f8624f8da..a2569aa2c 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSBackupSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSBackupSettingsViewController.m @@ -88,15 +88,16 @@ NS_ASSUME_NONNULL_BEGIN if (OWSBackup.sharedManager.backupExportProgress) { NSUInteger progressPercent = (NSUInteger)round(OWSBackup.sharedManager.backupExportProgress.floatValue * 100); + NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; + [numberFormatter setNumberStyle:NSNumberFormatterPercentStyle]; + [numberFormatter setMaximumFractionDigits:0]; + [numberFormatter setMultiplier:@1]; + NSString *progressString = [numberFormatter stringFromNumber:@(progressPercent)]; [progressSection addItem:[OWSTableItem labelItemWithText:NSLocalizedString(@"SETTINGS_BACKUP_PROGRESS", @"Label for phase row in the in the backup settings view.") - accessoryText:[NSString - stringWithFormat:NSLocalizedString(@"PERCENTAGE_FORMAT", - @"Format for percentages, e.g. 65%. " - @"Embeds {{percentage}}, e.g. 65."), - @(progressPercent).stringValue]]]; + accessoryText:progressString]]; } } } diff --git a/Signal/src/util/OWSBackupAPI.swift b/Signal/src/util/OWSBackupAPI.swift index 331f40f3d..79344a34e 100644 --- a/Signal/src/util/OWSBackupAPI.swift +++ b/Signal/src/util/OWSBackupAPI.swift @@ -552,10 +552,10 @@ import CloudKit // MARK: - Retry - private enum CKOutcome { + private enum APIOutcome { case success case failureDoNotRetry(error:Error) - case failureRetryAfterDelay(retryDelay: Double) + case failureRetryAfterDelay(retryDelay: TimeInterval) case failureRetryWithoutDelay // This only applies to fetches. case unknownItem @@ -563,7 +563,7 @@ import CloudKit private class func outcomeForCloudKitError(error: Error?, remainingRetries: Int, - label: String) -> CKOutcome { + label: String) -> APIOutcome { if let error = error as? CKError { if error.code == CKError.unknownItem { // This is not always an error for our purposes. diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 7a89b1173..0278713a1 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -160,6 +160,9 @@ /* Error indicating the a backup export could not export the user's data. */ "BACKUP_EXPORT_ERROR_COULD_NOT_EXPORT" = "Backup data could be exported."; +/* Error indicating that the app received an invalid response from CloudKit. */ +"BACKUP_EXPORT_ERROR_INVALID_CLOUDKIT_RESPONSE" = "Invalid server response."; + /* Error indicating the a backup export failed to save a file to the cloud. */ "BACKUP_EXPORT_ERROR_SAVE_FILE_TO_CLOUD_FAILED" = "Backup could not upload data."; @@ -178,9 +181,6 @@ /* Error indicating the a backup import could not import the user's data. */ "BACKUP_IMPORT_ERROR_COULD_NOT_IMPORT" = "Backup could not be imported."; -/* Error indicating the a backup import failed to download a file from the cloud. */ -"BACKUP_IMPORT_ERROR_DOWNLOAD_FILE_FROM_CLOUD_FAILED" = "Could not download backup data."; - /* Indicates that the backup import is being configured. */ "BACKUP_IMPORT_PHASE_CONFIGURATION" = "Configuring Backup"; @@ -1225,9 +1225,6 @@ /* A display format for oversize text messages. */ "OVERSIZE_TEXT_DISPLAY_FORMAT" = "%@…"; -/* Format for percentages, e.g. 65%. Embeds {{percentage}}, e.g. 65. */ -"PERCENTAGE_FORMAT" = "%@%%"; - /* A format for a label showing an example phone number. Embeds {{the example phone number}}. */ "PHONE_NUMBER_EXAMPLE_FORMAT" = "Example: %@";