From f1c50104c1e614c735b424f246a6c0f0c7cd09e7 Mon Sep 17 00:00:00 2001 From: Soner YUKSEL Date: Fri, 5 Nov 2021 13:31:05 -0400 Subject: [PATCH] Fix #4463 / #4464: Fixes the interaction of Favourites reordering with default browser modal (#4469) --- .../New Tab Page/NewTabCenteredCollectionViewCell.swift | 2 ++ .../Sections/NTPDefaultBrowserCalloutProvider.swift | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Client/Frontend/Browser/New Tab Page/NewTabCenteredCollectionViewCell.swift b/Client/Frontend/Browser/New Tab Page/NewTabCenteredCollectionViewCell.swift index cf9d390e10c..2bef56425b1 100644 --- a/Client/Frontend/Browser/New Tab Page/NewTabCenteredCollectionViewCell.swift +++ b/Client/Frontend/Browser/New Tab Page/NewTabCenteredCollectionViewCell.swift @@ -17,6 +17,8 @@ class NewTabCenteredCollectionViewCell: UICollectionViewCell, Coll view.snp.remakeConstraints { $0.top.bottom.equalToSuperview() $0.centerX.equalToSuperview() + $0.leading.greaterThanOrEqualToSuperview() + $0.trailing.lessThanOrEqualToSuperview() } } diff --git a/Client/Frontend/Browser/New Tab Page/Sections/NTPDefaultBrowserCalloutProvider.swift b/Client/Frontend/Browser/New Tab Page/Sections/NTPDefaultBrowserCalloutProvider.swift index e670062cb1e..26e3e80ebff 100644 --- a/Client/Frontend/Browser/New Tab Page/Sections/NTPDefaultBrowserCalloutProvider.swift +++ b/Client/Frontend/Browser/New Tab Page/Sections/NTPDefaultBrowserCalloutProvider.swift @@ -10,6 +10,7 @@ import BraveShared class NTPDefaultBrowserCalloutProvider: NSObject, NTPObservableSectionProvider { var sectionDidChange: (() -> Void)? + private var defaultCalloutView = DefaultBrowserCalloutView() private typealias DefaultBrowserCalloutCell = NewTabCenteredCollectionViewCell @@ -43,7 +44,10 @@ class NTPDefaultBrowserCalloutProvider: NSObject, NTPObservableSectionProvider { layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return fittingSizeForCollectionView(collectionView, section: indexPath.section) + var size = fittingSizeForCollectionView(collectionView, section: indexPath.section) + size.height = defaultCalloutView.systemLayoutSizeFitting(size).height + + return size } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {