From 68586f4f643aac91b9d72c9c7e8244f46937e0f1 Mon Sep 17 00:00:00 2001 From: Fernando Bunn Date: Mon, 25 Sep 2023 22:34:33 +0100 Subject: [PATCH 1/3] Fix crash related to Spacer On iOS 15 the Spacer inside the VStack for the closeButtonHeader was causing the app to enter in an infinite loop. --- DuckDuckGo/HomeMessageView.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/DuckDuckGo/HomeMessageView.swift b/DuckDuckGo/HomeMessageView.swift index 4b9bffb7e5..caedca4edd 100644 --- a/DuckDuckGo/HomeMessageView.swift +++ b/DuckDuckGo/HomeMessageView.swift @@ -46,9 +46,7 @@ struct HomeMessageView: View { @State var activityItem: ShareItem? var body: some View { - ZStack { - closeButtonHeader - + ZStack(alignment: .topTrailing) { VStack(spacing: 8) { Group { topText @@ -78,6 +76,11 @@ struct HomeMessageView: View { .multilineTextAlignment(.center) .padding(.vertical) .padding(.horizontal, 8) + + closeButtonHeader + .alignmentGuide(.top) { dimension in + dimension[.top] + } } .background(RoundedRectangle(cornerRadius: Const.Radius.corner) .fill(Color.background) @@ -97,7 +100,6 @@ struct HomeMessageView: View { closeButton .padding(0) } - Spacer() } } From d314c109c0176eeb9f2e08f93327dc8595a84416 Mon Sep 17 00:00:00 2001 From: Fernando Bunn Date: Tue, 26 Sep 2023 10:13:01 +0100 Subject: [PATCH 2/3] Revert hotfix --- DuckDuckGo/HomeCollectionView.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/DuckDuckGo/HomeCollectionView.swift b/DuckDuckGo/HomeCollectionView.swift index dda0196b5a..b821682a64 100644 --- a/DuckDuckGo/HomeCollectionView.swift +++ b/DuckDuckGo/HomeCollectionView.swift @@ -87,9 +87,7 @@ class HomeCollectionView: UICollectionView { renderers.install(renderer: FavoritesHomeViewSectionRenderer(viewModel: favoritesViewModel)) case .homeMessage: - if #available(iOS 16.0, *) { renderers.install(renderer: HomeMessageViewSectionRenderer(homePageConfiguration: homePageConfiguration)) - } case .appTrackingProtection: #if APP_TRACKING_PROTECTION From fb50664ee285b02dd549a05b82378c6b700c544c Mon Sep 17 00:00:00 2001 From: Fernando Bunn Date: Tue, 26 Sep 2023 16:08:58 +0100 Subject: [PATCH 3/3] Fix indentation --- DuckDuckGo/HomeCollectionView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DuckDuckGo/HomeCollectionView.swift b/DuckDuckGo/HomeCollectionView.swift index b821682a64..ee0b6818ee 100644 --- a/DuckDuckGo/HomeCollectionView.swift +++ b/DuckDuckGo/HomeCollectionView.swift @@ -87,7 +87,7 @@ class HomeCollectionView: UICollectionView { renderers.install(renderer: FavoritesHomeViewSectionRenderer(viewModel: favoritesViewModel)) case .homeMessage: - renderers.install(renderer: HomeMessageViewSectionRenderer(homePageConfiguration: homePageConfiguration)) + renderers.install(renderer: HomeMessageViewSectionRenderer(homePageConfiguration: homePageConfiguration)) case .appTrackingProtection: #if APP_TRACKING_PROTECTION