Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Ref #8417: Hide "Not Secure" label when tab location view is too small #8488

Merged
merged 1 commit into from
Nov 27, 2023
Merged
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 @@ -79,7 +79,7 @@ class TabLocationView: UIView {
var title = AttributedString(Strings.tabToolbarNotSecureTitle)
title.font = .preferredFont(forTextStyle: .subheadline, compatibleWith: clampedTraitCollection)

let isTitleVisible = !traitCollection.preferredContentSizeCategory.isAccessibilityCategory
let isTitleVisible = !traitCollection.preferredContentSizeCategory.isAccessibilityCategory && bounds.width > 200

switch secureContentState {
case .localhost, .secure:
Expand Down Expand Up @@ -226,6 +226,8 @@ class TabLocationView: UIView {
private let placeholderLabel = UILabel().then {
$0.text = Strings.tabToolbarSearchAddressPlaceholderText
$0.isHidden = true
$0.adjustsFontSizeToFitWidth = true
$0.minimumScaleFactor = 0.5
}

// A layout guide defining the available space for the URL itself
Expand Down Expand Up @@ -366,6 +368,12 @@ class TabLocationView: UIView {
}
}

override func layoutSubviews() {
super.layoutSubviews()

secureContentStateButton?.setNeedsUpdateConfiguration()
}

private func updateForTraitCollection() {
let clampedTraitCollection = traitCollection.clampingSizeCategory(maximum: .accessibilityLarge)
let toolbarTraitCollection = UITraitCollection(preferredContentSizeCategory: traitCollection.toolbarButtonContentSizeCategory)
Expand Down