Fix theme selection bug and update onboarding with AppTheme picker
- Change Theme enum from Int to String raw values to fix theme selection bug - Replace OnboardingStyle icon/color pickers with unified AppTheme grid - Remove visible text labels from voting layouts while keeping accessibility labels (WCAG 2.1 AA compliant) - Update widget voting views to use icons only with proper accessibility support - Consolidate app icons to single unified icon set 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -117,9 +117,9 @@ struct CustomizeContentView: View {
|
||||
}
|
||||
|
||||
// WIDGETS
|
||||
SettingsSection(title: "Widgets") {
|
||||
CustomWidgetSection()
|
||||
}
|
||||
// SettingsSection(title: "Widgets") {
|
||||
// CustomWidgetSection()
|
||||
// }
|
||||
|
||||
// NOTIFICATIONS
|
||||
SettingsSection(title: "Notifications") {
|
||||
@@ -208,9 +208,9 @@ struct CustomizeView: View {
|
||||
}
|
||||
|
||||
// WIDGETS
|
||||
SettingsSection(title: "Widgets") {
|
||||
CustomWidgetSection()
|
||||
}
|
||||
// SettingsSection(title: "Widgets") {
|
||||
// CustomWidgetSection()
|
||||
// }
|
||||
|
||||
// NOTIFICATIONS
|
||||
SettingsSection(title: "Notifications") {
|
||||
@@ -330,7 +330,7 @@ struct ThemePickerCompact: View {
|
||||
.foregroundColor(theme == aTheme ? .accentColor : textColor.opacity(0.6))
|
||||
}
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.buttonStyle(BorderlessButtonStyle())
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
@@ -9,42 +9,19 @@ import SwiftUI
|
||||
|
||||
struct ThemePickerView: View {
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@State private var selectedTheme: Theme = UserDefaultsStore.theme()
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = DefaultTextColor.textColor
|
||||
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
selectedTheme.currentTheme.secondaryBGColor
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
ForEach(Theme.allCases, id:\.rawValue) { aTheme in
|
||||
Button(action: {
|
||||
theme = aTheme
|
||||
changeTextColor(forTheme: aTheme)
|
||||
EventLogger.log(event: "change_theme_id", withData: ["id": aTheme.rawValue])
|
||||
}, label: {
|
||||
VStack {
|
||||
aTheme.currentTheme.preview
|
||||
.overlay(
|
||||
Circle()
|
||||
.stroke(Color(UIColor.systemGray), style: StrokeStyle(lineWidth: 2))
|
||||
)
|
||||
Text(aTheme.title)
|
||||
.foregroundColor(textColor)
|
||||
.font(.body)
|
||||
}
|
||||
})
|
||||
.contentShape(Rectangle())
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10, style: .continuous)
|
||||
.fill(theme == aTheme ? theme.currentTheme.bgColor : .clear)
|
||||
.padding(-5)
|
||||
|
||||
)
|
||||
Spacer()
|
||||
}
|
||||
HStack(spacing: 0) {
|
||||
themeButton(for: .system)
|
||||
themeButton(for: .iFeel)
|
||||
themeButton(for: .dark)
|
||||
themeButton(for: .light)
|
||||
}
|
||||
.padding(.top)
|
||||
}
|
||||
@@ -52,8 +29,51 @@ struct ThemePickerView: View {
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
.onAppear {
|
||||
selectedTheme = UserDefaultsStore.theme()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ViewBuilder
|
||||
private func themeButton(for theme: Theme) -> some View {
|
||||
Button {
|
||||
selectTheme(theme)
|
||||
} label: {
|
||||
VStack {
|
||||
theme.currentTheme.preview
|
||||
.allowsHitTesting(false)
|
||||
.overlay(
|
||||
Circle()
|
||||
.stroke(Color(UIColor.systemGray), style: StrokeStyle(lineWidth: 2))
|
||||
)
|
||||
Text(theme.title)
|
||||
.foregroundColor(textColor)
|
||||
.font(.body)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10, style: .continuous)
|
||||
.fill(selectedTheme == theme ? selectedTheme.currentTheme.bgColor : .clear)
|
||||
.padding(-5)
|
||||
)
|
||||
}
|
||||
|
||||
private func selectTheme(_ theme: Theme) {
|
||||
// Save theme value
|
||||
GroupUserDefaults.groupDefaults.set(theme.rawValue, forKey: UserDefaultsStore.Keys.theme.rawValue)
|
||||
GroupUserDefaults.groupDefaults.synchronize()
|
||||
|
||||
withAnimation(.easeInOut(duration: 0.2)) {
|
||||
selectedTheme = theme
|
||||
}
|
||||
|
||||
changeTextColor(forTheme: theme)
|
||||
EventLogger.log(event: "change_theme_id", withData: ["id": theme.rawValue])
|
||||
}
|
||||
|
||||
private func changeTextColor(forTheme theme: Theme) {
|
||||
if [Theme.iFeel, Theme.system].contains(theme) {
|
||||
let currentSystemScheme = UITraitCollection.current.userInterfaceStyle
|
||||
|
||||
Reference in New Issue
Block a user