- Wrap 30+ production print() statements in #if DEBUG guards across 18 files - Add VoiceOver labels, hints, and traits to Watch app, Live Activities, widgets - Add .accessibilityAddTraits(.isButton) to 15+ onTapGesture views - Add text alternatives for color-only indicators (progress dots, mood circles) - Localize raw string literals in NoteEditorView, EntryDetailView, widgets - Replace 25+ silent try? with do/catch + AppLogger error logging - Replace hardcoded font sizes with semantic Dynamic Type fonts - Fix FIXME in IconPickerView (log icon change errors) - Extract magic animation delays to named constants across 8 files - Add widget empty state "Log your first mood!" messaging - Hide decorative images from VoiceOver, add labels to ColorPickers - Remove stale TODO in Color+Codable (alpha change deferred for migration) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
72 lines
3.4 KiB
Swift
72 lines
3.4 KiB
Swift
//
|
|
// ImagePackPickerView.swift
|
|
// Reflect (iOS)
|
|
//
|
|
// Created by Trey Tartt on 4/2/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ImagePackPickerView: View {
|
|
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
|
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
|
@AppStorage(UserDefaultsStore.Keys.moodImages.rawValue, store: GroupUserDefaults.groupDefaults) private var imagePack: MoodImages = .FontAwesome
|
|
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
Text(String(customMoodTintUpdateNumber))
|
|
.hidden()
|
|
theme.currentTheme.secondaryBGColor
|
|
VStack {
|
|
ForEach(MoodImages.allCases, id: \.rawValue) { images in
|
|
ZStack {
|
|
VStack {
|
|
HStack {
|
|
ForEach(Mood.allValues, id: \.self) { mood in
|
|
images.icon(forMood: mood)
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(width: 35, height: 35)
|
|
.foregroundColor(
|
|
moodTint.color(forMood: mood)
|
|
)
|
|
.accessibilityLabel(mood.strValue)
|
|
}
|
|
.frame(minWidth: 0, maxWidth: .infinity)
|
|
}
|
|
.contentShape(Rectangle())
|
|
.background(
|
|
RoundedRectangle(cornerRadius: 10, style: .continuous)
|
|
.fill(imagePack == images ? theme.currentTheme.bgColor : .clear)
|
|
.padding([.top, .bottom], -3)
|
|
)
|
|
.accessibilityIdentifier(AccessibilityID.Customize.imagePackOption(String(describing: images)))
|
|
.onTapGesture {
|
|
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
|
|
impactMed.impactOccurred()
|
|
imagePack = images
|
|
AnalyticsManager.shared.track(.iconPackChanged(packId: images.rawValue))
|
|
}
|
|
.accessibilityAddTraits(.isButton)
|
|
.accessibilityLabel(String(localized: "Select \(String(describing: images)) icon pack"))
|
|
if images.rawValue != (MoodImages.allCases.sorted(by: { $0.rawValue > $1.rawValue }).first?.rawValue) ?? 0 {
|
|
Divider()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.padding()
|
|
}
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
|
}
|
|
}
|
|
|
|
struct ImagePackPickerView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
ImagePackPickerView()
|
|
}
|
|
}
|