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:
@@ -24,6 +24,11 @@ enum SubscriptionState: Equatable {
|
||||
@MainActor
|
||||
class IAPManager: ObservableObject {
|
||||
|
||||
// MARK: - Debug Toggle
|
||||
|
||||
/// Set to `true` to bypass all subscription checks and grant full access (for development only)
|
||||
static let bypassSubscription = true
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
static let subscriptionGroupID = "2CFE4C4F"
|
||||
@@ -59,6 +64,7 @@ class IAPManager: ObservableObject {
|
||||
}
|
||||
|
||||
var hasFullAccess: Bool {
|
||||
if Self.bypassSubscription { return true }
|
||||
switch state {
|
||||
case .subscribed, .inTrial:
|
||||
return true
|
||||
@@ -68,6 +74,7 @@ class IAPManager: ObservableObject {
|
||||
}
|
||||
|
||||
var shouldShowPaywall: Bool {
|
||||
if Self.bypassSubscription { return false }
|
||||
switch state {
|
||||
case .trialExpired, .expired:
|
||||
return true
|
||||
@@ -134,7 +141,8 @@ class IAPManager: ObservableObject {
|
||||
|
||||
/// Sync subscription status to UserDefaults for widget access
|
||||
private func syncSubscriptionStatusToUserDefaults() {
|
||||
GroupUserDefaults.groupDefaults.set(hasFullAccess, forKey: UserDefaultsStore.Keys.hasActiveSubscription.rawValue)
|
||||
let accessValue = Self.bypassSubscription ? true : hasFullAccess
|
||||
GroupUserDefaults.groupDefaults.set(accessValue, forKey: UserDefaultsStore.Keys.hasActiveSubscription.rawValue)
|
||||
}
|
||||
|
||||
/// Restore purchases
|
||||
|
||||
Reference in New Issue
Block a user