From 89e1efbde4b989d5c4d2f1fa054a53a77c522f7c Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:54:57 +0530 Subject: [PATCH 1/9] [auth] Opt out of flutter deeplink for ios --- auth/ios/Podfile.lock | 6 ------ auth/ios/Runner/Info.plist | 2 ++ auth/linux/flutter/generated_plugin_registrant.cc | 4 ---- auth/linux/flutter/generated_plugins.cmake | 1 - auth/macos/Flutter/GeneratedPluginRegistrant.swift | 2 -- auth/windows/flutter/generated_plugin_registrant.cc | 3 --- auth/windows/flutter/generated_plugins.cmake | 1 - 7 files changed, 2 insertions(+), 17 deletions(-) diff --git a/auth/ios/Podfile.lock b/auth/ios/Podfile.lock index c6bbdc5b5d..0bf225cf95 100644 --- a/auth/ios/Podfile.lock +++ b/auth/ios/Podfile.lock @@ -82,8 +82,6 @@ PODS: - qr_code_scanner (0.2.0): - Flutter - MTBBarcodeScanner - - scan (0.0.1): - - Flutter - SDWebImage (5.20.0): - SDWebImage/Core (= 5.20.0) - SDWebImage/Core (5.20.0) @@ -146,7 +144,6 @@ DEPENDENCIES: - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - privacy_screen (from `.symlinks/plugins/privacy_screen/ios`) - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) - - scan (from `.symlinks/plugins/scan/ios`) - sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) @@ -208,8 +205,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/privacy_screen/ios" qr_code_scanner: :path: ".symlinks/plugins/qr_code_scanner/ios" - scan: - :path: ".symlinks/plugins/scan/ios" sentry_flutter: :path: ".symlinks/plugins/sentry_flutter/ios" share_plus: @@ -250,7 +245,6 @@ SPEC CHECKSUMS: path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 privacy_screen: 1a131c052ceb3c3659934b003b0d397c2381a24e qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e - scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 SDWebImage: 73c6079366fea25fa4bb9640d5fb58f0893facd8 Sentry: f8374b5415bc38dfb5645941b3ae31230fbeae57 sentry_flutter: 0eb93e5279eb41e2392212afe1ccd2fecb4f8cbe diff --git a/auth/ios/Runner/Info.plist b/auth/ios/Runner/Info.plist index 7425bbfa22..f9abe73002 100644 --- a/auth/ios/Runner/Info.plist +++ b/auth/ios/Runner/Info.plist @@ -63,6 +63,8 @@ Main UIStatusBarHidden + FlutterDeepLinkingEnabled + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/auth/linux/flutter/generated_plugin_registrant.cc b/auth/linux/flutter/generated_plugin_registrant.cc index eaad24c808..2fdf0b385a 100644 --- a/auth/linux/flutter/generated_plugin_registrant.cc +++ b/auth/linux/flutter/generated_plugin_registrant.cc @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -32,9 +31,6 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) gtk_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin"); gtk_plugin_register_with_registrar(gtk_registrar); - g_autoptr(FlPluginRegistrar) rive_common_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "RivePlugin"); - rive_plugin_register_with_registrar(rive_common_registrar); g_autoptr(FlPluginRegistrar) screen_retriever_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); diff --git a/auth/linux/flutter/generated_plugins.cmake b/auth/linux/flutter/generated_plugins.cmake index 4622237636..7ad28f0761 100644 --- a/auth/linux/flutter/generated_plugins.cmake +++ b/auth/linux/flutter/generated_plugins.cmake @@ -7,7 +7,6 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_local_authentication flutter_secure_storage_linux gtk - rive_common screen_retriever sentry_flutter sodium_libs diff --git a/auth/macos/Flutter/GeneratedPluginRegistrant.swift b/auth/macos/Flutter/GeneratedPluginRegistrant.swift index 16f5d7096d..5c6cfc0c6d 100644 --- a/auth/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/auth/macos/Flutter/GeneratedPluginRegistrant.swift @@ -16,7 +16,6 @@ import flutter_secure_storage_macos import local_auth_darwin import package_info_plus import path_provider_foundation -import rive_common import screen_retriever import sentry_flutter import share_plus @@ -40,7 +39,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLALocalAuthPlugin.register(with: registry.registrar(forPlugin: "FLALocalAuthPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) - RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin")) ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) diff --git a/auth/windows/flutter/generated_plugin_registrant.cc b/auth/windows/flutter/generated_plugin_registrant.cc index ce596780c3..bfed849740 100644 --- a/auth/windows/flutter/generated_plugin_registrant.cc +++ b/auth/windows/flutter/generated_plugin_registrant.cc @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -37,8 +36,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); LocalAuthPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("LocalAuthPlugin")); - RivePluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("RivePlugin")); ScreenRetrieverPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); SharePlusWindowsPluginCApiRegisterWithRegistrar( diff --git a/auth/windows/flutter/generated_plugins.cmake b/auth/windows/flutter/generated_plugins.cmake index 484926c0c2..cc78f72ebb 100644 --- a/auth/windows/flutter/generated_plugins.cmake +++ b/auth/windows/flutter/generated_plugins.cmake @@ -10,7 +10,6 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_local_authentication flutter_secure_storage_windows local_auth_windows - rive_common screen_retriever share_plus sodium_libs From a71c284708fcfcd5b000a050a0e35e0e4172e61f Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:55:22 +0530 Subject: [PATCH 2/9] [auth] Fix bug in trash deletion --- auth/lib/store/code_store.dart | 17 ----------------- auth/lib/ui/code_widget.dart | 7 ++++++- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/auth/lib/store/code_store.dart b/auth/lib/store/code_store.dart index 44c62f83ec..e6f984f3eb 100644 --- a/auth/lib/store/code_store.dart +++ b/auth/lib/store/code_store.dart @@ -64,22 +64,6 @@ class CodeStore { return true; } - Future updateCodeIndex(Code code) async { - final key = code.generatedID!; - - _cacheCodes.remove(key); - int deletedIndex = code.display.position; - - _cacheCodes.forEach((key, c) async { - if (c.display.position > deletedIndex) { - Code updatedCode = c.copyWith( - display: c.display.copyWith(position: c.display.position - 1), - ); - await addCode(updatedCode); - } - }); - } - Future> getAllCodes({ AccountMode? accountMode, bool sortCodes = true, @@ -179,7 +163,6 @@ class CodeStore { Future removeCode(Code code, {AccountMode? accountMode}) async { final mode = accountMode ?? _authenticatorService.getAccountMode(); await _authenticatorService.deleteEntry(code.generatedID!, mode); - await updateCodeIndex(code); Bus.instance.fire(CodesUpdatedEvent()); } diff --git a/auth/lib/ui/code_widget.dart b/auth/lib/ui/code_widget.dart index 0c311d3d9d..442b118314 100644 --- a/auth/lib/ui/code_widget.dart +++ b/auth/lib/ui/code_widget.dart @@ -645,7 +645,12 @@ class _CodeWidgetState extends State { firstButtonLabel: l10n.delete, isCritical: true, firstButtonOnTap: () async { - await CodeStore.instance.removeCode(widget.code); + try { + await CodeStore.instance.removeCode(widget.code); + } catch (e,s) { + logger.severe('Failed to delete code',e,s); + showGenericErrorDialog(context: context, error: e).ignore(); + } }, ); } From a15556264ad2e2b360e9b95e45169ada80c0e154 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:23:31 +0530 Subject: [PATCH 3/9] [auth]Skip wait for online sync while parsing otpauth deeplink --- auth/lib/ui/home_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dart index 0f76dac047..81bf2de65d 100644 --- a/auth/lib/ui/home_page.dart +++ b/auth/lib/ui/home_page.dart @@ -676,7 +676,7 @@ class _HomePageState extends State { try { final newCode = Code.fromOTPAuthUrl(link); getNextTotp(newCode); - CodeStore.instance.addCode(newCode); + CodeStore.instance.addCode(newCode, shouldSync: false); _focusNewCode(newCode); } catch (e, s) { showGenericErrorDialog( From 3fa18b35602f11169b8f6fd3d913d1554fead13f Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:30:04 +0530 Subject: [PATCH 4/9] [auth] Handle deeplink in offline mode --- auth/lib/ui/home_page.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dart index 81bf2de65d..8e81d43e17 100644 --- a/auth/lib/ui/home_page.dart +++ b/auth/lib/ui/home_page.dart @@ -669,7 +669,10 @@ class _HomePageState extends State { } void _handleDeeplink(BuildContext context, String? link) { - if (!Configuration.instance.hasConfiguredAccount() || link == null) { + bool isAccountConfigured = Configuration.instance.hasConfiguredAccount(); + bool isOfflineModeEnabled = Configuration.instance.hasOptedForOfflineMode() && + Configuration.instance.getOfflineSecretKey() != null; + if (!(isAccountConfigured || isOfflineModeEnabled) || link == null) { return; } if (mounted && link.toLowerCase().startsWith("otpauth://")) { From 2fc8d6e0c46c230d779bf4c22b5998ce07e388b7 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:34:13 +0530 Subject: [PATCH 5/9] [auth] Handle multiple invokation of same deeplink --- auth/lib/ui/home_page.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 { } 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 { 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); From ab5bda80747cbe1e7ba75ee3ab2c4670b9963f38 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:39:33 +0530 Subject: [PATCH 6/9] [auth] Remove privacy screen image --- auth/lib/utils/lock_screen_settings.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/lib/utils/lock_screen_settings.dart b/auth/lib/utils/lock_screen_settings.dart index 14a3579c7d..082fb1d6d0 100644 --- a/auth/lib/utils/lock_screen_settings.dart +++ b/auth/lib/utils/lock_screen_settings.dart @@ -90,7 +90,7 @@ class LockScreenSettings { : await PrivacyScreen.instance.enable( iosOptions: const PrivacyIosOptions( enablePrivacy: true, - privacyImageName: 'LaunchImage', + // privacyImageName: 'LaunchImage', ), androidOptions: const PrivacyAndroidOptions( enableSecure: true, From dc779ae53fc6ab2e53c95af47e8462f25cc7ec7b Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:40:28 +0530 Subject: [PATCH 7/9] [auth] Opt out of flutter default deeplinking --- auth/android/app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/auth/android/app/src/main/AndroidManifest.xml b/auth/android/app/src/main/AndroidManifest.xml index 518f1df65a..c8dcb3253f 100644 --- a/auth/android/app/src/main/AndroidManifest.xml +++ b/auth/android/app/src/main/AndroidManifest.xml @@ -46,6 +46,7 @@ + From 14e413effa6fc4183e76f3f2fc9c255965620c41 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:41:36 +0530 Subject: [PATCH 8/9] [auth] Bump version --- auth/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/pubspec.yaml b/auth/pubspec.yaml index 96d14522d9..19cb24eb95 100644 --- a/auth/pubspec.yaml +++ b/auth/pubspec.yaml @@ -1,7 +1,7 @@ name: ente_auth description: ente two-factor authenticator -version: 4.3.0+430 +version: 4.3.1+431 publish_to: none environment: From 58cb9f480f8ee8a015aa52e13937e0e53030719b Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:42:23 +0530 Subject: [PATCH 9/9] Clean up --- auth/lib/utils/lock_screen_settings.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/auth/lib/utils/lock_screen_settings.dart b/auth/lib/utils/lock_screen_settings.dart index 082fb1d6d0..848e867354 100644 --- a/auth/lib/utils/lock_screen_settings.dart +++ b/auth/lib/utils/lock_screen_settings.dart @@ -90,7 +90,6 @@ class LockScreenSettings { : await PrivacyScreen.instance.enable( iosOptions: const PrivacyIosOptions( enablePrivacy: true, - // privacyImageName: 'LaunchImage', ), androidOptions: const PrivacyAndroidOptions( enableSecure: true,