Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix FXIOS-10655 ⁃ [Felt privacy-Unified panel] - The name in the Common Name should be blue and underlined on the certificate sheet #24199

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,21 @@ final class CertificatesCell: UITableViewCell, ReusableCell, ThemeApplicable {
fatalError("init(coder:) has not been implemented")
}

func configure(theme: Theme, sectionTitle: String, items: CertificateItems) {
func configure(theme: Theme, sectionTitle: String, items: CertificateItems, isIssuerName: Bool = false) {
applyTheme(theme: theme)
sectionLabel.text = sectionTitle
for (key, value) in items {
let isUnderlined = isIssuerName && key == .Menu.EnhancedTrackingProtection.certificateCommonName
let stackView = getSectionItemStackView()
let titleLabel = getItemLabel(theme: theme, with: key, isTitle: true)
let titleLabel = getItemLabel(theme: theme, with: key, isTitle: true, isUnderlined: isUnderlined)
titleLabel.widthAnchor.constraint(equalToConstant: UX.sectionLabelWidth).isActive = true
stackView.addArrangedSubview(titleLabel)
stackView.addArrangedSubview(getItemLabel(theme: theme, with: value, isTitle: false))
stackView.addArrangedSubview(getItemLabel(
theme: theme,
with: value,
isTitle: false,
isUnderlined: isUnderlined
))
allSectionItemsStackView.addArrangedSubview(stackView)
}
}
Expand All @@ -87,15 +93,25 @@ final class CertificatesCell: UITableViewCell, ReusableCell, ThemeApplicable {
sectionLabel.textColor = theme.colors.textPrimary
}

private func getItemLabel(theme: Theme, with title: String, isTitle: Bool) -> UILabel {
let itemLabel: UILabel = .build { label in
label.font = FXFontStyles.Bold.headline.scaledFont()
label.textColor = isTitle ? theme.colors.textSecondary : theme.colors.textPrimary
label.text = title
label.textAlignment = isTitle ? .right : .left
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
label.accessibilityIdentifier = AccessibilityIdentifiers.EnhancedTrackingProtection.DetailsScreen.itemLabel
private func getItemLabel(theme: Theme, with title: String, isTitle: Bool, isUnderlined: Bool) -> UILabel {
let itemLabel: UILabel = .build()
itemLabel.font = FXFontStyles.Bold.headline.scaledFont()
itemLabel.textAlignment = isTitle ? .right : .left
itemLabel.numberOfLines = 0
itemLabel.lineBreakMode = .byWordWrapping
itemLabel.accessibilityIdentifier = AccessibilityIdentifiers.EnhancedTrackingProtection.DetailsScreen.itemLabel
if isUnderlined, !isTitle {
let attributedString = NSAttributedString(
string: title,
attributes: [
.underlineStyle: NSUnderlineStyle.single.rawValue
]
)
itemLabel.textColor = theme.colors.textAccent
itemLabel.attributedText = attributedString
} else {
itemLabel.textColor = isTitle ? theme.colors.textSecondary : theme.colors.textPrimary
itemLabel.text = title
}
return itemLabel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ class CertificatesViewController: UIViewController,
sectionTitle: .Menu.EnhancedTrackingProtection.certificateIssuerName,
items: [(.Menu.EnhancedTrackingProtection.certificateIssuerCountry, country),
(.Menu.EnhancedTrackingProtection.certificateIssuerOrganization, organization),
(.Menu.EnhancedTrackingProtection.certificateCommonName, commonName)])
(.Menu.EnhancedTrackingProtection.certificateCommonName, commonName)],
isIssuerName: true)
}

case .validity:
Expand Down
Loading