From 1cd365366b57356c2c8563ba30ca0a5833539495 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Mon, 17 Jul 2023 18:39:08 +0545 Subject: [PATCH] fix: Solve freeze issue of presention request by deeplink #1727 --- .../qr_code_scan/cubit/qr_code_scan_cubit.dart | 2 +- lib/splash/bloclisteners/blocklisteners.dart | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart index 95bbb755d..a36f5ee24 100644 --- a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart +++ b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart @@ -139,8 +139,8 @@ class QRCodeScanCubit extends Cubit { Future deepLink() async { final deepLinkUrl = deepLinkCubit.state; - emit(state.loading(isScan: false)); if (deepLinkUrl != '') { + emit(state.loading(isScan: false)); deepLinkCubit.resetDeepLink(); try { await verify(uri: Uri.parse(deepLinkUrl)); diff --git a/lib/splash/bloclisteners/blocklisteners.dart b/lib/splash/bloclisteners/blocklisteners.dart index e2b627277..16391cf58 100644 --- a/lib/splash/bloclisteners/blocklisteners.dart +++ b/lib/splash/bloclisteners/blocklisteners.dart @@ -165,6 +165,14 @@ final scanBlocListener = BlocListener( Navigator.of(context).pop(); } } + + if (state.message != null) { + AlertMessage.showStateMessage( + context: context, + stateMessage: state.message!, + ); + } + if (state.status == ScanStatus.success) { /// should pop until dashboard. Doing such we don't have to consider /// different scanCubit scenarii (DIDAuth, scan or deeplink, @@ -175,16 +183,10 @@ final scanBlocListener = BlocListener( (Route route) => route.isFirst, ); } + if (state.status == ScanStatus.error) { Navigator.of(context).pop(); } - - if (state.message != null) { - AlertMessage.showStateMessage( - context: context, - stateMessage: state.message!, - ); - } }, );