Преглед изворни кода

Allow folks with add_on to activate family (#1500)

Neeraj Gupta пре 1 година
родитељ
комит
12db3e858a
2 измењених фајлова са 6 додато и 1 уклоњено
  1. 4 0
      lib/models/user_details.dart
  2. 2 1
      lib/services/billing_service.dart

+ 4 - 0
lib/models/user_details.dart

@@ -33,6 +33,10 @@ class UserDetails {
     return familyData?.members?.isNotEmpty ?? false;
   }
 
+  bool hasPaidAddon() {
+    return bonusData?.getAddOnBonuses().isNotEmpty ?? false;
+  }
+
   bool isFamilyAdmin() {
     assert(isPartOfFamily(), "verify user is part of family before calling");
     final FamilyMember currentUserMember = familyData!.members!

+ 2 - 1
lib/services/billing_service.dart

@@ -166,7 +166,8 @@ class BillingService {
     BuildContext context,
     UserDetails userDetails,
   ) async {
-    if (userDetails.subscription.productID == freeProductID) {
+    if (userDetails.subscription.productID == freeProductID &&
+        !userDetails.hasPaidAddon()) {
       await showErrorDialog(
         context,
         S.of(context).familyPlans,