Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prefetch family state before opening family page

ashilkne8a05dad7d45
diff --git a/mobile/apps/photos/lib/services/account/billing_service.dart b/mobile/apps/photos/lib/services/account/billing_service.dart
index 053cb4cb57..8441fce3bc 100644
--- a/mobile/apps/photos/lib/services/account/billing_service.dart
+++ b/mobile/apps/photos/lib/services/account/billing_service.dart
@@ -137,6 +137,7 @@ class BillingService {
BuildContext context,
UserDetails userDetails, {
bool popOnFreeAdvertViewPlans = false,
+ bool refreshOnOpen = true,
}) async {
try {
await routeToPage(
@@ -144,6 +145,7 @@ class BillingService {
FamilyPlanPage(
initialUserDetails: userDetails,
popOnFreeAdvertViewPlans: popOnFreeAdvertViewPlans,
+ refreshOnOpen: refreshOnOpen,
),
);
} catch (e) {
diff --git a/mobile/apps/photos/lib/ui/family/family_plan_page.dart b/mobile/apps/photos/lib/ui/family/family_plan_page.dart
index 0efb7847d5..d57805d347 100644
--- a/mobile/apps/photos/lib/ui/family/family_plan_page.dart
+++ b/mobile/apps/photos/lib/ui/family/family_plan_page.dart
@@ -25,11 +25,13 @@ class FamilyPlanPage extends StatefulWidget {
const FamilyPlanPage({
required this.initialUserDetails,
this.popOnFreeAdvertViewPlans = false,
+ this.refreshOnOpen = true,
super.key,
});
final UserDetails initialUserDetails;
final bool popOnFreeAdvertViewPlans;
+ final bool refreshOnOpen;
@override
State<FamilyPlanPage> createState() => _FamilyPlanPageState();
@@ -80,7 +82,9 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
});
return;
}
- unawaited(_refreshUserDetails());
+ if (widget.refreshOnOpen) {
+ unawaited(_refreshUserDetails());
+ }
if (_isFreeUser) {
unawaited(_loadStartingPrice());
}
diff --git a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
index 039c699bd3..5574a44117 100644
--- a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
@@ -373,13 +373,16 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
Icons.chevron_right_outlined,
color: colorScheme.strokeBase,
),
+ showOnlyLoadingState: true,
+ surfaceExecutionStates: true,
onTap: () async {
- unawaited(
- _billingService.launchFamilyPortal(
- context,
- _userDetails,
- popOnFreeAdvertViewPlans: true,
- ),
+ final userDetails =
+ await _userService.getUserDetailsV2(memoryCount: false);
+ await _billingService.launchFamilyPortal(
+ context,
+ userDetails,
+ popOnFreeAdvertViewPlans: true,
+ refreshOnOpen: false,
);
},
),
diff --git a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
index e6827121e2..5eed11afee 100644
--- a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
@@ -259,12 +259,16 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Icons.chevron_right_outlined,
color: colorScheme.strokeBase,
),
+ showOnlyLoadingState: true,
+ surfaceExecutionStates: true,
onTap: () async {
- // ignore: unawaited_futures
- _billingService.launchFamilyPortal(
+ final userDetails =
+ await _userService.getUserDetailsV2(memoryCount: false);
+ await _billingService.launchFamilyPortal(
context,
- _userDetails,
+ userDetails,
popOnFreeAdvertViewPlans: true,
+ refreshOnOpen: false,
);
},
),
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index e73f9f4384..44ed087aed 100644
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@ -482,10 +482,15 @@ class _SettingsBody extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
showOnlyLoadingState: true,
+ surfaceExecutionStates: true,
onTap: () async {
final userDetails =
await UserService.instance.getUserDetailsV2(memoryCount: false);
- await billingService.launchFamilyPortal(context, userDetails);
+ await billingService.launchFamilyPortal(
+ context,
+ userDetails,
+ refreshOnOpen: false,
+ );
},
),
MenuItemWidgetNew(