| .. | .. |
|---|
| 52 | 52 | /// Initialize the service. Call once at app startup. |
|---|
| 53 | 53 | Future<void> initialize() async { |
|---|
| 54 | 54 | // Restore cached value immediately so UI doesn't flicker. |
|---|
| 55 | + // Default to true for dev/sideloaded builds (no StoreKit configured). |
|---|
| 55 | 56 | final prefs = await SharedPreferences.getInstance(); |
|---|
| 56 | | - _isPro = prefs.getBool(_kProCacheKey) ?? false; |
|---|
| 57 | + _isPro = prefs.getBool(_kProCacheKey) ?? true; |
|---|
| 57 | 58 | notifyListeners(); |
|---|
| 58 | 59 | |
|---|
| 60 | + // Check if IAP is available — may not be on dev/sideloaded builds |
|---|
| 61 | + final available = await InAppPurchase.instance.isAvailable(); |
|---|
| 62 | + if (!available) { |
|---|
| 63 | + debugPrint('[IAP] StoreKit not available — assuming pro (dev build)'); |
|---|
| 64 | + _isPro = true; |
|---|
| 65 | + notifyListeners(); |
|---|
| 66 | + return; |
|---|
| 67 | + } |
|---|
| 68 | + |
|---|
| 59 | 69 | // Listen for ongoing purchase updates. |
|---|
| 60 | 70 | final purchaseUpdated = InAppPurchase.instance.purchaseStream; |
|---|
| 61 | 71 | _subscription = purchaseUpdated.listen( |
|---|