Skip to content

armgit / ente

Public Imported from GitHub
0

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

[auth] Handle multiple invokation of same deeplink

Neeraj Gupta2fc8d6e0c46c
diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dart
index 8e81d43e17..648c78eeb6 100644
--- a/auth/lib/ui/home_page.dart
+++ b/auth/lib/ui/home_page.dart
@@ -667,7 +667,7 @@ class _HomePageState extends State<HomePage> {
}
return false;
}
-
+ int lastScanTime = DateTime.now().millisecondsSinceEpoch - 1000;
void _handleDeeplink(BuildContext context, String? link) {
bool isAccountConfigured = Configuration.instance.hasConfiguredAccount();
bool isOfflineModeEnabled = Configuration.instance.hasOptedForOfflineMode() &&
@@ -675,6 +675,11 @@ class _HomePageState extends State<HomePage> {
if (!(isAccountConfigured || isOfflineModeEnabled) || link == null) {
return;
}
+ if (DateTime.now().millisecondsSinceEpoch - lastScanTime < 1000) {
+ _logger.info("Ignoring potential event for same deeplink");
+ return;
+ }
+ lastScanTime = DateTime.now().millisecondsSinceEpoch;
if (mounted && link.toLowerCase().startsWith("otpauth://")) {
try {
final newCode = Code.fromOTPAuthUrl(link);