From fbff1d6dfebaf36d291d317d056ecdf5b41675ed Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 16 Jul 2024 09:00:11 +0200 Subject: [PATCH] Adjust content gradient + settings --- .../App/Tabs/Settings/DisplaySettingsView.swift | 1 + .../Resources/Localization/Localizable.xcstrings | 3 +++ Packages/DesignSystem/Sources/DesignSystem/Theme.swift | 10 ++++++++++ .../Sources/StatusKit/Row/StatusRowViewModel.swift | 10 +++++----- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift index cdc53c72..0e3ce244 100644 --- a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift +++ b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift @@ -237,6 +237,7 @@ struct DisplaySettingsView: View { } } Toggle("settings.display.show-account-popover", isOn: $userPreferences.showAccountPopover) + Toggle("Show Content Gradient", isOn: $theme.showContentGradient) } #if !os(visionOS) .listRowBackground(theme.primaryBackgroundColor) diff --git a/IceCubesApp/Resources/Localization/Localizable.xcstrings b/IceCubesApp/Resources/Localization/Localizable.xcstrings index afcafa83..552b1d8d 100644 --- a/IceCubesApp/Resources/Localization/Localizable.xcstrings +++ b/IceCubesApp/Resources/Localization/Localizable.xcstrings @@ -62126,6 +62126,9 @@ } } } + }, + "Show Content Gradient" : { + }, "status.action.bookmark" : { "extractionState" : "manual", diff --git a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift index 38a4f5a5..71cfb006 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift @@ -13,6 +13,7 @@ public final class Theme { case displayFullUsernameTimeline case lineSpacing case statusActionSecondary + case contentGradient } @AppStorage("is_previously_set") public var isThemePreviouslySet: Bool = false @@ -30,6 +31,7 @@ public final class Theme { @AppStorage(ThemeKey.displayFullUsernameTimeline.rawValue) public var displayFullUsername: Bool = false @AppStorage(ThemeKey.lineSpacing.rawValue) public var lineSpacing: Double = 1.2 @AppStorage(ThemeKey.statusActionSecondary.rawValue) public var statusActionSecondary: StatusActionSecondary = .share + @AppStorage(ThemeKey.contentGradient.rawValue) public var showContentGradient: Bool = true @AppStorage("font_size_scale") public var fontSizeScale: Double = 1 @AppStorage("chosen_font") public var chosenFontData: Data? @@ -282,6 +284,12 @@ public final class Theme { themeStorage.chosenFontData = chosenFontData } } + + public var showContentGradient: Bool { + didSet { + themeStorage.showContentGradient = showContentGradient + } + } public var selectedSet: ColorSetName = .iceCubeDark @@ -301,6 +309,7 @@ public final class Theme { fontSizeScale = 1 chosenFontData = nil statusActionSecondary = .share + showContentGradient = true } private init() { @@ -322,6 +331,7 @@ public final class Theme { fontSizeScale = themeStorage.fontSizeScale chosenFontData = themeStorage.chosenFontData statusActionSecondary = themeStorage.statusActionSecondary + showContentGradient = themeStorage.showContentGradient selectedSet = storedSet computeContrastingTintColor() diff --git a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift index b1fbd5ba..1e149dd2 100644 --- a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift +++ b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift @@ -108,7 +108,7 @@ import SwiftUI @ViewBuilder func makeBackgroundColor(isHomeTimeline: Bool) -> some View { - if isHomeTimeline { + if isHomeTimeline, theme.showContentGradient { homeBackgroundColor } else { backgroundColor @@ -145,10 +145,10 @@ import SwiftUI func makeDecorativeGradient(startColor: Color, endColor: Color) -> some View { LinearGradient(stops: [ - .init(color: startColor.opacity(0.3), location: 0.03), - .init(color: startColor.opacity(0.2), location: 0.06), - .init(color: startColor.opacity(0.1), location: 0.09), - .init(color: startColor.opacity(0.05), location: 0.15), + .init(color: startColor.opacity(0.2), location: 0.03), + .init(color: startColor.opacity(0.1), location: 0.06), + .init(color: startColor.opacity(0.05), location: 0.09), + .init(color: startColor.opacity(0.02), location: 0.15), .init(color: endColor, location: 0.25), ], startPoint: .topLeading,