Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Allow folks with add_on to activate family

Neeraj Guptabf08e938ff7d
diff --git a/lib/models/user_details.dart b/lib/models/user_details.dart
index ef1fdbbd76..f107a2e6b0 100644
--- a/lib/models/user_details.dart
+++ b/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!
diff --git a/lib/services/billing_service.dart b/lib/services/billing_service.dart
index 24ec308fbd..6891089e39 100644
--- a/lib/services/billing_service.dart
+++ b/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,