Exhaustive file-by-file audit of every Swift file in the project (iOS app, Watch app, Widget extension). Every interactive UI element — buttons, toggles, pickers, links, menus, tap gestures, text editors, color pickers, photo pickers — now has an accessibilityIdentifier for XCUITest automation. 46 files changed across Shared/, Onboarding/, Watch App/, and Widget targets. Added ~100 new ID definitions covering settings debug controls, export/photo views, sharing templates, customization subviews, onboarding flows, tip modals, widget voting buttons, and watch mood buttons.
70 lines
3.2 KiB
Swift
70 lines
3.2 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))
|
|
}
|
|
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()
|
|
}
|
|
}
|