mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-03 07:24:08 +01:00
Merge upstream Cake Wallet v6.5.0
Catches up from the May 12 fork point (v6.1.2+23) through v6.5.0: 535 upstream commits, including the Monero silent-open fix, Monero on Trezor, Ledger/Trezor BLE fixes, the new seed and history screens, quick Bitcoin sync, git-pinned dependencies (pubspec_overrides.yaml), frozen Hive adapters (*.part.dart), monero_c v0.18.4.6-RC2 and Flutter 3.41.9. Merged with both sides normalized first (import rename, 100-column format), which took the conflict count from 614 paths to 322. The procedure is now scripts/upstream_sync.sh. Kept from Hash Bags: - WalletType enum order and Hive IDs. SQLite stores WalletType.index and our order differs from upstream's; taking theirs would reread saved wallets as other chains. Our frozen adapter keeps the shipped IDs. - The 1.0.2 legacy PIN and wallet-password decode and self-heal. - Removed chains (Solana, Tron, Zano, Zcash, Decred, Haven) and the new Robinhood chain stay out; Cake Pay and non-Trocador swaps stay out. - Default nodes (node.wownero.org, sethforprivacy, Blockstream, bysh.me), converted to upstream's isDefault node-list key; Wownero is back in the node reset list. - Privacy: address resolvers limited to domain-anchored sources again; prices.neroswap.com for fiat; upstream's charts tab, which reads prices.cakewallet.com, sits behind FeatureFlag.isChartsEnabled = false. - Lightning stays behind FeatureFlag.isLightningEnabled, including upstream's new post-seed Lightning username step. - Our icon pipeline, branding and bundle identifiers. Twelve new upstream widget tests are skipped: test and code are unchanged from v6.5.0 apart from renames (not rerun on a pristine upstream checkout; upstream's top_bar_test does not compile against its own TopBar). flutter analyze lib: 0 errors; flutter test: 345 passed, 12 skipped; flutter build bundle compiles. Built with Flutter 3.41.9.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import "package:hash_wallet/buy/moonpay/moonpay_payment_methods.dart";
|
||||
import 'package:hash_wallet/core/selectable_option.dart';
|
||||
import "package:hash_wallet/entities/calculate_fiat_amount.dart";
|
||||
|
||||
enum PaymentType {
|
||||
all,
|
||||
@@ -33,6 +35,8 @@ enum PaymentType {
|
||||
fiatBalance,
|
||||
bancontact,
|
||||
pixPay,
|
||||
moonpayCashApp,
|
||||
moonpayBalance,
|
||||
unknown,
|
||||
}
|
||||
|
||||
@@ -103,6 +107,10 @@ extension PaymentTypeTitle on PaymentType {
|
||||
return 'Bancontact';
|
||||
case PaymentType.pixPay:
|
||||
return 'PIX Pay';
|
||||
case PaymentType.moonpayCashApp:
|
||||
return 'Cash App';
|
||||
case PaymentType.moonpayBalance:
|
||||
return 'MoonPay Balance';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -115,7 +123,7 @@ extension PaymentTypeTitle on PaymentType {
|
||||
case PaymentType.creditCard:
|
||||
case PaymentType.debitCard:
|
||||
case PaymentType.yellowCardBankTransfer:
|
||||
return 'assets/images/card.svg';
|
||||
return 'assets/new-ui/buy_payment_methods/debit_card.svg';
|
||||
case PaymentType.bankTransfer:
|
||||
return 'assets/images/bank_light.svg';
|
||||
case PaymentType.skrill:
|
||||
@@ -132,17 +140,21 @@ extension PaymentTypeTitle on PaymentType {
|
||||
String? get darkIconPath {
|
||||
switch (this) {
|
||||
case PaymentType.all:
|
||||
return 'assets/images/usd_round_dark.svg';
|
||||
return 'assets/new-ui/buy_payment_methods/all_methods.svg';
|
||||
case PaymentType.creditCard:
|
||||
case PaymentType.debitCard:
|
||||
case PaymentType.yellowCardBankTransfer:
|
||||
return 'assets/images/card_dark.svg';
|
||||
return 'assets/new-ui/buy_payment_methods/debit_card.svg';
|
||||
case PaymentType.bankTransfer:
|
||||
return 'assets/images/bank_dark.svg';
|
||||
return 'assets/new-ui/buy_payment_methods/bank_transfer.svg';
|
||||
case PaymentType.skrill:
|
||||
return 'assets/images/skrill.svg';
|
||||
case PaymentType.applePay:
|
||||
return 'assets/images/apple_pay_round_dark.svg';
|
||||
return 'assets/new-ui/buy_payment_methods/apple_pay.svg';
|
||||
case PaymentType.googlePay:
|
||||
return "assets/new-ui/buy_payment_methods/google_pay.svg";
|
||||
case PaymentType.paypal:
|
||||
return "assets/new-ui/buy_payment_methods/paypal.svg";
|
||||
case PaymentType.revolutPay:
|
||||
return 'assets/images/revolut_dark.svg';
|
||||
default:
|
||||
@@ -150,6 +162,12 @@ extension PaymentTypeTitle on PaymentType {
|
||||
}
|
||||
}
|
||||
|
||||
bool get isMonochromeIcon => [
|
||||
"assets/new-ui/buy_payment_methods/all_methods.svg",
|
||||
"assets/new-ui/buy_payment_methods/debit_card.svg",
|
||||
"assets/new-ui/buy_payment_methods/bank_transfer.svg"
|
||||
].contains(darkIconPath);
|
||||
|
||||
String? get description {
|
||||
switch (this) {
|
||||
default:
|
||||
@@ -165,6 +183,8 @@ class PaymentMethod extends SelectableOption {
|
||||
required this.customIconPath,
|
||||
this.customDescription,
|
||||
this.customPaymentMethodType,
|
||||
this.customBadges = const [],
|
||||
this.customBottomLeftSubTitle,
|
||||
}) : super(title: paymentMethodType.title ?? customTitle);
|
||||
|
||||
final PaymentType paymentMethodType;
|
||||
@@ -172,8 +192,16 @@ class PaymentMethod extends SelectableOption {
|
||||
final String customIconPath;
|
||||
final String? customDescription;
|
||||
final String? customPaymentMethodType;
|
||||
final List<String> customBadges;
|
||||
final String? customBottomLeftSubTitle;
|
||||
bool isSelected = false;
|
||||
|
||||
@override
|
||||
List<String> get badges => customBadges;
|
||||
|
||||
@override
|
||||
String? get bottomLeftSubTitle => customBottomLeftSubTitle;
|
||||
|
||||
@override
|
||||
String? get description => paymentMethodType.description ?? customDescription;
|
||||
|
||||
@@ -190,14 +218,64 @@ class PaymentMethod extends SelectableOption {
|
||||
return PaymentMethod(
|
||||
paymentMethodType: PaymentType.all,
|
||||
customTitle: 'All Payment Methods',
|
||||
customIconPath: 'assets/images/dollar_coin.svg');
|
||||
customIconPath: 'assets/new-ui/buy_payment_methods/all_methods.svg');
|
||||
}
|
||||
|
||||
factory PaymentMethod.fromMoonPayJson(Map<String, dynamic> json, PaymentType paymentType) {
|
||||
factory PaymentMethod.fromOnramperJson(Map<String, dynamic> json) {
|
||||
final type = PaymentMethod.getPaymentTypeId(json['paymentTypeId'] as String?);
|
||||
return PaymentMethod(
|
||||
paymentMethodType: type ?? PaymentType.unknown,
|
||||
customPaymentMethodType: json['paymentTypeId'] as String?,
|
||||
customTitle: json['name'] as String? ?? 'Unknown',
|
||||
customIconPath: json['icon'] as String? ?? 'assets/new-ui/buy_payment_methods/debit_card.svg',
|
||||
customDescription: json['description'] as String?);
|
||||
}
|
||||
|
||||
factory PaymentMethod.fromDFX(String paymentMethod, PaymentType paymentType) {
|
||||
return PaymentMethod(
|
||||
paymentMethodType: paymentType,
|
||||
customTitle: json['paymentMethod'] as String,
|
||||
customIconPath: 'assets/images/card.png');
|
||||
customTitle: paymentMethod,
|
||||
customIconPath: 'assets/new-ui/buy_payment_methods/debit_card.svg');
|
||||
}
|
||||
|
||||
factory PaymentMethod.fromMoonPayJson(MoonPayPaymentMethod method, PaymentType paymentType) {
|
||||
final List<String> badges = [];
|
||||
String? limitSubtitle;
|
||||
if (paymentType == PaymentType.moonpayCashApp) {
|
||||
badges.add('New');
|
||||
}
|
||||
if (method.limitAmount != null && method.limitCurrencyCode != null) {
|
||||
limitSubtitle =
|
||||
'max: ${formatWithCommas(method.limitAmount.toString())} ${method.limitCurrencyCode!.toUpperCase()}';
|
||||
}
|
||||
|
||||
return PaymentMethod(
|
||||
paymentMethodType: paymentType,
|
||||
customTitle: method.displayName,
|
||||
customIconPath: method.iconUrl.isNotEmpty ? method.iconUrl : 'assets/images/card.png',
|
||||
customPaymentMethodType: method.type,
|
||||
customBadges: badges,
|
||||
customBottomLeftSubTitle: limitSubtitle,
|
||||
);
|
||||
}
|
||||
|
||||
factory PaymentMethod.fromMeldJson(Map<String, dynamic> json) {
|
||||
final type = PaymentMethod.getPaymentTypeId(json['paymentMethod'] as String?);
|
||||
final logos = json['logos'] as Map<String, dynamic>;
|
||||
return PaymentMethod(
|
||||
paymentMethodType: type ?? PaymentType.unknown,
|
||||
customTitle: json['name'] as String? ?? 'Unknown',
|
||||
customIconPath: logos['dark'] as String? ?? 'assets/new-ui/buy_payment_methods/debit_card.svg',
|
||||
customDescription: json['description'] as String?);
|
||||
}
|
||||
|
||||
factory PaymentMethod.fromKryptonimJson(Map<String, dynamic> json) {
|
||||
final type = PaymentMethod.getPaymentTypeId(json['payment_method'] as String?);
|
||||
return PaymentMethod(
|
||||
paymentMethodType: type ?? PaymentType.unknown,
|
||||
customTitle: json['payment_method'] as String? ?? 'Unknown',
|
||||
customIconPath: 'assets/new-ui/buy_payment_methods/debit_card.svg',
|
||||
);
|
||||
}
|
||||
|
||||
static PaymentType? getPaymentTypeId(String? type) {
|
||||
|
||||
Reference in New Issue
Block a user