Skip to content

Commit

Permalink
Merge branch 'october'
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Apr 26, 2024
2 parents bb62e19 + bb9c045 commit 6ae193a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
17 changes: 16 additions & 1 deletion lib/dashboard/connection/operation/cubit/operation_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,18 @@ class OperationCubit extends Cubit<OperationState> {
}
}

int operationAttemptCount = 0;

void resetOperationAttemptCount() {
operationAttemptCount = 0;
}

Future<void> 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) {
Expand Down Expand Up @@ -384,12 +391,20 @@ class OperationCubit extends Cubit<OperationState> {
);
unawaited(nftCubit.fetchFromZero());
unawaited(tokensCubit.fetchFromZero());
resetOperationAttemptCount();
} else {
throw ResponseMessage(
message: ResponseString.RESPONSE_STRING_OPERATION_FAILED,
);
}
} catch (e) {
if (operationAttemptCount < 3) {
await Future<void>.delayed(const Duration(milliseconds: 500));
await sendOperataion(connectionBridgeType);
return;
}
resetOperationAttemptCount();

log.e('sendOperataion , e: $e');
if (e is MessageHandler) {
emit(state.error(messageHandler: e));
Expand Down
4 changes: 2 additions & 2 deletions lib/dashboard/connection/operation/cubit/operation_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 6ae193a

Please sign in to comment.