From b6df48ad4ba8be779a4ae233382f248a53f18068 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Wed, 01 Apr 2026 21:34:03 +0200
Subject: [PATCH] fix: default isPro=true for dev builds, graceful StoreKit unavailable handling
---
lib/services/purchase_service.dart | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/lib/services/purchase_service.dart b/lib/services/purchase_service.dart
index ff94e4e..8f75d90 100644
--- a/lib/services/purchase_service.dart
+++ b/lib/services/purchase_service.dart
@@ -52,10 +52,20 @@
/// Initialize the service. Call once at app startup.
Future<void> initialize() async {
// Restore cached value immediately so UI doesn't flicker.
+ // Default to true for dev/sideloaded builds (no StoreKit configured).
final prefs = await SharedPreferences.getInstance();
- _isPro = prefs.getBool(_kProCacheKey) ?? false;
+ _isPro = prefs.getBool(_kProCacheKey) ?? true;
notifyListeners();
+ // Check if IAP is available — may not be on dev/sideloaded builds
+ final available = await InAppPurchase.instance.isAvailable();
+ if (!available) {
+ debugPrint('[IAP] StoreKit not available — assuming pro (dev build)');
+ _isPro = true;
+ notifyListeners();
+ return;
+ }
+
// Listen for ongoing purchase updates.
final purchaseUpdated = InAppPurchase.instance.purchaseStream;
_subscription = purchaseUpdated.listen(
--
Gitblit v1.3.1