From 27da37e9ecddcd031b3f7e73b5585677651a32ab Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sat, 13 Jan 2024 08:48:29 +0100 Subject: [PATCH] Fix #1859 --- .../App/Tabs/Settings/DisplaySettingsView.swift | 16 +--------------- .../Sources/DesignSystem/Theme.swift | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift index f868da7c..3bab5841 100644 --- a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift +++ b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift @@ -255,21 +255,7 @@ struct DisplaySettingsView: View { private var resetSection: some View { Section { Button { - theme.followSystemColorScheme = true - theme.applySet(set: colorScheme == .dark ? .iceCubeDark : .iceCubeLight) - theme.avatarShape = .circle - theme.avatarPosition = .leading - theme.statusActionsDisplay = .full - theme.displayFullUsername = false - theme.statusDisplayStyle = .large - theme.lineSpacing = 1.2 - theme.fontSizeScale = 1.0 - - localValues.tintColor = theme.tintColor - localValues.primaryBackgroundColor = theme.primaryBackgroundColor - localValues.secondaryBackgroundColor = theme.secondaryBackgroundColor - localValues.labelColor = theme.labelColor - + theme.restoreDefault() } label: { Text("settings.display.restore") } diff --git a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift index de72b8e9..6961544a 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift @@ -258,6 +258,22 @@ import SwiftUI public static let shared = Theme() + public func restoreDefault() { + applySet(set: themeStorage.selectedScheme == .dark ? .iceCubeDark : .iceCubeLight) + isThemePreviouslySet = true + avatarPosition = .leading + avatarShape = .circle + storedSet = selectedSet + statusActionsDisplay = .full + statusDisplayStyle = .large + followSystemColorScheme = true + displayFullUsername = false + lineSpacing = 1.2 + fontSizeScale = 1 + chosenFontData = nil + statusActionSecondary = .share + } + private init() { isThemePreviouslySet = themeStorage.isThemePreviouslySet selectedScheme = themeStorage.selectedScheme