Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] guard stale referral and Cast results

r4khul9fd1a47b2659
diff --git a/mobile/apps/photos/lib/ui/growth/referral_screen.dart b/mobile/apps/photos/lib/ui/growth/referral_screen.dart
index bb7f86cd96..34acc85478 100644
--- a/mobile/apps/photos/lib/ui/growth/referral_screen.dart
+++ b/mobile/apps/photos/lib/ui/growth/referral_screen.dart
@@ -25,7 +25,11 @@ class ReferralScreen extends StatefulWidget {
bool showLoadingDialog = false,
}) async {
final dialog = showLoadingDialog
- ? createProgressDialog(context, context.strings.pleaseWait)
+ ? createProgressDialog(
+ context,
+ context.strings.pleaseWait,
+ isDismissible: true,
+ )
: null;
if (dialog != null) await dialog.show();
@@ -33,13 +37,15 @@ class ReferralScreen extends StatefulWidget {
try {
data = await _fetchData();
} catch (error) {
- if (dialog != null) await dialog.hide();
- if (!context.mounted) return;
+ if (dialog != null && !await dialog.hide()) return;
+ if (!context.mounted || ModalRoute.of(context)?.isCurrent != true) {
+ return;
+ }
await showGenericErrorDialog(context: context, error: error);
return;
}
- if (dialog != null) await dialog.hide();
- if (!context.mounted) return;
+ if (dialog != null && !await dialog.hide()) return;
+ if (!context.mounted || ModalRoute.of(context)?.isCurrent != true) return;
await routeToPage(context, ReferralScreen(initialData: data));
}
diff --git a/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart b/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart
index fec6352126..72cbfe1cc5 100644
--- a/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart
@@ -27,11 +27,13 @@ class CastSettingsPage extends StatelessWidget {
NetworkClient.instance.enteDio,
).getAllCastSessions();
} catch (error) {
- if (!context.mounted) return;
+ if (!context.mounted || ModalRoute.of(context)?.isCurrent != true) {
+ return;
+ }
await showGenericErrorDialog(context: context, error: error);
return;
}
- if (!context.mounted) return;
+ if (!context.mounted || ModalRoute.of(context)?.isCurrent != true) return;
await routeToPage(context, CastSettingsPage(initialSessions: sessions));
}