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

Fix #8329: Send to your Devices action "Send" button placement #8335

Merged
merged 3 commits into from
Oct 30, 2023
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 @@ -12,7 +12,7 @@ class SendTabToSelfController: SendTabTransitioningController {

struct UX {
static let contentInset = 20.0
static let preferredSizePadding = 132.0
static let preferredSizePadding = 100.0
}

// MARK: Internal
Expand Down Expand Up @@ -66,14 +66,16 @@ class SendTabToSelfController: SendTabTransitioningController {
}

private func updateLayoutConstraints() {
let contentSize = CGSize(width: view.bounds.size.width, height: view.frame.height)

let preferredSize = sendTabContentController.view.systemLayoutSizeFitting(
CGSize(width: view.bounds.size.width, height: view.frame.height),
contentSize,
withHorizontalFittingPriority: .required,
verticalFittingPriority: .fittingSizeLevel
).with {
$0.height += UX.preferredSizePadding
}

contentNavigationController.view.snp.makeConstraints {
if traitCollection.horizontalSizeClass == .compact && traitCollection.verticalSizeClass == .regular {
$0.leading.trailing.equalTo(contentView.safeAreaLayoutGuide).inset(UX.contentInset)
Expand Down Expand Up @@ -125,39 +127,27 @@ class SendTabToSelfContentController: UITableViewController {
navigationItem.title = Strings.OpenTabs.sendWebpageScreenTitle
navigationItem.leftBarButtonItem =
UIBarButtonItem(title: Strings.cancelButtonTitle, style: .plain, target: self, action: #selector(cancel))

navigationItem.rightBarButtonItem =
UIBarButtonItem(title: Strings.sendButtonTitle, style: .plain, target: self, action: #selector(send))

tableView.do {
$0.tableHeaderView = UIView()
$0.register(CenteredButtonCell.self)
$0.register(TwoLineTableViewCell.self)
$0.registerHeaderFooter(SendTabToSelfContentHeaderFooterView.self)
$0.tableFooterView = SendTabToSelfContentHeaderFooterView().then {
$0.titleLabel.text = Strings.OpenTabs.sendDeviceButtonTitle
$0.titleLabel.isUserInteractionEnabled = true
$0.titleLabel.addGestureRecognizer(UITapGestureRecognizer(
target: self,
action: #selector(tappedSendLabel(_:))))
}
}
}

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

guard let footerView = tableView.tableFooterView else { return }

let size = footerView.systemLayoutSizeFitting(
CGSize(width: tableView.bounds.size.width, height: UIView.layoutFittingCompressedSize.height))

if footerView.frame.size.height != size.height {
footerView.frame.size.height = size.height
tableView.tableFooterView = footerView
}
tableView.flashScrollIndicators()
}

@objc func cancel() {
dismiss(animated: true)
}

@objc func send() {
guard let dataSource = dataSource else { return }

sendWebSiteHandler?(dataSource)
}
}

// MARK: UITableViewDataSource - UITableViewDelegate
Expand Down Expand Up @@ -193,6 +183,7 @@ extension SendTabToSelfContentController {
}

cell.do {
$0.separatorInset = UIEdgeInsets.zero
$0.backgroundColor = .clear
$0.accessoryType = indexPath.row == dataSource?.selectedIndex ? .checkmark : .none
$0.setLines(device.fullName, detailText: device.lastUpdatedTime.formattedActivePeriodDate)
Expand Down
3 changes: 3 additions & 0 deletions Sources/BraveStrings/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ extension Strings {
NSLocalizedString(
"yearAbbreviation", tableName: "BraveShared",
bundle: .module, value: "yr.", comment: "Abbreviation for 'Year', use full word' Yeara' if this word can't be shortened in your language")
public static let sendButtonTitle = NSLocalizedString(
"sendButtonTitle", tableName: "BraveShared",
bundle: .module, value: "Send", comment: "")
}

// MARK:- UIAlertControllerExtensions.swift
Expand Down
Binary file modified Tests/CertificateUtilitiesTests/Certificates/leaf.cer
Binary file not shown.
Binary file modified Tests/CertificateUtilitiesTests/Certificates/self-signed.cer
Binary file not shown.