Skip to content

armgit / ente

Public Imported from GitHub
0

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

Surface family refresh errors before portal launch

ashilknf2744a90abaa
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 5574a44117..634b719472 100644
--- a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
@@ -376,8 +376,20 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
showOnlyLoadingState: true,
surfaceExecutionStates: true,
onTap: () async {
- final userDetails =
- await _userService.getUserDetailsV2(memoryCount: false);
+ late final UserDetails userDetails;
+ try {
+ userDetails =
+ await _userService.getUserDetailsV2(memoryCount: false);
+ } catch (error) {
+ if (!context.mounted) {
+ return;
+ }
+ await showGenericErrorDialog(context: context, error: error);
+ return;
+ }
+ if (!context.mounted) {
+ return;
+ }
await _billingService.launchFamilyPortal(
context,
userDetails,
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 5eed11afee..1290ceba24 100644
--- a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
@@ -262,8 +262,20 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
showOnlyLoadingState: true,
surfaceExecutionStates: true,
onTap: () async {
- final userDetails =
- await _userService.getUserDetailsV2(memoryCount: false);
+ late final UserDetails userDetails;
+ try {
+ userDetails =
+ await _userService.getUserDetailsV2(memoryCount: false);
+ } catch (error) {
+ if (!context.mounted) {
+ return;
+ }
+ await showGenericErrorDialog(context: context, error: error);
+ return;
+ }
+ if (!context.mounted) {
+ return;
+ }
await _billingService.launchFamilyPortal(
context,
userDetails,
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index 44ed087aed..aef62e5b86 100644
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@ -6,6 +6,7 @@ import "package:log_viewer/log_viewer.dart";
import "package:photos/core/configuration.dart";
import "package:photos/emergency/emergency_page.dart";
import "package:photos/generated/l10n.dart";
+import "package:photos/models/user_details.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/account/user_service.dart";
import "package:photos/services/local_authentication_service.dart";
@@ -484,8 +485,20 @@ class _SettingsBody extends StatelessWidget {
showOnlyLoadingState: true,
surfaceExecutionStates: true,
onTap: () async {
- final userDetails =
- await UserService.instance.getUserDetailsV2(memoryCount: false);
+ late final UserDetails userDetails;
+ try {
+ userDetails = await UserService.instance
+ .getUserDetailsV2(memoryCount: false);
+ } catch (error) {
+ if (!context.mounted) {
+ return;
+ }
+ await showGenericErrorDialog(context: context, error: error);
+ return;
+ }
+ if (!context.mounted) {
+ return;
+ }
await billingService.launchFamilyPortal(
context,
userDetails,