From f7dd7b01aa43e4900796b295632afe99e6f0fc43 Mon Sep 17 00:00:00 2001 From: julian Date: Sat, 29 Oct 2022 09:14:59 -0600 Subject: [PATCH] Coin enum clean up and bug fixes --- .../add_wallet_view/add_wallet_view.dart | 1 - .../sub_widgets/mobile_coin_list.dart | 2 -- .../sub_widgets/searchable_coin_list.dart | 3 ++- lib/utilities/enums/coin_enum.dart | 17 +++++++++++------ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart index df5c44d18..e964610ae 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart @@ -206,7 +206,6 @@ class _AddWalletViewState extends State { Expanded( child: MobileCoinList( coins: coins, - isDesktop: false, ), ), const SizedBox( diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart index 1f36f3b65..fd950963c 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart @@ -8,11 +8,9 @@ class MobileCoinList extends StatelessWidget { const MobileCoinList({ Key? key, required this.coins, - required this.isDesktop, }) : super(key: key); final List coins; - final bool isDesktop; @override Widget build(BuildContext context) { diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart index fb443b915..d89d42bbf 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart @@ -26,7 +26,8 @@ class SearchableCoinList extends ConsumerWidget { e.name.toLowerCase().contains(lowercaseTerm)); } if (!showTestNetCoins) { - _coins.removeWhere((e) => e.name.endsWith("TestNet")); + _coins.removeWhere( + (e) => e.name.endsWith("TestNet") || e == Coin.bitcoincashTestnet); } // remove firo testnet regardless _coins.remove(Coin.firoTestNet); diff --git a/lib/utilities/enums/coin_enum.dart b/lib/utilities/enums/coin_enum.dart index 86054979a..95294c8aa 100644 --- a/lib/utilities/enums/coin_enum.dart +++ b/lib/utilities/enums/coin_enum.dart @@ -1,6 +1,4 @@ import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as btc; -import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart' - as ltc; import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart' as bch; import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart' @@ -8,6 +6,8 @@ import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart' import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart' as epic; import 'package:stackwallet/services/coins/firo/firo_wallet.dart' as firo; +import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart' + as ltc; import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr; import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart' as nmc; @@ -19,12 +19,12 @@ enum Coin { dogecoin, epicCash, firo, + litecoin, monero, - wownero, namecoin, + wownero, /// - litecoin, /// /// @@ -37,7 +37,7 @@ enum Coin { } // remove firotestnet for now -const int kTestNetCoinCount = 3; +const int kTestNetCoinCount = 4; extension CoinExt on Coin { String get prettyName { @@ -268,7 +268,10 @@ Coin coinFromPrettyName(String name) { default: throw ArgumentError.value( - name, "name", "No Coin enum value with that prettyName"); + name, + "name", + "No Coin enum value with that prettyName", + ); } } @@ -290,6 +293,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) { return Coin.monero; case "nmc": return Coin.namecoin; + case "tltc": + return Coin.litecoinTestNet; case "tbtc": return Coin.bitcoinTestNet; case "tbch":