From 7261d2de63828590a01cc8451bb058234d44c708 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Fri, 3 Mar 2023 17:17:29 +0100 Subject: [PATCH] fix `Add account` when cam permission not granted --- lib/android/qr_scanner/qr_scanner_provider.dart | 1 + lib/app/views/main_page.dart | 1 + lib/oath/views/key_actions.dart | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/android/qr_scanner/qr_scanner_provider.dart b/lib/android/qr_scanner/qr_scanner_provider.dart index ddc32bf8..764099bd 100644 --- a/lib/android/qr_scanner/qr_scanner_provider.dart +++ b/lib/android/qr_scanner/qr_scanner_provider.dart @@ -31,6 +31,7 @@ class AndroidQrScanner implements QrScanner { (context) async => await Navigator.of(context).push(PageRouteBuilder( pageBuilder: (_, __, ___) => Theme(data: AppTheme.darkTheme, child: const QrScannerView()), + settings: const RouteSettings(name: 'android_qr_scanner_view'), transitionDuration: const Duration(seconds: 0), reverseTransitionDuration: const Duration(seconds: 0), ))); diff --git a/lib/app/views/main_page.dart b/lib/app/views/main_page.dart index 5e9d93e6..9e56c0e1 100755 --- a/lib/app/views/main_page.dart +++ b/lib/app/views/main_page.dart @@ -63,6 +63,7 @@ class MainPage extends ConsumerWidget { 'user_interaction_prompt', 'oath_add_account', 'oath_icon_pack_dialog', + 'android_qr_scanner_view', ].contains(route.settings.name); }); }); diff --git a/lib/oath/views/key_actions.dart b/lib/oath/views/key_actions.dart index 635ef26e..91582228 100755 --- a/lib/oath/views/key_actions.dart +++ b/lib/oath/views/key_actions.dart @@ -57,6 +57,8 @@ Widget oathBuildActions( enabled: used != null && (capacity == null || capacity > used), onTap: used != null && (capacity == null || capacity > used) ? () async { + final credentials = ref.read(credentialsProvider); + final withContext = ref.read(withContextProvider); Navigator.of(context).pop(); CredentialData? otpauth; if (Platform.isAndroid) { @@ -73,13 +75,13 @@ Widget oathBuildActions( } } } - await ref.read(withContextProvider)((context) async { + await withContext((context) async { await showBlurDialog( context: context, builder: (context) => OathAddAccountPage( devicePath, oathState, - credentials: ref.watch(credentialsProvider), + credentials: credentials, credentialData: otpauth, ), );