Skip to content

armgit / ente

Public Imported from GitHub
0

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

Cache legacy flow authentication

Neeraj Gupta84ba4c4cfe83
diff --git a/mobile/apps/locker/lib/ui/utils/legacy_utils.dart b/mobile/apps/locker/lib/ui/utils/legacy_utils.dart
index dbf90bb4d8..a5791afd07 100644
--- a/mobile/apps/locker/lib/ui/utils/legacy_utils.dart
+++ b/mobile/apps/locker/lib/ui/utils/legacy_utils.dart
@@ -10,23 +10,28 @@ import "package:locker/services/configuration.dart";
///
/// In debug mode, authentication is bypassed.
Future<void> openLegacyPage(BuildContext context) async {
- final hasAuthenticated = kDebugMode ||
- await LocalAuthenticationService.instance.requestLocalAuthentication(
- context,
- "Authenticate to manage legacy contacts",
- );
- if (hasAuthenticated && context.mounted) {
+ var hasAuthenticatedForLegacyFlow = kDebugMode;
+ if (!hasAuthenticatedForLegacyFlow) {
+ hasAuthenticatedForLegacyFlow =
+ await LocalAuthenticationService.instance.requestLocalAuthentication(
+ context,
+ "Authenticate to manage legacy contacts",
+ );
+ }
+ if (hasAuthenticatedForLegacyFlow && context.mounted) {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return EmergencyPage(
config: Configuration.instance,
legacyKitAuthenticator: (context, reason) async {
- if (kDebugMode) {
+ if (hasAuthenticatedForLegacyFlow) {
return true;
}
- return LocalAuthenticationService.instance
+ hasAuthenticatedForLegacyFlow = await LocalAuthenticationService
+ .instance
.requestLocalAuthentication(context, reason);
+ return hasAuthenticatedForLegacyFlow;
},
);
},