mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
URL replacements throughout lib/: - support_view_model.dart: removed Cake's own support channels (email, website, forum, Telegram, Telegram bot). Only GitHub Issues + Releases remain. Third-party provider support links (ChangeNow, SideShift, SimpleSwap, Exolix, Trocador, Onramper, DFX, MoonPay, Robinhood, Kryptonim) kept — genuinely useful when a swap goes sideways. - transaction_details_view_model.dart + payjoin_details_view_model.dart: mempool.cakewallet.com -> mempool.space (canonical free public mempool, no affiliate). - services_updates_widget.dart: status.cakewallet.com -> our GH issues. - 8 widget/screen files: docs.cakewallet.com / blog / cakewallet.com help URLs repointed to github.com/Such-Software/hash-wallet (placeholder until we have our own docs; better than dead-linking to Cake's docs). User-facing text changes: - walletkit_service.dart: WalletKit metadata (name/description/url/icon/ redirect) all -> Hash Wallet / Such Software repo / hashwallet:// scheme. - di.dart: TrezorConnect callback URL + appName -> Hash Wallet. - vulnerable_seeds_popup.dart + haven_wallet_removal_popup.dart: copy rewritten to say 'Hash Wallet' instead of 'Cake Wallet', and point to GH issues instead of Cake's support email. - swap_provider_initial_preference_modal.dart: trailing 'Cake Wallet.' -> 'Hash Wallet.' Deep-link URL scheme cakewallet:// -> hashwallet:// in: - lib/main.dart, lib/src/screens/root/root.dart, lib/view_model/link_view_model.dart Means any cakewallet:// link from a payment QR / Trezor callback / shortcut now routes via hashwallet://. No existing user base so no migration needed. SVG asset swaps (content replaced, filenames kept so call-sites compile without rewriting): - assets/new-ui/cake_squircle_icon.svg -> hash_wallet/02_app_icon.svg - assets/new-ui/cakewallet-wordmark-light.svg -> hash_wallet/03_lockup_horizontal.svg (dark text for light backgrounds) - assets/new-ui/cakewallet-wordmark.svg -> hash_wallet/03_lockup_horizontal_dark.svg (light text for dark backgrounds) - apps_widget.dart: the conditional cakelabs-icon render became a SizedBox() no-op. The Apps tab is gutted anyway (placeholder content); this widget is also used elsewhere where the Cake Labs attribution badge is unwanted.
137 lines
4.9 KiB
Dart
137 lines
4.9 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:hash_wallet/bitcoin/bitcoin.dart';
|
|
import 'package:hash_wallet/generated/i18n.dart';
|
|
import 'package:hash_wallet/src/screens/trade_details/trade_details_list_card.dart';
|
|
import 'package:hash_wallet/src/screens/trade_details/trade_details_status_item.dart';
|
|
import 'package:hash_wallet/src/screens/transaction_details/blockexplorer_list_item.dart';
|
|
import 'package:hash_wallet/src/screens/transaction_details/standart_list_item.dart';
|
|
import 'package:hash_wallet/src/screens/transaction_details/transaction_details_list_item.dart';
|
|
import 'package:hash_wallet/themes/core/theme_store.dart';
|
|
import 'package:hash_wallet/utils/date_formatter.dart';
|
|
import 'package:cw_core/payjoin_session.dart';
|
|
import 'package:cw_core/transaction_info.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
import 'package:mobx/mobx.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
part 'payjoin_details_view_model.g.dart';
|
|
|
|
class PayjoinDetailsViewModel = PayjoinDetailsViewModelBase
|
|
with _$PayjoinDetailsViewModel;
|
|
|
|
abstract class PayjoinDetailsViewModelBase with Store {
|
|
PayjoinDetailsViewModelBase(
|
|
this.payjoinSessionId,
|
|
this.transactionInfo, {
|
|
required this.payjoinSessionSource,
|
|
required this.themeStore,
|
|
}) : items = ObservableList<TransactionDetailsListItem>(),
|
|
payjoinSession = payjoinSessionSource.get(payjoinSessionId)! {
|
|
listener = payjoinSessionSource.watch().listen((e) {
|
|
if (e.key == payjoinSessionId) _updateItems();
|
|
});
|
|
_updateItems();
|
|
}
|
|
|
|
final Box<PayjoinSession> payjoinSessionSource;
|
|
final ThemeStore themeStore;
|
|
final String payjoinSessionId;
|
|
final TransactionInfo? transactionInfo;
|
|
|
|
@observable
|
|
late PayjoinSession payjoinSession;
|
|
|
|
final ObservableList<TransactionDetailsListItem> items;
|
|
|
|
late final StreamSubscription<BoxEvent> listener;
|
|
|
|
Timer? timer;
|
|
|
|
@action
|
|
void _updateItems() {
|
|
final dateFormat = DateFormatter.withCurrentLocal();
|
|
items.clear();
|
|
items.addAll([
|
|
DetailsListStatusItem(
|
|
title: S.current.status,
|
|
value: _getStatusString(),
|
|
status: payjoinSession.status,
|
|
),
|
|
TradeDetailsListCardItem(
|
|
id: "${payjoinSession.isSenderSession ? S.current.outgoing : S.current.incoming} Payjoin",
|
|
createdAt:
|
|
dateFormat.format(payjoinSession.inProgressSince!).toString(),
|
|
pair:
|
|
'${bitcoin!.formatterBitcoinAmountToString(amount: payjoinSession.amount.toInt())} BTC',
|
|
onTap: (_) {},
|
|
),
|
|
if (payjoinSession.error?.isNotEmpty == true)
|
|
StandartListItem(
|
|
title: S.current.error,
|
|
value: payjoinSession.error!,
|
|
),
|
|
if (payjoinSession.txId?.isNotEmpty == true && transactionInfo != null) ...[
|
|
StandartListItem(
|
|
title: S.current.transaction_details_transaction_id,
|
|
value: payjoinSession.txId!,
|
|
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
|
),
|
|
BlockExplorerListItem(
|
|
title: S.current.view_in_block_explorer,
|
|
value: '${S.current.view_transaction_on}mempool.space',
|
|
onTap: () async {
|
|
try {
|
|
final uri = Uri.parse('https://mempool.space/tx/${payjoinSession.txId!}');
|
|
if (await canLaunchUrl(uri))
|
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
|
} catch (e) {}
|
|
},
|
|
key: ValueKey('block_explorer_list_item_wallet_type_key'),
|
|
)
|
|
]
|
|
]);
|
|
|
|
if (transactionInfo != null) {
|
|
items.addAll([
|
|
StandartListItem(
|
|
title: S.current.transaction_details_date,
|
|
value: dateFormat.format(transactionInfo!.date),
|
|
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
|
),
|
|
StandartListItem(
|
|
title: S.current.confirmations,
|
|
value: transactionInfo!.confirmations.toString(),
|
|
key: ValueKey('standard_list_item_transaction_confirmations_key'),
|
|
),
|
|
StandartListItem(
|
|
title: S.current.transaction_details_height,
|
|
value: '${transactionInfo!.height}',
|
|
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
|
),
|
|
if (transactionInfo!.feeFormatted()?.isNotEmpty ?? false)
|
|
StandartListItem(
|
|
title: S.current.transaction_details_fee,
|
|
value: transactionInfo!.feeFormatted()!,
|
|
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
|
),
|
|
]);
|
|
}
|
|
}
|
|
|
|
String _getStatusString() {
|
|
switch (payjoinSession.status) {
|
|
case 'success':
|
|
if (transactionInfo?.isPending == false) return S.current.successful;
|
|
return S.current.payjoin_request_awaiting_tx;
|
|
case 'inProgress':
|
|
return S.current.payjoin_request_in_progress;
|
|
case 'unrecoverable':
|
|
return S.current.error;
|
|
default:
|
|
return payjoinSession.status;
|
|
}
|
|
}
|
|
}
|