From b237d16302dd553db64f28889440de355fad1d21 Mon Sep 17 00:00:00 2001 From: Anh Do <18567+quanganhdo@users.noreply.github.com> Date: Tue, 31 Dec 2024 18:04:23 +0700 Subject: [PATCH] Fix frozen Preferences About screen (#3689) Task/Issue URL: https://app.asana.com/0/1201037661562251/1209057693918519/f Tech Design URL: CC: **Description**: Fixes Preferences About screen not accepting inputs **Optional E2E tests**: - [ ] Run PIR E2E tests Check this to run the Personal Information Removal end to end tests. If updating CCF, or any PIR related code, tick this. **Steps to test this PR**: 1. Open the About screen 2. You should be able to interact with the checkboxes, buttons, and links on the screen **Definition of Done**: * [ ] Does this PR satisfy our [Definition of Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)? --- ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f) --- .../View/PreferencesAboutView.swift | 66 +++++++++++-------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/DuckDuckGo/Preferences/View/PreferencesAboutView.swift b/DuckDuckGo/Preferences/View/PreferencesAboutView.swift index d6fe08b06a..3a7a57fecf 100644 --- a/DuckDuckGo/Preferences/View/PreferencesAboutView.swift +++ b/DuckDuckGo/Preferences/View/PreferencesAboutView.swift @@ -33,52 +33,37 @@ extension Preferences { var body: some View { PreferencePane { - GeometryReader { geometry in - VStack(alignment: .leading) { - TextMenuTitle(UserText.aboutDuckDuckGo) + VStack(alignment: .leading) { + TextMenuTitle(UserText.aboutDuckDuckGo) - if !model.isCurrentOsReceivingUpdates { - UnsupportedDeviceInfoBox(wide: true) - .padding(.top, 10) - .padding(.leading, -20) - } + if !model.isCurrentOsReceivingUpdates { + UnsupportedDeviceInfoBox(wide: true) + .padding(.top, 10) + .padding(.leading, -20) + } - AboutContentSection(geometry: geometry, model: model) + AboutContentSection(model: model) #if SPARKLE - UpdatesSection(areAutomaticUpdatesEnabled: $areAutomaticUpdatesEnabled, model: model) + UpdatesSection(areAutomaticUpdatesEnabled: $areAutomaticUpdatesEnabled, model: model) #endif - } } } } } struct AboutContentSection: View { - var geometry: GeometryProxy @ObservedObject var model: AboutPreferences var body: some View { PreferencePaneSection { - if geometry.size.width > 400 { - HStack(alignment: .top) { - Image(.aboutPageLogo) - .padding(.top, 2) - VStack(alignment: .leading, spacing: 8) { - rightColumnContent - } - .padding(.top, 10) + if #available(macOS 13.0, *) { + ViewThatFits(in: .horizontal) { + horizontalPageLogo + verticalPageLogo } - .padding(.bottom, 8) } else { - VStack(alignment: .leading) { - Image(.aboutPageLogo) - VStack(alignment: .leading, spacing: 8) { - rightColumnContent - } - .padding(.top, 10) - } - .padding(.bottom, 8) + horizontalPageLogo } TextButton(UserText.moreAt(url: model.displayableAboutURL)) { @@ -139,6 +124,29 @@ extension Preferences { } } + private var horizontalPageLogo: some View { + HStack(alignment: .top) { + Image(.aboutPageLogo) + .padding(.top, 2) + VStack(alignment: .leading, spacing: 8) { + rightColumnContent + } + .padding(.top, 10) + } + .padding(.bottom, 8) + } + + private var verticalPageLogo: some View { + VStack(alignment: .leading) { + Image(.aboutPageLogo) + VStack(alignment: .leading, spacing: 8) { + rightColumnContent + } + .padding(.top, 10) + } + .padding(.bottom, 8) + } + #if SPARKLE private var hasPendingUpdate: Bool { model.updateController?.hasPendingUpdate == true