Skip to content

Commit

Permalink
WALLET - reloading wallet - max attempts conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
mocodesmo committed Dec 27, 2024
1 parent bb7c68a commit 7c15b2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/wallet/bloc/state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class WalletState with _$WalletState {
@Default(0) int syncErrCount,
// Address? newAddress,
Address? firstAddress,
@Default(3) int loadingAttepmtsLeft,
// required WalletCreate walletCreate,
}) = _WalletState;
const WalletState._();
Expand Down
3 changes: 2 additions & 1 deletion lib/wallet/bloc/wallet_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ class WalletBloc extends Bloc<WalletEvent, WalletState> {
Future _syncWallet(SyncWallet event, Emitter<WalletState> emit) async {
if (state.wallet == null) return;
if (state.syncing) return;
if (state.errLoadingWallet.isNotEmpty) {
if (state.errLoadingWallet.isNotEmpty && state.loadingAttepmtsLeft > 0) {
add(LoadWallet(state.wallet!.getWalletStorageString()));
emit(state.copyWith(loadingAttepmtsLeft: state.loadingAttepmtsLeft - 1));
return;
}
// if (walletIsLoaded)
Expand Down

0 comments on commit 7c15b2d

Please sign in to comment.