fix: issue #150 - add haptic feedback option

Automated fix by Tony CI v3.
Refs #150

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
treyt
2026-03-10 16:13:08 -05:00
parent 2c2456019c
commit 1303cb8cbc
5 changed files with 669 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ struct AddMoodHeaderView: View {
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
@AppStorage(UserDefaultsStore.Keys.votingLayoutStyle.rawValue, store: GroupUserDefaults.groupDefaults) private var votingLayoutStyle: Int = 0
@AppStorage(UserDefaultsStore.Keys.celebrationAnimation.rawValue, store: GroupUserDefaults.groupDefaults) private var celebrationAnimationIndex: Int = 0
@AppStorage(UserDefaultsStore.Keys.hapticFeedbackEnabled.rawValue, store: GroupUserDefaults.groupDefaults) private var hapticFeedbackEnabled = true
private var textColor: Color { theme.currentTheme.labelColor }
@@ -90,14 +91,16 @@ struct AddMoodHeaderView: View {
}
private func addItem(withMood mood: Mood) {
let impactFeedback = UIImpactFeedbackGenerator(style: .medium)
impactFeedback.impactOccurred()
// Store mood, date, and use saved animation preference
celebrationMood = mood
celebrationDate = ShowBasedOnVoteLogics.getCurrentVotingDate(onboardingData: onboardingData)
celebrationAnimation = CelebrationAnimationType.fromIndex(celebrationAnimationIndex)
// Play haptic feedback matching the selected animation
if hapticFeedbackEnabled {
HapticFeedbackManager.shared.play(for: celebrationAnimation)
}
// Show celebration - mood will be saved when animation completes
withAnimation(.easeInOut(duration: 0.3)) {
showCelebration = true