From 21f3a75aa5e0e631257c90429a976700b17cdfa1 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Wed, 3 Jun 2026 09:15:10 -0400 Subject: [PATCH] Wownero: dispatch getCurrentAccount by wallet.type in AccountCustomizer The "Wallet Accounts" reorder modal threw on open for Wownero wallets: account_customizer.dart unconditionally called monero!.getCurrentAccount, which casts the wallet to MoneroWallet internally. WowneroWallet is a sibling type, not a subtype, so the cast blew up before the active-card swap logic ran. Dispatch on wallet.type and use the wownero! proxy for Wownero, matching the pattern already in card_customizer_bloc.dart, addresses_page.dart, and dashboard_view_model.dart. Skip the swap entirely for any other wallet type rather than guessing. Bump 1.0.0+5 -> 1.0.0+6. --- lib/new-ui/pages/account_customizer.dart | 10 +++++++++- pubspec_description.yaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/new-ui/pages/account_customizer.dart b/lib/new-ui/pages/account_customizer.dart index 914835d25..82bddc8ae 100644 --- a/lib/new-ui/pages/account_customizer.dart +++ b/lib/new-ui/pages/account_customizer.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:hash_wallet/di.dart'; import 'package:hash_wallet/generated/i18n.dart'; import 'package:hash_wallet/monero/monero.dart'; +import 'package:hash_wallet/wownero/wownero.dart'; import 'package:hash_wallet/new-ui/pages/card_customizer.dart'; import 'package:hash_wallet/new-ui/viewmodels/card_customizer/card_customizer_bloc.dart'; import 'package:hash_wallet/new-ui/widgets/coins_page/cards/balance_card.dart'; @@ -21,6 +22,7 @@ import 'package:cw_core/card_design.dart'; import 'package:cw_core/generate_name.dart'; import 'package:cw_core/sync_status.dart'; import 'package:cw_core/utils/print_verbose.dart'; +import 'package:cw_core/wallet_type.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -62,7 +64,13 @@ class _AccountCustomizerState extends State { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { loadCards(); - final activeId = monero!.getCurrentAccount(widget.dashboardViewModel.wallet).id; + final wallet = widget.dashboardViewModel.wallet; + final int? activeId = wallet.type == WalletType.monero + ? monero?.getCurrentAccount(wallet).id + : wallet.type == WalletType.wownero + ? wownero?.getCurrentAccount(wallet).id + : null; + if (activeId == null) return; for (int i = 0; i < _items.length-1; i++) { if(_items[i].accountListItem.id == activeId) { final lastIndex = _items.length - 1; diff --git a/pubspec_description.yaml b/pubspec_description.yaml index 6a4d049ef..ede5c2e5c 100644 --- a/pubspec_description.yaml +++ b/pubspec_description.yaml @@ -1,6 +1,6 @@ name: hash_wallet description: Hash Bags — a noncustodial multi-currency wallet by Such Software LLC. -version: 1.0.0+5 +version: 1.0.0+6 publish_to: none environment: