diff --git a/assets b/assets index 966806b9d..bdf1d11ee 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 966806b9d3ebc3176b4915e0d42be0c5f781fa37 +Subproject commit bdf1d11eea6c1ac687e3a97f3f33855012546323 diff --git a/lib/service/deeplink_service.dart b/lib/service/deeplink_service.dart index d910efc55..84e5ea855 100644 --- a/lib/service/deeplink_service.dart +++ b/lib/service/deeplink_service.dart @@ -29,6 +29,7 @@ import 'package:autonomy_flutter/service/remote_config_service.dart'; import 'package:autonomy_flutter/service/tezos_beacon_service.dart'; import 'package:autonomy_flutter/service/wc2_service.dart'; import 'package:autonomy_flutter/util/constants.dart'; +import 'package:autonomy_flutter/util/dio_exception_ext.dart'; import 'package:autonomy_flutter/util/log.dart'; import 'package:autonomy_flutter/util/string_ext.dart'; import 'package:collection/collection.dart'; @@ -637,7 +638,10 @@ class DeeplinkServiceImpl extends DeeplinkService { ); } catch (e) { log.info('[DeeplinkService] _handleClaimEmptyPostcardDeeplink error $e'); - + if (e is DioException && e.isPostcardClaimEmptyLimited) { + unawaited(_navigationService.showPostcardClaimLimited()); + return; + } if (otp == null) { _navigationService.showPostcardRunOut(); } else { diff --git a/lib/service/navigation_service.dart b/lib/service/navigation_service.dart index 7e5fd7b7f..5335a12fb 100644 --- a/lib/service/navigation_service.dart +++ b/lib/service/navigation_service.dart @@ -395,6 +395,13 @@ class NavigationService { } } + Future showPostcardClaimLimited() async { + if (navigatorKey.currentContext != null && + navigatorKey.currentState?.mounted == true) { + await UIHelper.showPostcardClaimLimited(navigatorKey.currentContext!); + } + } + Future openAutonomyDocument(String href, String title) async { if (navigatorKey.currentContext != null && navigatorKey.currentState?.mounted == true) { diff --git a/lib/util/dio_util.dart b/lib/util/dio_util.dart index 518dc21a5..79f8dd368 100644 --- a/lib/util/dio_util.dart +++ b/lib/util/dio_util.dart @@ -6,6 +6,7 @@ // import 'package:autonomy_flutter/common/environment.dart'; +import 'package:autonomy_flutter/util/dio_exception_ext.dart'; import 'package:autonomy_flutter/util/dio_interceptors.dart'; import 'package:autonomy_flutter/util/isolated_util.dart'; import 'package:autonomy_flutter/util/log.dart'; @@ -23,6 +24,7 @@ Dio feralFileDio(BaseOptions options) { Dio postcardDio(BaseOptions options) { final dio = baseDio(options); dio.interceptors.add(HmacAuthInterceptor(Environment.auClaimSecretKey)); + dio.interceptors.add(AutonomyAuthInterceptor()); return dio; } @@ -54,6 +56,13 @@ Dio baseDio(BaseOptions options) { logPrint: (message) { log.warning("[request retry] $message"); }, + retryEvaluator: (error, attempt) { + if (error.isPostcardClaimEmptyLimited) { + return false; + } + return true; + }, + ignoreRetryEvaluatorExceptions: true, retryDelays: const [ // set delays between retries Duration(seconds: 1), diff --git a/lib/util/ui_helper.dart b/lib/util/ui_helper.dart index a2c69d444..4fe16a3ce 100644 --- a/lib/util/ui_helper.dart +++ b/lib/util/ui_helper.dart @@ -1693,7 +1693,7 @@ class UIHelper { ]; await showAutoDismissDialog(context, showDialog: () async { return showPostcardDrawerAction(context, options: options); - }, autoDismissAfter: const Duration(seconds: 2)); + }, autoDismissAfter: const Duration(seconds: 3)); } static Future _showPostcardInfo(BuildContext context,