From 770ccaeca9f6af73d655097f727377e8016df5cc Mon Sep 17 00:00:00 2001 From: Soner YUKSEL Date: Mon, 30 Oct 2023 17:32:59 -0400 Subject: [PATCH] Fix brave/brave-ios#8329: Send to your Devices action "Send" button placement (brave/brave-ios#8335) --- .../SendTab/SendTabToSelfController.swift | 41 +++++++----------- Sources/BraveStrings/BraveStrings.swift | 3 ++ .../Certificates/leaf.cer | Bin 2078 -> 1900 bytes .../Certificates/self-signed.cer | Bin 1157 -> 1146 bytes 4 files changed, 19 insertions(+), 25 deletions(-) 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 faea96882431b4f415c1a0b576106fcc8fc120e8..06198b7f80cd361f8322baf9bfb7432fa6c64833 100644 GIT binary patch delta 1216 zcmV;x1V8(p5bO>gFoFkYFoFh9paTK{0s;^sY=F#le3PrO4RngH^GRiqA895zGBzFoDN09WWaP162eM43Vxo0SuAqG(QXqLt$)bW^ZzC zX<;!EFc1aMd< zrtaH-OH`UW680%K@mwlU%E?>0V$Hu6EL{X}dRYI!HeG-yuppH<8xlQmKj*zQtGgqA z311qD*$E8k`~}p55a{aBX(bgsz6&2;A3-iHPJdSyS=jdI*Kw=XtK^~MnwrDIprqB) z68y0vw10E?w`TV*7zax}+@|UkB8nGJjXR6xA;RC0fhx34qTMYB3as80oNXt71ho*G z@m`mr#fo%5gnj`ZyLXwV163U$1X(awFh~XkXMqd>0Wd!>Jq8FX1_1>H z2Lb^WF_XIkF%2*a1_@w>NCAfZYytt3m;_fqa6JOo`;P3nH%&)9i1cCwO1cCwK0p9?1lcohEQ;O2steyY> z1Oos@Fhl|%R_qLbjzZ0V{rezrd)BViBuaJas+6hfQA+dS1BnFR0w6OQ`4bMe2sbig z8~h~^Gf@7Qqt8vobs`WKms8E#qOGj-jXdb zhYd(bnO{Wlq{g*OWTZxk!Whl+*Qv+r0Ctm=1|)xq(%P*k000C707o!I0w6C0N%+IQ zO8o@M(s|OaM9kEvSdpquxu+N85{s8fK=%S60NfmOX7FSz_Gb#cFXx54mQvz0-#9#y z=LjRTaOco(zAz022`Yw2hW8Bt0Sg5H1A+ko0M=wqSqvkTGs1D*I-(nmAm60@FUG7& zz_x$VVMN4K8?Tso?*efsd@w0p(!a>4xHb>aXqe;}+wJ4hz8|@b76`2EXXN>iU;t(z zjU44RPh(v5DiH*J?A15dUIddgPxkZo9%2(M(DD2&SQ;FZ{97sjm_S#7rJ= zaL7hs-pX_7qC*nku2`1SgvRlN*-tlp{-nX(fj%K`4WVoT4e^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