diff --git a/Signal/src/ViewControllers/AttachmentApprovalViewController.swift b/Signal/src/ViewControllers/AttachmentApprovalViewController.swift index a4b8bdd73..26e5000e6 100644 --- a/Signal/src/ViewControllers/AttachmentApprovalViewController.swift +++ b/Signal/src/ViewControllers/AttachmentApprovalViewController.swift @@ -174,9 +174,17 @@ class AttachmentApprovalViewController: UIViewController { let numberFormatter = NumberFormatter() numberFormatter.numberStyle = NumberFormatter.Style.decimal let fileSizeLabel = UILabel() + let fileSize = attachment.data.count + let kOneKilobyte = 1024 + let kOneMegabyte = kOneKilobyte * kOneKilobyte + let fileSizeText = (fileSize > kOneMegabyte + ? numberFormatter.string(from: NSNumber(value: fileSize / kOneMegabyte))! + " mb" + : (fileSize > kOneKilobyte + ? numberFormatter.string(from: NSNumber(value: fileSize / kOneKilobyte))! + " kb" + : numberFormatter.string(from: NSNumber(value: fileSize))!)) fileSizeLabel.text = String(format:NSLocalizedString("ATTACHMENT_APPROVAL_FILE_SIZE_FORMAT", comment: "Format string for file size label in call interstitial view"), - numberFormatter.string(from: NSNumber(value: attachment.data.count))!) + fileSizeText) fileSizeLabel.textColor = UIColor.white fileSizeLabel.font = labelFont diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 2ff444f4b..eac2b6e1d 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -56,7 +56,7 @@ "ATTACHMENT_APPROVAL_FILE_EXTENSION_FORMAT" = "File type: %@"; /* Format string for file size label in call interstitial view */ -"ATTACHMENT_APPROVAL_FILE_SIZE_FORMAT" = "File size: %@"; +"ATTACHMENT_APPROVAL_FILE_SIZE_FORMAT" = "Size: %@"; /* Label for 'send' button in the 'attachment approval' dialog. */ "ATTACHMENT_APPROVAL_SEND_BUTTON" = "Send";