Skip to content
Snippets Groups Projects
Commit cab22eb4 authored by poka's avatar poka
Browse files

fix: isolate safe_home listener in consumer

parent 5ccacea4
No related branches found
No related tags found
No related merge requests found
Pipeline #34422 waiting for manual action
...@@ -207,6 +207,7 @@ class MyWalletsProvider with ChangeNotifier { ...@@ -207,6 +207,7 @@ class MyWalletsProvider with ChangeNotifier {
isOwned: true); isOwned: true);
await walletBox.put(newWallet.address, newWallet); await walletBox.put(newWallet.address, newWallet);
await readAllWallets();
isNewDerivationLoading = false; isNewDerivationLoading = false;
notifyListeners(); notifyListeners();
...@@ -260,15 +261,15 @@ class MyWalletsProvider with ChangeNotifier { ...@@ -260,15 +261,15 @@ class MyWalletsProvider with ChangeNotifier {
chestNumber ??= getCurrentChest(); chestNumber ??= getCurrentChest();
List<WalletData> walletConfig = await readAllWallets(chestNumber); // List<WalletData> walletConfig = await readAllWallets(chestNumber);
walletConfig.sort((p1, p2) { listWallets.sort((p1, p2) {
return Comparable.compare(p1.number!, p2.number!); return Comparable.compare(p1.number!, p2.number!);
}); });
if (walletConfig.isEmpty) { if (listWallets.isEmpty) {
newDerivationNbr = 2; newDerivationNbr = 2;
} else { } else {
WalletData lastWallet = walletConfig.reduce( WalletData lastWallet = listWallets.reduce(
(curr, next) => curr.derivation! > next.derivation! ? curr : next); (curr, next) => curr.derivation! > next.derivation! ? curr : next);
if (lastWallet.derivation == -1) { if (lastWallet.derivation == -1) {
...@@ -277,7 +278,7 @@ class MyWalletsProvider with ChangeNotifier { ...@@ -277,7 +278,7 @@ class MyWalletsProvider with ChangeNotifier {
newDerivationNbr = lastWallet.derivation! + (isOneshoot ? 1 : 2); newDerivationNbr = lastWallet.derivation! + (isOneshoot ? 1 : 2);
} }
newWalletNbr = walletConfig.last.number! + 1; newWalletNbr = listWallets.last.number! + 1;
} }
return [newWalletNbr, newDerivationNbr]; return [newWalletNbr, newDerivationNbr];
......
...@@ -37,7 +37,8 @@ class _WalletsHomeState extends State<WalletsHome> { ...@@ -37,7 +37,8 @@ class _WalletsHomeState extends State<WalletsHome> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final myWalletProvider = Provider.of<MyWalletsProvider>(context); final myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false);
final currentChestNumber = myWalletProvider.getCurrentChest(); final currentChestNumber = myWalletProvider.getCurrentChest();
final ChestData currentChest = chestBox.get(currentChestNumber)!; final ChestData currentChest = chestBox.get(currentChestNumber)!;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment