diff --git a/Sources/Brave/Frontend/Browser/SendTab/SendTabToSelfController.swift b/Sources/Brave/Frontend/Browser/SendTab/SendTabToSelfController.swift index 01cdeba9a616..2b717b899231 100644 --- a/Sources/Brave/Frontend/Browser/SendTab/SendTabToSelfController.swift +++ b/Sources/Brave/Frontend/Browser/SendTab/SendTabToSelfController.swift @@ -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 @@ -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) @@ -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 @@ -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) diff --git a/Sources/BraveStrings/BraveStrings.swift b/Sources/BraveStrings/BraveStrings.swift index d664a56e14a4..9d4f331c1ab4 100644 --- a/Sources/BraveStrings/BraveStrings.swift +++ b/Sources/BraveStrings/BraveStrings.swift @@ -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 diff --git a/Tests/CertificateUtilitiesTests/Certificates/leaf.cer b/Tests/CertificateUtilitiesTests/Certificates/leaf.cer index faea96882431..06198b7f80cd 100644 Binary files a/Tests/CertificateUtilitiesTests/Certificates/leaf.cer and b/Tests/CertificateUtilitiesTests/Certificates/leaf.cer differ diff --git a/Tests/CertificateUtilitiesTests/Certificates/self-signed.cer b/Tests/CertificateUtilitiesTests/Certificates/self-signed.cer index 1f4f69032b2b..35d1ac739a1a 100644 Binary files a/Tests/CertificateUtilitiesTests/Certificates/self-signed.cer and b/Tests/CertificateUtilitiesTests/Certificates/self-signed.cer differ