refactor: delete dead Cake Pay/buy/exchange code; split di setup()

- Cake Pay: 36 files (~5.3k LOC) plus DI registrations, routes, and UI
  branches (feature was hard-disabled and unreachable)
- unreachable buy providers: robinhood, dfx, onramper, meld, kryptonim
  (~1.7k LOC); MoonPay untouched
- exchange providers that only existed as commented-out wiring:
  changenow, sideshift, chainflip, exolix, swaptrade, letsexchange,
  stealthex, xoswap, swapsxyz, thorchain, simpleswap (~5.2k LOC);
  Trocador untouched; ExchangeProviderDescription values and Hive
  adapters kept so stored trades and orders still deserialize
- di.dart setup() split from one 1,452-line function into 10 sequential
  chunk functions; registration execution order verified identical
  before and after (251 register calls)
This commit is contained in:
jwinterm
2026-08-15 16:29:03 -04:00
parent 71706314fb
commit adece963c3
75 changed files with 74 additions and 13200 deletions
@@ -14,7 +14,6 @@ import 'package:hash_wallet/src/widgets/vulnerable_seeds_popup.dart';
import 'package:hash_wallet/utils/device_info.dart';
import 'package:hash_wallet/utils/feature_flag.dart';
import 'package:hash_wallet/utils/version_comparator.dart';
import 'package:hash_wallet/view_model/dashboard/cake_features_view_model.dart';
import 'package:hash_wallet/generated/i18n.dart';
import 'package:hash_wallet/routes.dart';
import 'package:hash_wallet/src/screens/yat_emoji_id.dart';
@@ -327,7 +326,6 @@ class _DashboardPageView extends BasePage {
label: S.of(context).apps,
child: CakeFeaturesPage(
dashboardViewModel: dashboardViewModel,
cakeFeaturesViewModel: getIt.get<CakeFeaturesViewModel>(),
),
),
);
@@ -1,9 +1,7 @@
import 'package:hash_wallet/di.dart';
import 'package:hash_wallet/entities/main_actions.dart';
import 'package:hash_wallet/src/screens/dashboard/desktop_widgets/desktop_action_button.dart';
import 'package:hash_wallet/src/screens/dashboard/pages/cake_features_page.dart';
import 'package:hash_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:hash_wallet/view_model/dashboard/cake_features_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@@ -75,7 +73,6 @@ class DesktopDashboardActions extends StatelessWidget {
Expanded(
child: CakeFeaturesPage(
dashboardViewModel: dashboardViewModel,
cakeFeaturesViewModel: getIt.get<CakeFeaturesViewModel>(),
),
),
],
@@ -7,10 +7,8 @@ import 'package:hash_wallet/src/screens/dashboard/widgets/info_card.dart';
import 'package:hash_wallet/src/widgets/alert_with_one_action.dart';
import 'package:hash_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:hash_wallet/src/widgets/dashboard_card_widget.dart';
import 'package:hash_wallet/src/widgets/introducing_card.dart';
import 'package:hash_wallet/src/widgets/standard_switch.dart';
import 'package:hash_wallet/themes/core/theme_extension.dart';
import 'package:hash_wallet/utils/feature_flag.dart';
import 'package:hash_wallet/utils/show_pop_up.dart';
import 'package:hash_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cw_core/wallet_info.dart';
@@ -139,18 +137,6 @@ class CryptoBalanceWidget extends StatelessWidget {
),
],
)),
Observer(
builder: (_) {
if (dashboardViewModel.balanceViewModel.isShowCard && FeatureFlag.isCakePayEnabled) {
return IntroducingCard(
title: S.of(context).introducing_cake_pay,
subTitle: S.of(context).cake_pay_learn_more,
borderColor: Theme.of(context).colorScheme.outline,
closeCard: dashboardViewModel.balanceViewModel.disableIntroCakePayCard);
}
return Container();
},
),
Observer(builder: (_) {
if (!dashboardViewModel.showRepWarning) {
return const SizedBox();
@@ -1,24 +1,17 @@
import 'dart:io';
import 'package:hash_wallet/generated/i18n.dart';
import 'package:hash_wallet/new-ui/widgets/apps_widget.dart';
import 'package:hash_wallet/routes.dart';
import 'package:hash_wallet/src/widgets/hash_image_widget.dart';
import 'package:hash_wallet/src/widgets/dashboard_card_widget.dart';
import 'package:hash_wallet/utils/feature_flag.dart';
import 'package:hash_wallet/view_model/dashboard/cake_features_view_model.dart';
import 'package:hash_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:hash_wallet/src/widgets/gradient_background.dart';
class CakeFeaturesPage extends StatelessWidget {
CakeFeaturesPage({required this.dashboardViewModel, required this.cakeFeaturesViewModel});
CakeFeaturesPage({required this.dashboardViewModel});
final DashboardViewModel dashboardViewModel;
final CakeFeaturesViewModel cakeFeaturesViewModel;
@override
Widget build(BuildContext context) {
@@ -102,23 +95,4 @@ class CakeFeaturesPage extends StatelessWidget {
);
}
void _onCakePayTap(BuildContext context) {
if (Platform.isMacOS) {
_launchUrl("buy.cakepay.com");
} else {
_navigatorToGiftCardsPage(context);
}
}
void _launchUrl(String url) {
try {
launchUrl(Uri.https(url), mode: LaunchMode.externalApplication);
} catch (e) {
printV(e);
}
}
void _navigatorToGiftCardsPage(BuildContext context) {
Navigator.pushNamed(context, Routes.cakePayCardsPage);
}
}
+1 -10
View File
@@ -1,6 +1,4 @@
import 'package:hash_wallet/exchange/exchange_provider_description.dart';
import 'package:hash_wallet/exchange/provider/chainflip_exchange_provider.dart';
import 'package:hash_wallet/exchange/provider/thorchain_exchange.provider.dart';
import 'package:hash_wallet/core/auth_service.dart';
import 'package:hash_wallet/di.dart';
import 'package:hash_wallet/src/screens/exchange/widgets/desktop_exchange_cards_section.dart';
@@ -542,14 +540,7 @@ class ExchangePage extends BasePage {
if (depositAmountController.text != exchangeViewModel.depositAmount &&
depositAmountController.text != S.of(context).all) {
exchangeViewModel.isSendAllEnabled = false;
final isThorChain = exchangeViewModel.selectedProviders
.any((provider) => provider is ThorChainExchangeProvider);
final isChainflip = exchangeViewModel.selectedProviders
.any((provider) => provider is ChainflipExchangeProvider);
_depositAmountDebounce = isThorChain || isChainflip
? Debounce(Duration(milliseconds: 1000))
: Debounce(Duration(milliseconds: 500));
_depositAmountDebounce = Debounce(Duration(milliseconds: 500));
_depositAmountDebounce.run(() {
exchangeViewModel.calculateBestRate();
@@ -1,27 +0,0 @@
import 'package:hash_wallet/cake_pay/src/models/cake_pay_order.dart';
import 'package:hash_wallet/src/screens/transaction_details/standart_list_item.dart';
import 'package:flutter/material.dart';
class CakePayDetailsListCardItem extends StandartListItem {
CakePayDetailsListCardItem({
required String title,
required String value,
required this.id,
required this.createdAt,
this.price,
this.quantity,
required this.from,
required this.to,
required this.onTap,
required this.cards,
}) : super(title: title, value: value);
final String id;
final String createdAt;
final String? price;
final String? quantity;
final String from;
final String to;
final void Function(BuildContext) onTap;
final List<OrderCard> cards;
}
@@ -1,6 +1,4 @@
import 'package:hash_wallet/src/screens/order_details/cake_pay_detail_list_card_item.dart';
import 'package:hash_wallet/src/screens/trade_details/trade_details_status_item.dart';
import 'package:hash_wallet/src/widgets/cake_pay_order_list_card.dart';
import 'package:hash_wallet/src/widgets/standard_list.dart';
import 'package:hash_wallet/src/widgets/standard_list_status_row.dart';
import 'package:hash_wallet/themes/core/material_base_theme.dart';
@@ -64,21 +62,6 @@ class OrderDetailsPageBodyState extends State<OrderDetailsPageBody> {
return StandardListStatusRow(title: item.title, value: item.value);
}
if (item is CakePayDetailsListCardItem) {
final cardImagePath = (item.cards.isNotEmpty) ? item.cards.first.cardImagePath : null;
return CakePayOrderListCard(
id: item.id,
create: item.createdAt,
price: item.price,
quantity: item.quantity,
pair: '${item.from} → ${item.to}',
currentTheme: widget.currentTheme.type,
onTap: item.onTap,
backgroundImage: cardImagePath,
);
}
if (item is TrackTradeListItem) {
return GestureDetector(
onTap: item.onTap,