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

fix(privacy: Shred button spacing in private tabs (uplift to 1.72.x) #25996

Merged
merged 1 commit into from
Oct 15, 2024
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 @@ -95,6 +95,8 @@ class TabTrayController: AuthenticationController {

privateModeButton.isSelected = privateMode
tabTypeSelector.isHidden = privateMode
tabTypeSelectorContainerView.isHidden =
privateMode && !BraveCore.FeatureList.kBraveShredFeature.enabled
}
}

Expand All @@ -120,6 +122,7 @@ class TabTrayController: AuthenticationController {

private let tabContentView = UIView()

private let tabTypeSelectorContainerView = UIView()
private var tabTypeSelectorItems = [UIImage]()
private lazy var tabTypeSelector: UISegmentedControl = {
let segmentedControl = UISegmentedControl(items: tabTypeSelectorItems).then {
Expand Down Expand Up @@ -397,27 +400,39 @@ class TabTrayController: AuthenticationController {
$0.isLayoutMarginsRelativeArrangement = true
}

contentStackView.addArrangedSubview(tabTypeSelector)
contentStackView.setCustomSpacing(UX.segmentedControlTopInset, after: tabTypeSelector)
tabTypeSelectorContainerView.addSubview(tabTypeSelector)
contentStackView.addArrangedSubview(tabTypeSelectorContainerView)
contentStackView.setCustomSpacing(
UX.segmentedControlTopInset,
after: tabTypeSelectorContainerView
)
contentStackView.addArrangedSubview(tabContentView)

containerView.addSubview(contentStackView)

if FeatureList.kBraveShredFeature.enabled {
containerView.addSubview(shredButton)

shredButton.snp.makeConstraints { make in
make.trailing.equalTo(containerView.readableContentGuide)
make.centerY.equalTo(tabTypeSelector)
tabTypeSelectorContainerView.addSubview(shredButton)

shredButton.snp.makeConstraints {
$0.leading.greaterThanOrEqualTo(tabTypeSelector.snp.trailing)
$0.trailing.equalTo(tabTypeSelectorContainerView.snp.trailing)
$0.centerY.equalTo(tabTypeSelectorContainerView)
$0.top.greaterThanOrEqualTo(tabTypeSelectorContainerView.snp.top)
$0.bottom.lessThanOrEqualTo(tabTypeSelectorContainerView.snp.bottom)
}
}

contentStackView.snp.makeConstraints {
$0.edges.equalTo(containerView.safeAreaLayoutGuide)
}

tabTypeSelectorContainerView.snp.makeConstraints {
$0.width.equalTo(containerView.layoutMarginsGuide.snp.width)
}

tabTypeSelector.snp.makeConstraints {
$0.width.equalTo(contentStackView.snp.width).dividedBy(2)
$0.center.top.bottom.equalTo(tabTypeSelectorContainerView)
}

tabContentView.addSubview(tabTrayView)
Expand Down Expand Up @@ -824,6 +839,8 @@ class TabTrayController: AuthenticationController {
}

tabTypeSelector.isHidden = privateMode
tabTypeSelectorContainerView.isHidden =
privateMode && !BraveCore.FeatureList.kBraveShredFeature.enabled
}

func remove(tab: Tab) {
Expand Down
Loading