Skip to content

Commit

Permalink
Temporary fix for UpdateOnDifferentStatus - walletNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
i5hi committed Dec 27, 2024
1 parent afdd073 commit bb7c68a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
25 changes: 25 additions & 0 deletions lib/_pkg/wallet/lwk/create.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:bb_mobile/_model/wallet.dart';
import 'package:bb_mobile/_pkg/error.dart';
import 'package:lwk_dart/lwk_dart.dart' as lwk;
Expand Down Expand Up @@ -28,6 +30,29 @@ class LWKCreate {

return (w, null);
} catch (e) {
try {
if (e.toString().contains(
'LwkError(msg: UpdateOnDifferentStatus { wollet_status: ',
)) {
final appDocDir = await getApplicationDocumentsDirectory();
final String dbDir =
'${appDocDir.path}/${wallet.getWalletStorageString()}';
// delete dbDir
final Directory dbDirect = Directory(dbDir);
if (dbDirect.existsSync()) {
await dbDirect.delete(recursive: true);
}
}
} catch (e) {
return (
null,
Err(
e.toString(),
title: 'Error occurred while creating wallet',
solution: 'Please try again.',
)
);
}
return (
null,
Err(
Expand Down
8 changes: 8 additions & 0 deletions lib/_pkg/wallet/sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ class WalletSync implements IWalletSync {
.deleteWalletFile(wallet.id);
// create db file or restart app
}
if (errSyncing.message.contains(
'LwkError(msg: UpdateOnDifferentStatus { wollet_status: ',
)) {
locator
.get<WalletsStorageRepository>()
.deleteWalletFile(wallet.id);
// create db file or restart app
}
throw errSyncing;
}
final err =
Expand Down
2 changes: 1 addition & 1 deletion lib/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import 'package:flutter_animate/flutter_animate.dart';
import 'package:get_it/get_it.dart';
import 'package:go_router/go_router.dart';

const bbVersion = '0.3.10';
const bbVersion = '0.3.16';

GetIt locator = GetIt.instance;

Expand Down
6 changes: 5 additions & 1 deletion lib/wallet/bloc/wallet_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ 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) {
add(LoadWallet(state.wallet!.getWalletStorageString()));
return;
}
// if (walletIsLoaded)
// final (wallet, _) = await _walletsStorageRepository.readWallet(
// walletHashId: state.wallet!.id,
// );
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: bb_mobile
description: Bull Bitcoin Mobile Wallet
publish_to: "none"
version: 0.3.10+23
version: 0.3.16+23

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down

0 comments on commit bb7c68a

Please sign in to comment.