diff --git a/lib/dashboard/connection/operation/cubit/operation_cubit.dart b/lib/dashboard/connection/operation/cubit/operation_cubit.dart index 97b122408..2f1d4ce5b 100644 --- a/lib/dashboard/connection/operation/cubit/operation_cubit.dart +++ b/lib/dashboard/connection/operation/cubit/operation_cubit.dart @@ -311,11 +311,18 @@ class OperationCubit extends Cubit { } } + int operationAttemptCount = 0; + + void resetOperationAttemptCount() { + operationAttemptCount = 0; + } + Future sendOperataion(ConnectionBridgeType connectionBridgeType) async { if (isClosed) return; try { emit(state.loading()); - log.i('sendOperataion'); + operationAttemptCount++; + log.i('sendOperataion attempt $operationAttemptCount'); final isInternetAvailable = await isConnected(); if (!isInternetAvailable) { @@ -384,12 +391,20 @@ class OperationCubit extends Cubit { ); unawaited(nftCubit.fetchFromZero()); unawaited(tokensCubit.fetchFromZero()); + resetOperationAttemptCount(); } else { throw ResponseMessage( message: ResponseString.RESPONSE_STRING_OPERATION_FAILED, ); } } catch (e) { + if (operationAttemptCount < 3) { + await Future.delayed(const Duration(milliseconds: 500)); + await sendOperataion(connectionBridgeType); + return; + } + resetOperationAttemptCount(); + log.e('sendOperataion , e: $e'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); diff --git a/lib/dashboard/connection/operation/cubit/operation_state.dart b/lib/dashboard/connection/operation/cubit/operation_state.dart index 17dc436c6..7a839af2c 100644 --- a/lib/dashboard/connection/operation/cubit/operation_state.dart +++ b/lib/dashboard/connection/operation/cubit/operation_state.dart @@ -49,8 +49,8 @@ class OperationState extends Equatable { return OperationState( status: status ?? this.status, message: message, - amount: amount ?? this.usdRate, - fee: fee ?? this.usdRate, + amount: amount ?? this.amount, + fee: fee ?? this.fee, usdRate: usdRate ?? this.usdRate, cryptoAccountData: cryptoAccountData ?? this.cryptoAccountData, dAppName: dAppName ?? this.dAppName, diff --git a/pubspec.yaml b/pubspec.yaml index 32db785f0..f8fae0886 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: altme description: AltMe Flutter App -version: 2.4.27+447 +version: 2.4.28+448 environment: sdk: ">=3.1.0 <4.0.0"