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

Commit

Permalink
Fix #5683: Add support for dynamic type on the url & bottom toolbars (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson authored Jul 15, 2022
1 parent 38716a4 commit 9752378
Show file tree
Hide file tree
Showing 86 changed files with 1,605 additions and 541 deletions.
Empty file removed Client.xcodeproj/project.pbxproj
Empty file.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions Client/Assets/Images.xcassets/TabToolbar/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 0 additions & 22 deletions Client/Assets/Images.xcassets/ntp-search.imageset/Contents.json

This file was deleted.

Binary file not shown.
Binary file not shown.
22 changes: 0 additions & 22 deletions Client/Assets/Images.xcassets/reader.imageset/Contents.json

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
4 changes: 0 additions & 4 deletions Client/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -949,10 +949,6 @@ public class BrowserViewController: UIViewController, BrowserViewControllerDeleg
make.left.right.equalTo(self.view)
}

topToolbar.snp.makeConstraints { make in
make.height.equalTo(UIConstants.topToolbarHeight)
}

collapsedURLBarView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ extension BrowserViewController: PlaylistHelperDelegate {

let pulseAnimation = RadialPulsingAnimation(ringCount: 3)
pulseAnimation.present(
icon: UIImage(named: "welcome-view-playlist-button-icon", in: .current, compatibleWith: nil)!,
icon: self.topToolbar.locationView.playlistButton.snapshot,
from: self.topToolbar.locationView.playlistButton,
on: popover,
browser: self)
Expand Down
15 changes: 14 additions & 1 deletion Client/Frontend/Browser/TabsBar/TabBarCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class TabBarCell: UICollectionViewCell {

[deselectedOverlayView, closeButton, titleLabel, separatorLine, separatorLineRight].forEach { contentView.addSubview($0) }
initConstraints()

updateFont()

isSelected = false
privateModeCancellable = PrivateBrowsingManager.shared
.$isPrivateBrowsing
Expand Down Expand Up @@ -146,6 +147,18 @@ class TabBarCell: UICollectionViewCell {
closeButton.isHidden = true
deselectedOverlayView.isHidden = false
}
updateFont()
}

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
updateFont()
}

private func updateFont() {
let clampedTraitCollection = self.traitCollection.clampingSizeCategory(maximum: .extraExtraLarge)
let font = UIFont.preferredFont(forTextStyle: .caption1, compatibleWith: clampedTraitCollection)
titleLabel.font = .systemFont(ofSize: font.pointSize, weight: isSelected ? .semibold : .regular)
}

@objc func closeTab() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class BottomToolbarView: UIView, ToolbarProtocol {
self?.updateColors(PrivateBrowsingManager.shared.isPrivateBrowsing)
}
.store(in: &cancellables)

helper?.updateForTraitCollection(traitCollection)
}

private var privateModeCancellable: AnyCancellable?
Expand Down Expand Up @@ -90,6 +92,11 @@ class BottomToolbarView: UIView, ToolbarProtocol {
}
super.updateConstraints()
}

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
helper?.updateForTraitCollection(traitCollection)
}

private func setupAccessibility() {
backButton.accessibilityIdentifier = "TabToolbar.backButton"
Expand Down
13 changes: 13 additions & 0 deletions Client/Frontend/Browser/Toolbars/ToolbarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@

import UIKit

extension UITraitCollection {
/// Returns the size category to be used for toolbar buttons based on the current preferred size category
var toolbarButtonContentSizeCategory: UIContentSizeCategory {
let sizeCategory = preferredContentSizeCategory
if sizeCategory < UIContentSizeCategory.extraLarge {
return .large
} else if sizeCategory < UIContentSizeCategory.extraExtraLarge {
return .extraLarge
}
return .extraExtraLarge
}
}

class ToolbarButton: UIButton {
fileprivate var selectedTintColor: UIColor?
fileprivate var primaryTintColor: UIColor?
Expand Down
Loading

0 comments on commit 9752378

Please sign in to comment.