From 053ceb90734e3bebe85d44fcf3fffc57c9618c2d Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 3 May 2024 15:45:36 +0800 Subject: [PATCH] Fix preferences popover on iOS 15 for iPad users --- .../Views/WebReader/WebReaderContainer.swift | 2 +- .../Views/FontSizeAdjustmentPopoverView.swift | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index e1b6e5653..95ce3f22d 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -323,7 +323,7 @@ struct WebReaderContainerView: View { .padding(.trailing, 5) .popover(isPresented: $showPreferencesPopover) { webPreferencesPopoverView - .frame(maxWidth: 400, maxHeight: 475) + .frame(width: 400, height: 475) } .formSheet(isPresented: $showPreferencesFormsheet, modalSize: CGSize(width: 400, height: 475)) { webPreferencesPopoverView diff --git a/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift b/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift index 168ce3253..8b3746c9f 100644 --- a/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift +++ b/apple/OmnivoreKit/Sources/Views/FontSizeAdjustmentPopoverView.swift @@ -216,7 +216,9 @@ public enum WebFont: String, CaseIterable { updateReaderPreferences() }, label: { Image(systemName: "textformat.size.smaller") }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) CustomSlider(value: $storedFontSize, minValue: 10, maxValue: 48) { _ in if storedFontSize % 1 == 0 { updateReaderPreferences() @@ -230,7 +232,9 @@ public enum WebFont: String, CaseIterable { updateReaderPreferences() }, label: { Image(systemName: "textformat.size.larger") }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) } } @@ -244,7 +248,9 @@ public enum WebFont: String, CaseIterable { updateReaderPreferences() }, label: { Image("margin-smaller", bundle: .module) }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) CustomSlider(value: $storedMaxWidthPercentage, minValue: minValue, maxValue: 100) { _ in updateReaderPreferences() } @@ -256,7 +262,9 @@ public enum WebFont: String, CaseIterable { updateReaderPreferences() }, label: { Image("margin-larger", bundle: .module) }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) } } @@ -267,7 +275,9 @@ public enum WebFont: String, CaseIterable { updateReaderPreferences() }, label: { Image("lineheight-smaller", bundle: .module) }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) CustomSlider(value: $storedLineSpacing, minValue: 100, maxValue: 300) { _ in updateReaderPreferences() } @@ -279,7 +289,9 @@ public enum WebFont: String, CaseIterable { updateReaderPreferences() }, label: { Image("lineheight-larger", bundle: .module) }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) } } @@ -288,7 +300,9 @@ public enum WebFont: String, CaseIterable { Button(action: { storedFontSize = min(storedFontSize + 2, 28) }, label: { Image("brightness-lower", bundle: .module) }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) CustomSlider(value: $storedFontSize, minValue: 10, maxValue: 28) { _ in updateReaderPreferences() } @@ -297,7 +311,9 @@ public enum WebFont: String, CaseIterable { Button(action: { storedFontSize = max(storedFontSize - 2, 10) }, label: { Image("brightness-higher", bundle: .module) }) + .buttonStyle(.plain) .frame(width: 25, height: 25, alignment: .center) + .foregroundColor(.appGrayTextContrast.opacity(0.4)) } } @@ -371,6 +387,7 @@ public enum WebFont: String, CaseIterable { Text("Margin") .font(Font.system(size: 14)) .frame(maxWidth: .infinity, alignment: .leading) + .foregroundColor(.appGrayTextContrast) marginSlider .padding(.top, 5) @@ -379,6 +396,7 @@ public enum WebFont: String, CaseIterable { Text("Line Height") .font(Font.system(size: 14)) .frame(maxWidth: .infinity, alignment: .leading) + .foregroundColor(.appGrayTextContrast) lineHeightSlider // .padding(.bottom, 20) @@ -390,7 +408,7 @@ public enum WebFont: String, CaseIterable { // // brightnessSlider - }.tint(Color(hex: "#6A6968")) + }.tint(.appGrayTextContrast) .padding(.horizontal, 30) Divider() @@ -401,6 +419,7 @@ public enum WebFont: String, CaseIterable { Text("Theme") .font(Font.system(size: 14)) .frame(maxWidth: .infinity, alignment: .leading) + .foregroundColor(.appGrayTextContrast) Spacer() systemThemeCheckbox