Fix widget issues and add subscription bypass toggle
Widget fixes: - Fix App Group ID mismatch in iOS app entitlements (was group.com.tt.ifeel.ifeelDebug, now group.com.tt.ifeelDebug) - Fix date bug where missing entries all showed same date - Add sample data preview for widget picker (shows realistic mood data) - Add widgetDisplayName to Mood enum for widget localization - Update Mood Vote widget preview to show post-vote state - Attempt to fix interactive widget buttons (openAppWhenRun: false) Developer improvements: - Add IAPManager.bypassSubscription toggle for testing without subscription 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import AppIntents
|
||||
struct VoteMoodIntent: AppIntent {
|
||||
static var title: LocalizedStringResource = "Vote Mood"
|
||||
static var description = IntentDescription("Record your mood for today")
|
||||
static var openAppWhenRun: Bool { false }
|
||||
|
||||
@Parameter(title: "Mood")
|
||||
var moodValue: Int
|
||||
@@ -26,6 +27,7 @@ struct VoteMoodIntent: AppIntent {
|
||||
self.moodValue = mood.rawValue
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func perform() async throws -> some IntentResult {
|
||||
let mood = Mood(rawValue: moodValue) ?? .average
|
||||
let votingDate = ShowBasedOnVoteLogics.getCurrentVotingDate(onboardingData: UserDefaultsStore.getOnboarding())
|
||||
@@ -48,10 +50,19 @@ struct VoteMoodIntent: AppIntent {
|
||||
|
||||
struct VoteWidgetProvider: TimelineProvider {
|
||||
func placeholder(in context: Context) -> VoteWidgetEntry {
|
||||
VoteWidgetEntry(date: Date(), hasSubscription: true, hasVotedToday: false, todaysMood: nil, stats: nil)
|
||||
// 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])
|
||||
return VoteWidgetEntry(date: Date(), hasSubscription: true, hasVotedToday: true, todaysMood: .good, stats: sampleStats)
|
||||
}
|
||||
|
||||
func getSnapshot(in context: Context, completion: @escaping (VoteWidgetEntry) -> Void) {
|
||||
// Show sample data for widget picker preview
|
||||
if context.isPreview {
|
||||
let sampleStats = MoodStats(totalEntries: 30, moodCounts: [.great: 10, .good: 12, .average: 5, .bad: 2, .horrible: 1])
|
||||
let entry = VoteWidgetEntry(date: Date(), hasSubscription: true, hasVotedToday: true, todaysMood: .good, stats: sampleStats)
|
||||
completion(entry)
|
||||
return
|
||||
}
|
||||
let entry = createEntry()
|
||||
completion(entry)
|
||||
}
|
||||
@@ -210,13 +221,12 @@ struct MoodButton: View {
|
||||
.foregroundColor(moodTint.color(forMood: mood))
|
||||
|
||||
if !isCompact {
|
||||
Text(mood.strValue)
|
||||
Text(mood.widgetDisplayName)
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +258,7 @@ struct VotedStatsView: View {
|
||||
Text("Today")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
Text(mood.strValue)
|
||||
Text(mood.widgetDisplayName)
|
||||
.font(.headline)
|
||||
.foregroundColor(moodTint.color(forMood: mood))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user