Skip to content

Commit

Permalink
Fix GeometryReader breaking interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
quanganhdo committed Dec 30, 2024
1 parent 9020672 commit e8ed29e
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions DuckDuckGo/Preferences/View/PreferencesAboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e8ed29e

Please sign in to comment.