Fix vote widget to show actual voting date instead of hardcoded Today
When rating for a previous day (e.g., rating last night for yesterday), the medium vote widget now correctly shows the date like "Sun, Dec 28" instead of always displaying "Today". - Add votingDate property to VoteWidgetEntry - Add dynamic date formatting in VotedStatsView - Update all preview entries with votingDate parameter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -154,7 +154,7 @@ struct VoteWidgetProvider: TimelineProvider {
|
||||
// Show sample "already voted" state for widget picker preview
|
||||
let sampleStats = MoodStats(totalEntries: 30, moodCounts: [.great: 10, .good: 12, .average: 5, .bad: 2, .horrible: 1])
|
||||
let promptText = UserDefaultsStore.personalityPackable().randomPushNotificationStrings().body
|
||||
return VoteWidgetEntry(date: Date(), hasSubscription: true, hasVotedToday: true, todaysMood: .good, stats: sampleStats, promptText: promptText)
|
||||
return VoteWidgetEntry(date: Date(), votingDate: Date(), hasSubscription: true, hasVotedToday: true, todaysMood: .good, stats: sampleStats, promptText: promptText)
|
||||
}
|
||||
|
||||
func getSnapshot(in context: Context, completion: @escaping (VoteWidgetEntry) -> Void) {
|
||||
@@ -162,7 +162,7 @@ struct VoteWidgetProvider: TimelineProvider {
|
||||
if context.isPreview {
|
||||
let sampleStats = MoodStats(totalEntries: 30, moodCounts: [.great: 10, .good: 12, .average: 5, .bad: 2, .horrible: 1])
|
||||
let promptText = UserDefaultsStore.personalityPackable().randomPushNotificationStrings().body
|
||||
let entry = VoteWidgetEntry(date: Date(), hasSubscription: true, hasVotedToday: true, todaysMood: .good, stats: sampleStats, promptText: promptText)
|
||||
let entry = VoteWidgetEntry(date: Date(), votingDate: Date(), hasSubscription: true, hasVotedToday: true, todaysMood: .good, stats: sampleStats, promptText: promptText)
|
||||
completion(entry)
|
||||
return
|
||||
}
|
||||
@@ -254,6 +254,7 @@ struct VoteWidgetProvider: TimelineProvider {
|
||||
|
||||
return VoteWidgetEntry(
|
||||
date: Date(),
|
||||
votingDate: votingDate,
|
||||
hasSubscription: hasSubscription,
|
||||
hasVotedToday: hasVotedToday,
|
||||
todaysMood: todaysMood,
|
||||
|
||||
Reference in New Issue
Block a user