Skip to content

Commit

Permalink
Reset loadingAttemptsLeft after successful load otherwise every app s…
Browse files Browse the repository at this point in the history
…tart will be limited to 3 load attempts
  • Loading branch information
i5hi committed Dec 27, 2024
1 parent 7c15b2d commit 98c6af4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/wallet/bloc/wallet_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class WalletBloc extends Bloc<WalletEvent, WalletState> {
loadingWallet: false,
errLoadingWallet: '',
name: wallet!.name ?? '',
loadingAttepmtsLeft: 3,
),
);

Expand Down Expand Up @@ -137,8 +138,8 @@ class WalletBloc extends Bloc<WalletEvent, WalletState> {
if (state.wallet == null) return;
if (state.syncing) return;
if (state.errLoadingWallet.isNotEmpty && state.loadingAttepmtsLeft > 0) {
add(LoadWallet(state.wallet!.getWalletStorageString()));
emit(state.copyWith(loadingAttepmtsLeft: state.loadingAttepmtsLeft - 1));
add(LoadWallet(state.wallet!.getWalletStorageString()));
return;
}
// if (walletIsLoaded)
Expand Down

0 comments on commit 98c6af4

Please sign in to comment.