diff --git a/AltStore/App IDs/AppIDsViewController.swift b/AltStore/App IDs/AppIDsViewController.swift index 1cd764b4..f5007fd4 100644 --- a/AltStore/App IDs/AppIDsViewController.swift +++ b/AltStore/App IDs/AppIDsViewController.swift @@ -91,13 +91,18 @@ private extension AppIDsViewController cell.bannerView.buttonLabel.isHidden = false - let currentDate = Date() + let formatter = DateComponentsFormatter() + formatter.unitsStyle = .full + formatter.includesApproximationPhrase = false + formatter.includesTimeRemainingPhrase = false + formatter.allowedUnits = [.minute, .hour, .day] - let numberOfDays = expirationDate.numberOfCalendarDays(since: currentDate) - let numberOfDaysText = (numberOfDays == 1) ? NSLocalizedString("1 day", comment: "") : String(format: NSLocalizedString("%@ days", comment: ""), NSNumber(value: numberOfDays)) - cell.bannerView.button.setTitle(numberOfDaysText.uppercased(), for: .normal) - attributedAccessibilityLabel.mutableString.append(String(format: NSLocalizedString("Expires in %@.", comment: ""), numberOfDaysText) + " ") + cell.bannerView.button.setTitle(formatter.string(from: expirationDate, to: Date())?.uppercased(), for: .normal) + + formatter.includesTimeRemainingPhrase = true + + attributedAccessibilityLabel.mutableString.append((formatter.string(from: expirationDate, to: Date()) ?? "Unknown amount of time") + " ") } else { @@ -206,7 +211,7 @@ extension AppIDsViewController: UICollectionViewDelegateFlowLayout **App IDs can't be deleted**, but they do expire after one week. SideStore will automatically renew App IDs for all active apps once they've expired. """, comment: "") - let attributedText = NSAttributedString(markdownRepresentation: text, attributes: [.font: headerView.textLabel.font as Any]) + let attributedText = NSAttributedString(markdownRepresentation: text) headerView.textLabel.attributedText = attributedText } else