diff --git a/lib/infrastructure/purchase_service.dart b/lib/infrastructure/purchase_service.dart index 62ef3bae8..e30924d47 100644 --- a/lib/infrastructure/purchase_service.dart +++ b/lib/infrastructure/purchase_service.dart @@ -12,10 +12,11 @@ import 'package:shiori/domain/services/purchase_service.dart'; import 'package:shiori/infrastructure/secrets.dart'; class PurchaseServiceImpl implements PurchaseService { - bool _initialized = false; - final LoggingService _loggingService; + bool _initialized = false; + List? _unlockedFeatures; + @override bool get isInitialized => _initialized; @@ -129,6 +130,7 @@ class PurchaseServiceImpl implements PurchaseService { } try { + _unlockedFeatures = null; final features = await _getUnlockedFeatures(entitlementIdentifier: entitlementIdentifier); return features.isNotEmpty; } catch (e, s) { @@ -156,6 +158,10 @@ class PurchaseServiceImpl implements PurchaseService { Future> _getUnlockedFeatures({String? entitlementIdentifier}) async { try { + if (_unlockedFeatures != null){ + return _unlockedFeatures!; + } + if (!await isPlatformSupported()) { return []; } @@ -167,11 +173,13 @@ class PurchaseServiceImpl implements PurchaseService { final transactions = await Purchases.restoreTransactions(); if (entitlementIdentifier.isNullEmptyOrWhitespace) { final activeEntitlements = transactions.entitlements.active.values.any((el) => el.isActive); - return activeEntitlements ? AppUnlockedFeature.values : []; + _unlockedFeatures = activeEntitlements ? AppUnlockedFeature.values : []; + return _unlockedFeatures!; } final entitlement = transactions.entitlements.active.values.firstWhereOrNull((el) => el.identifier == entitlementIdentifier && el.isActive); - return entitlement != null ? AppUnlockedFeature.values : []; + _unlockedFeatures = entitlement != null ? AppUnlockedFeature.values : []; + return _unlockedFeatures!; } catch (e) { rethrow; } diff --git a/lib/presentation/donations/donations_bottom_sheet.dart b/lib/presentation/donations/donations_bottom_sheet.dart index 6dffc36ae..3b3b483c4 100644 --- a/lib/presentation/donations/donations_bottom_sheet.dart +++ b/lib/presentation/donations/donations_bottom_sheet.dart @@ -177,7 +177,11 @@ class _DonationItem extends StatelessWidget { return InkWell( onTap: onTap, child: Card( - color: isSelected ? theme.colorScheme.primary.withOpacity(0.5) : null, + color: isSelected + ? theme.colorScheme.primary.withOpacity(0.5) + : theme.scaffoldBackgroundColor == Colors.black + ? theme.cardColor.withOpacity(0.5) + : theme.cardColor, margin: Styles.edgeInsetAll10, child: Padding( padding: Styles.edgeInsetAll10, diff --git a/lib/presentation/shared/extensions/app_theme_type_extensions.dart b/lib/presentation/shared/extensions/app_theme_type_extensions.dart index 31dabd796..7247e1e1a 100644 --- a/lib/presentation/shared/extensions/app_theme_type_extensions.dart +++ b/lib/presentation/shared/extensions/app_theme_type_extensions.dart @@ -56,7 +56,7 @@ extension AppThemeTypeExtensions on AppAccentColorType { return dark; } - const almostBlackColor = Color.fromARGB(255, 16, 16, 16); + const almostBlackColor = Color.fromARGB(255, 20, 20, 20); return dark.copyWith( scaffoldBackgroundColor: Colors.black, popupMenuTheme: const PopupMenuThemeData(color: almostBlackColor),