mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Generic enhancements (#1668)
* Add more choices for pin code required duration * Fix spacing in Cake Features * Update Cake Features cards * Update Cake Pay image * Add NanoGPT image * Update Sign/Verify strings * Update more flags * update moonpay currency name * Update more icons * Add friendly message for less than minimum fee * fix translation [skip ci] * Fix icon theming and add Telegram link * Fix color issue for restore screen * rename matic poly to pol * minor potential fix [skip ci] * minor fix [skip ci] * Update analysis_options.yaml * fix translations * fix translation * revert regex changes * Update bitcoin_cash_electrum_server_list.yml * Update address_validator.dart --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -298,7 +298,9 @@ class MoonPayProvider extends BuyProvider {
|
||||
|
||||
String _normalizeCurrency(CryptoCurrency currency) {
|
||||
if (currency == CryptoCurrency.maticpoly) {
|
||||
return "MATIC_POLYGON";
|
||||
return "POL_POLYGON";
|
||||
} else if (currency == CryptoCurrency.matic) {
|
||||
return "POL";
|
||||
}
|
||||
|
||||
return currency.toString().toLowerCase();
|
||||
|
||||
@@ -5,9 +5,6 @@ import 'package:cake_wallet/solana/solana.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/erc20_token.dart';
|
||||
|
||||
const BEFORE_REGEX = '(^|\s)';
|
||||
const AFTER_REGEX = '(\$|\s)';
|
||||
|
||||
class AddressValidator extends TextValidator {
|
||||
AddressValidator({required CryptoCurrency type})
|
||||
: super(
|
||||
@@ -22,23 +19,21 @@ class AddressValidator extends TextValidator {
|
||||
length: getLength(type));
|
||||
|
||||
static String getPattern(CryptoCurrency type) {
|
||||
var pattern = "";
|
||||
if (type is Erc20Token) {
|
||||
pattern = '0x[0-9a-zA-Z]';
|
||||
return '0x[0-9a-zA-Z]';
|
||||
}
|
||||
switch (type) {
|
||||
case CryptoCurrency.xmr:
|
||||
pattern = '4[0-9a-zA-Z]{94}|8[0-9a-zA-Z]{94}|[0-9a-zA-Z]{106}';
|
||||
return '^4[0-9a-zA-Z]{94}\$|^8[0-9a-zA-Z]{94}\$|^[0-9a-zA-Z]{106}\$';
|
||||
case CryptoCurrency.ada:
|
||||
pattern = '[0-9a-zA-Z]{59}|[0-9a-zA-Z]{92}|[0-9a-zA-Z]{104}'
|
||||
'|[0-9a-zA-Z]{105}|addr1[0-9a-zA-Z]{98}';
|
||||
return '^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{104}\$'
|
||||
'|^[0-9a-zA-Z]{105}\$|^addr1[0-9a-zA-Z]{98}\$';
|
||||
case CryptoCurrency.btc:
|
||||
pattern =
|
||||
'${P2pkhAddress.regex.pattern}|${P2shAddress.regex.pattern}|${P2wpkhAddress.regex.pattern}|${P2trAddress.regex.pattern}|${P2wshAddress.regex.pattern}|${SilentPaymentAddress.regex.pattern}';
|
||||
return '^${P2pkhAddress.regex.pattern}\$|^${P2shAddress.regex.pattern}\$|^${P2wpkhAddress.regex.pattern}\$|${P2trAddress.regex.pattern}\$|^${P2wshAddress.regex.pattern}\$|^${SilentPaymentAddress.regex.pattern}\$';
|
||||
case CryptoCurrency.nano:
|
||||
pattern = '[0-9a-zA-Z_]';
|
||||
return '[0-9a-zA-Z_]';
|
||||
case CryptoCurrency.banano:
|
||||
pattern = '[0-9a-zA-Z_]';
|
||||
return '[0-9a-zA-Z_]';
|
||||
case CryptoCurrency.usdc:
|
||||
case CryptoCurrency.usdcpoly:
|
||||
case CryptoCurrency.usdtPoly:
|
||||
@@ -74,11 +69,11 @@ class AddressValidator extends TextValidator {
|
||||
case CryptoCurrency.dydx:
|
||||
case CryptoCurrency.steth:
|
||||
case CryptoCurrency.shib:
|
||||
pattern = '0x[0-9a-zA-Z]';
|
||||
return '0x[0-9a-zA-Z]';
|
||||
case CryptoCurrency.xrp:
|
||||
pattern = '[0-9a-zA-Z]{34}|X[0-9a-zA-Z]{46}';
|
||||
return '^[0-9a-zA-Z]{34}\$|^X[0-9a-zA-Z]{46}\$';
|
||||
case CryptoCurrency.xhv:
|
||||
pattern = 'hvx|hvi|hvs[0-9a-zA-Z]';
|
||||
return '^hvx|hvi|hvs[0-9a-zA-Z]';
|
||||
case CryptoCurrency.xag:
|
||||
case CryptoCurrency.xau:
|
||||
case CryptoCurrency.xaud:
|
||||
@@ -100,43 +95,40 @@ class AddressValidator extends TextValidator {
|
||||
case CryptoCurrency.dash:
|
||||
case CryptoCurrency.eos:
|
||||
case CryptoCurrency.wow:
|
||||
pattern = '[0-9a-zA-Z]';
|
||||
return '[0-9a-zA-Z]';
|
||||
case CryptoCurrency.bch:
|
||||
pattern =
|
||||
'(?!bitcoincash:)[0-9a-zA-Z]*|(?!bitcoincash:)q|p[0-9a-zA-Z]{41}|(?!bitcoincash:)q|p[0-9a-zA-Z]{42}|bitcoincash:q|p[0-9a-zA-Z]{41}|bitcoincash:q|p[0-9a-zA-Z]{42}';
|
||||
return '^(?!bitcoincash:)[0-9a-zA-Z]*\$|^(?!bitcoincash:)q|p[0-9a-zA-Z]{41}\$|^(?!bitcoincash:)q|p[0-9a-zA-Z]{42}\$|^bitcoincash:q|p[0-9a-zA-Z]{41}\$|^bitcoincash:q|p[0-9a-zA-Z]{42}\$';
|
||||
case CryptoCurrency.bnb:
|
||||
pattern = '[0-9a-zA-Z]';
|
||||
return '[0-9a-zA-Z]';
|
||||
case CryptoCurrency.ltc:
|
||||
pattern = '(?!(ltc|LTC)1)[0-9a-zA-Z]*|(LTC1[A-Z0-9]*)|(ltc1[a-z0-9]*)';
|
||||
return '^(?!(ltc|LTC)1)[0-9a-zA-Z]*\$|(^LTC1[A-Z0-9]*\$)|(^ltc1[a-z0-9]*\$)';
|
||||
case CryptoCurrency.hbar:
|
||||
pattern = '[0-9a-zA-Z.]';
|
||||
return '[0-9a-zA-Z.]';
|
||||
case CryptoCurrency.zaddr:
|
||||
pattern = 'zs[0-9a-zA-Z]{75}';
|
||||
return '^zs[0-9a-zA-Z]{75}';
|
||||
case CryptoCurrency.zec:
|
||||
pattern = 't1[0-9a-zA-Z]{33}|t3[0-9a-zA-Z]{33}';
|
||||
return '^t1[0-9a-zA-Z]{33}\$|^t3[0-9a-zA-Z]{33}\$';
|
||||
case CryptoCurrency.dcr:
|
||||
pattern = 'D[ksecS]([0-9a-zA-Z])+';
|
||||
return 'D[ksecS]([0-9a-zA-Z])+';
|
||||
case CryptoCurrency.rvn:
|
||||
pattern = '[Rr]([1-9a-km-zA-HJ-NP-Z]){33}';
|
||||
return '[Rr]([1-9a-km-zA-HJ-NP-Z]){33}';
|
||||
case CryptoCurrency.near:
|
||||
pattern = '[0-9a-f]{64}';
|
||||
return '[0-9a-f]{64}';
|
||||
case CryptoCurrency.rune:
|
||||
pattern = 'thor1[0-9a-z]{38}';
|
||||
return 'thor1[0-9a-z]{38}';
|
||||
case CryptoCurrency.scrt:
|
||||
pattern = 'secret1[0-9a-z]{38}';
|
||||
return 'secret1[0-9a-z]{38}';
|
||||
case CryptoCurrency.stx:
|
||||
pattern = 'S[MP][0-9a-zA-Z]+';
|
||||
return 'S[MP][0-9a-zA-Z]+';
|
||||
case CryptoCurrency.kmd:
|
||||
pattern = 'R[0-9a-zA-Z]{33}';
|
||||
return 'R[0-9a-zA-Z]{33}';
|
||||
case CryptoCurrency.pivx:
|
||||
pattern = 'D([1-9a-km-zA-HJ-NP-Z]){33}';
|
||||
return 'D([1-9a-km-zA-HJ-NP-Z]){33}';
|
||||
case CryptoCurrency.btcln:
|
||||
pattern = '(lnbc|LNBC)([0-9]{1,}[a-zA-Z0-9]+)';
|
||||
return '^(lnbc|LNBC)([0-9]{1,}[a-zA-Z0-9]+)';
|
||||
default:
|
||||
pattern = '[0-9a-zA-Z]';
|
||||
return '[0-9a-zA-Z]';
|
||||
}
|
||||
|
||||
return '$BEFORE_REGEX$pattern$AFTER_REGEX';
|
||||
}
|
||||
|
||||
static List<int>? getLength(CryptoCurrency type) {
|
||||
@@ -277,54 +269,56 @@ class AddressValidator extends TextValidator {
|
||||
}
|
||||
|
||||
static String? getAddressFromStringPattern(CryptoCurrency type) {
|
||||
String? pattern = null;
|
||||
|
||||
switch (type) {
|
||||
case CryptoCurrency.xmr:
|
||||
case CryptoCurrency.wow:
|
||||
pattern = '4[0-9a-zA-Z]{94}'
|
||||
'|8[0-9a-zA-Z]{94}'
|
||||
'|[0-9a-zA-Z]{106}';
|
||||
return '([^0-9a-zA-Z]|^)4[0-9a-zA-Z]{94}([^0-9a-zA-Z]|\$)'
|
||||
'|([^0-9a-zA-Z]|^)8[0-9a-zA-Z]{94}([^0-9a-zA-Z]|\$)'
|
||||
'|([^0-9a-zA-Z]|^)[0-9a-zA-Z]{106}([^0-9a-zA-Z]|\$)';
|
||||
case CryptoCurrency.btc:
|
||||
pattern =
|
||||
'${P2pkhAddress.regex.pattern}|${P2shAddress.regex.pattern}|${P2wpkhAddress.regex.pattern}|${P2trAddress.regex.pattern}|${P2wshAddress.regex.pattern}|${SilentPaymentAddress.regex.pattern}';
|
||||
return '([^0-9a-zA-Z]|^)([1mn][a-km-zA-HJ-NP-Z1-9]{25,34})([^0-9a-zA-Z]|\$)' //P2pkhAddress type
|
||||
'|([^0-9a-zA-Z]|^)([23][a-km-zA-HJ-NP-Z1-9]{25,34})([^0-9a-zA-Z]|\$)' //P2shAddress type
|
||||
'|([^0-9a-zA-Z]|^)((bc|tb)1q[ac-hj-np-z02-9]{25,39})([^0-9a-zA-Z]|\$)' //P2wpkhAddress type
|
||||
'|([^0-9a-zA-Z]|^)((bc|tb)1q[ac-hj-np-z02-9]{40,80})([^0-9a-zA-Z]|\$)' //P2wshAddress type
|
||||
'|([^0-9a-zA-Z]|^)((bc|tb)1p([ac-hj-np-z02-9]{39}|[ac-hj-np-z02-9]{59}|[ac-hj-np-z02-9]{8,89}))([^0-9a-zA-Z]|\$)' //P2trAddress type
|
||||
'|${SilentPaymentAddress.regex.pattern}\$';
|
||||
|
||||
case CryptoCurrency.ltc:
|
||||
pattern = '^L[a-zA-Z0-9]{26,33}'
|
||||
'|[LM][a-km-zA-HJ-NP-Z1-9]{26,33}'
|
||||
'|ltc[a-zA-Z0-9]{26,45}';
|
||||
return '([^0-9a-zA-Z]|^)^L[a-zA-Z0-9]{26,33}([^0-9a-zA-Z]|\$)'
|
||||
'|([^0-9a-zA-Z]|^)[LM][a-km-zA-HJ-NP-Z1-9]{26,33}([^0-9a-zA-Z]|\$)'
|
||||
'|([^0-9a-zA-Z]|^)ltc[a-zA-Z0-9]{26,45}([^0-9a-zA-Z]|\$)';
|
||||
case CryptoCurrency.eth:
|
||||
pattern = '0x[0-9a-zA-Z]{42}';
|
||||
return '0x[0-9a-zA-Z]{42}';
|
||||
case CryptoCurrency.maticpoly:
|
||||
pattern = '0x[0-9a-zA-Z]{42}';
|
||||
return '0x[0-9a-zA-Z]{42}';
|
||||
case CryptoCurrency.nano:
|
||||
pattern = 'nano_[0-9a-zA-Z]{60}';
|
||||
return 'nano_[0-9a-zA-Z]{60}';
|
||||
case CryptoCurrency.banano:
|
||||
pattern = 'ban_[0-9a-zA-Z]{60}';
|
||||
return 'ban_[0-9a-zA-Z]{60}';
|
||||
case CryptoCurrency.bch:
|
||||
pattern = '(bitcoincash:)?q[0-9a-zA-Z]{41,42}';
|
||||
return 'bitcoincash:q[0-9a-zA-Z]{41}([^0-9a-zA-Z]|\$)'
|
||||
'|bitcoincash:q[0-9a-zA-Z]{42}([^0-9a-zA-Z]|\$)'
|
||||
'|([^0-9a-zA-Z]|^)q[0-9a-zA-Z]{41}([^0-9a-zA-Z]|\$)'
|
||||
'|([^0-9a-zA-Z]|^)q[0-9a-zA-Z]{42}([^0-9a-zA-Z]|\$)';
|
||||
case CryptoCurrency.sol:
|
||||
pattern = '[1-9A-HJ-NP-Za-km-z]{43,44}';
|
||||
return '([^0-9a-zA-Z]|^)[1-9A-HJ-NP-Za-km-z]{43,44}([^0-9a-zA-Z]|\$)';
|
||||
case CryptoCurrency.trx:
|
||||
pattern = '(T|t)[1-9A-HJ-NP-Za-km-z]{33}';
|
||||
return '(T|t)[1-9A-HJ-NP-Za-km-z]{33}';
|
||||
default:
|
||||
if (type.tag == CryptoCurrency.eth.title) {
|
||||
pattern = '0x[0-9a-zA-Z]{42}';
|
||||
return '0x[0-9a-zA-Z]{42}';
|
||||
}
|
||||
if (type.tag == CryptoCurrency.maticpoly.tag) {
|
||||
pattern = '0x[0-9a-zA-Z]{42}';
|
||||
return '0x[0-9a-zA-Z]{42}';
|
||||
}
|
||||
if (type.tag == CryptoCurrency.sol.title) {
|
||||
pattern = '[1-9A-HJ-NP-Za-km-z]{43,44}';
|
||||
return '([^0-9a-zA-Z]|^)[1-9A-HJ-NP-Za-km-z]{43,44}([^0-9a-zA-Z]|\$)';
|
||||
}
|
||||
if (type.tag == CryptoCurrency.trx.title) {
|
||||
pattern = '(T|t)[1-9A-HJ-NP-Za-km-z]{33}';
|
||||
return '(T|t)[1-9A-HJ-NP-Za-km-z]{33}';
|
||||
}
|
||||
}
|
||||
|
||||
if (pattern != null) {
|
||||
return "$BEFORE_REGEX$pattern$AFTER_REGEX";
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,39 @@
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
enum PinCodeRequiredDuration {
|
||||
always(0),
|
||||
tenminutes(10),
|
||||
onehour(60);
|
||||
enum PinCodeRequiredDuration {
|
||||
always(0),
|
||||
tenMinutes(10),
|
||||
halfHour(30),
|
||||
fortyFiveMinutes(45),
|
||||
oneHour(60);
|
||||
|
||||
const PinCodeRequiredDuration(this.value);
|
||||
|
||||
final int value;
|
||||
|
||||
static PinCodeRequiredDuration deserialize({required int raw}) =>
|
||||
PinCodeRequiredDuration.values.firstWhere((e) => e.value == raw);
|
||||
|
||||
@override
|
||||
String toString(){
|
||||
String toString() {
|
||||
String label = '';
|
||||
switch (this) {
|
||||
case PinCodeRequiredDuration.always:
|
||||
label = S.current.always;
|
||||
break;
|
||||
case PinCodeRequiredDuration.tenminutes:
|
||||
case PinCodeRequiredDuration.tenMinutes:
|
||||
label = S.current.minutes_to_pin_code('10');
|
||||
break;
|
||||
case PinCodeRequiredDuration.onehour:
|
||||
case PinCodeRequiredDuration.oneHour:
|
||||
label = S.current.minutes_to_pin_code('60');
|
||||
break;
|
||||
case PinCodeRequiredDuration.halfHour:
|
||||
label = S.current.minutes_to_pin_code('30');
|
||||
break;
|
||||
case PinCodeRequiredDuration.fortyFiveMinutes:
|
||||
label = S.current.minutes_to_pin_code('45');
|
||||
break;
|
||||
}
|
||||
return label;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
||||
case CryptoCurrency.usdcsol:
|
||||
return 'usdcspl';
|
||||
case CryptoCurrency.matic:
|
||||
return 'maticerc20';
|
||||
return 'pol';
|
||||
case CryptoCurrency.maticpoly:
|
||||
return 'matic';
|
||||
default:
|
||||
|
||||
@@ -156,7 +156,8 @@ class CWPolygon extends Polygon {
|
||||
@override
|
||||
CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction) {
|
||||
transaction as EVMChainTransactionInfo;
|
||||
if (transaction.tokenSymbol == CryptoCurrency.maticpoly.title) {
|
||||
if (transaction.tokenSymbol == CryptoCurrency.maticpoly.title ||
|
||||
transaction.tokenSymbol == "MATIC") {
|
||||
return CryptoCurrency.maticpoly;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,20 +52,26 @@ class CakeFeaturesPage extends StatelessWidget {
|
||||
onTap: () => _navigatorToGiftCardsPage(context),
|
||||
title: 'Cake Pay',
|
||||
subTitle: S.of(context).cake_pay_subtitle,
|
||||
svgPicture: SvgPicture.asset(
|
||||
'assets/images/cards.svg',
|
||||
height: 125,
|
||||
width: 125,
|
||||
image: Image.asset(
|
||||
'assets/images/cards.png',
|
||||
height: 100,
|
||||
width: 115,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
DashBoardRoundedCardWidget(
|
||||
onTap: () => _launchUrl("cake.nano-gpt.com"),
|
||||
title: "NanoGPT",
|
||||
subTitle: S.of(context).nanogpt_subtitle,
|
||||
onTap: () => _launchUrl("cake.nano-gpt.com"),
|
||||
image: Image.asset(
|
||||
'assets/images/nanogpt.png',
|
||||
height: 80,
|
||||
width: 80,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
SizedBox(height: 10),
|
||||
Observer(
|
||||
builder: (context) {
|
||||
if (!dashboardViewModel.hasSignMessages) {
|
||||
@@ -75,6 +81,12 @@ class CakeFeaturesPage extends StatelessWidget {
|
||||
onTap: () => Navigator.of(context).pushNamed(Routes.signPage),
|
||||
title: S.current.sign_verify_message,
|
||||
subTitle: S.current.sign_verify_message_sub,
|
||||
icon: Icon(
|
||||
Icons.speaker_notes_rounded,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
size: 75,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/option_tile.dart';
|
||||
import 'package:cake_wallet/themes/extensions/option_tile_theme.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/permission_handler.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
@@ -20,6 +19,9 @@ import 'package:cw_core/hardware/device_connection_type.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/info_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
|
||||
class RestoreOptionsPage extends BasePage {
|
||||
RestoreOptionsPage({required this.isNewInstall});
|
||||
@@ -44,12 +46,16 @@ class RestoreOptionsPage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final imageColor = Theme.of(context).extension<OptionTileTheme>()!.titleColor;
|
||||
final mainImageColor = Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor;
|
||||
final brightImageColor = Theme.of(context).extension<InfoTheme>()!.textColor;
|
||||
final imageColor = currentTheme.type == ThemeType.bright ? brightImageColor : mainImageColor;
|
||||
final imageLedger = Image.asset('assets/images/ledger_nano.png', width: 40, color: imageColor);
|
||||
final imageSeedKeys = Image.asset('assets/images/restore_wallet_image.png', color: imageColor);
|
||||
final imageBackup = Image.asset('assets/images/backup.png', color: imageColor);
|
||||
final qrCode = Image.asset('assets/images/restore_qr.png', color: imageColor);
|
||||
|
||||
|
||||
|
||||
return Center(
|
||||
child: Container(
|
||||
width: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
|
||||
@@ -96,12 +102,15 @@ class RestoreOptionsPage extends BasePage {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: OptionTile(
|
||||
key: ValueKey('restore_options_from_qr_button_key'),
|
||||
onPressed: () => _onScanQRCode(context),
|
||||
image: qrCode,
|
||||
title: S.of(context).scan_qr_code,
|
||||
description: S.of(context).cold_or_recover_wallet,
|
||||
),
|
||||
key: ValueKey('restore_options_from_qr_button_key'),
|
||||
onPressed: () => _onScanQRCode(context),
|
||||
icon: Icon(
|
||||
Icons.qr_code_rounded,
|
||||
color: imageColor,
|
||||
size: 50,
|
||||
),
|
||||
title: S.of(context).scan_qr_code,
|
||||
description: S.of(context).cold_or_recover_wallet),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -2,17 +2,20 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/option_tile.dart';
|
||||
import 'package:cake_wallet/themes/extensions/info_theme.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/view_model/support_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
|
||||
class SupportPage extends BasePage {
|
||||
SupportPage(this.supportViewModel);
|
||||
|
||||
final SupportViewModel supportViewModel;
|
||||
|
||||
final imageLiveSupport = Image.asset('assets/images/live_support.png');
|
||||
final imageLiveSupport = Image.asset('assets/images/cake_icon.png');
|
||||
final imageWalletGuides = Image.asset('assets/images/wallet_guides.png');
|
||||
final imageMoreLinks = Image.asset('assets/images/more_links.png');
|
||||
|
||||
@@ -22,8 +25,16 @@ class SupportPage extends BasePage {
|
||||
@override
|
||||
AppBarStyle get appBarStyle => AppBarStyle.regular;
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
|
||||
final mainColor = Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor;
|
||||
final brightColor = Theme.of(context).extension<InfoTheme>()!.textColor;
|
||||
|
||||
final iconColor = currentTheme.type == ThemeType.bright ? brightColor : mainColor;
|
||||
|
||||
return Container(
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
@@ -33,7 +44,11 @@ class SupportPage extends BasePage {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: OptionTile(
|
||||
image: imageLiveSupport,
|
||||
icon: Icon(
|
||||
Icons.support_agent,
|
||||
color: iconColor,
|
||||
size: 50,
|
||||
),
|
||||
title: S.of(context).support_title_live_chat,
|
||||
description: S.of(context).support_description_live_chat,
|
||||
onPressed: () {
|
||||
@@ -48,7 +63,11 @@ class SupportPage extends BasePage {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: OptionTile(
|
||||
image: imageWalletGuides,
|
||||
icon: Icon(
|
||||
Icons.find_in_page,
|
||||
color: iconColor,
|
||||
size: 50,
|
||||
),
|
||||
title: S.of(context).support_title_guides,
|
||||
description: S.of(context).support_description_guides,
|
||||
onPressed: () => _launchUrl(supportViewModel.guidesUrl),
|
||||
@@ -57,7 +76,11 @@ class SupportPage extends BasePage {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: OptionTile(
|
||||
image: imageMoreLinks,
|
||||
icon: Icon(
|
||||
Icons.contact_support,
|
||||
color: iconColor,
|
||||
size: 50,
|
||||
),
|
||||
title: S.of(context).support_title_other_links,
|
||||
description: S.of(context).support_description_other_links,
|
||||
onPressed: () => Navigator.pushNamed(context, Routes.supportOtherLinks),
|
||||
|
||||
@@ -37,7 +37,6 @@ class SupportOtherLinksPage extends BasePage {
|
||||
itemCounter: (int _) => supportViewModel.items.length,
|
||||
itemBuilder: (_, index) {
|
||||
final item = supportViewModel.items[index];
|
||||
|
||||
if (item is RegularListItem) {
|
||||
return SettingsCellWithArrow(title: item.title, handler: item.handler);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
|
||||
required this.subTitle,
|
||||
this.hint,
|
||||
this.svgPicture,
|
||||
this.image,
|
||||
this.icon,
|
||||
this.onClose,
|
||||
this.customBorder,
|
||||
@@ -22,6 +23,7 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
|
||||
final String subTitle;
|
||||
final Widget? hint;
|
||||
final SvgPicture? svgPicture;
|
||||
final Image? image;
|
||||
final Icon? icon;
|
||||
final double? customBorder;
|
||||
|
||||
@@ -77,7 +79,8 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (svgPicture != null) svgPicture!,
|
||||
if (image != null) image!
|
||||
else if (svgPicture != null) svgPicture!,
|
||||
if (icon != null) icon!
|
||||
],
|
||||
),
|
||||
|
||||
@@ -4,13 +4,16 @@ import 'package:flutter/material.dart';
|
||||
class OptionTile extends StatelessWidget {
|
||||
const OptionTile(
|
||||
{required this.onPressed,
|
||||
required this.image,
|
||||
this.image,
|
||||
this.icon,
|
||||
required this.title,
|
||||
required this.description,
|
||||
super.key});
|
||||
super.key})
|
||||
: assert(image!=null || icon!=null);
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final Image image;
|
||||
final Image? image;
|
||||
final Icon? icon;
|
||||
final String title;
|
||||
final String description;
|
||||
|
||||
@@ -31,7 +34,7 @@ class OptionTile extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
image,
|
||||
icon ?? image!,
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 16),
|
||||
|
||||
@@ -570,7 +570,7 @@ abstract class SettingsStoreBase with Store {
|
||||
|
||||
static const defaultPinLength = 4;
|
||||
static const defaultActionsMode = 11;
|
||||
static const defaultPinCodeTimeOutDuration = PinCodeRequiredDuration.tenminutes;
|
||||
static const defaultPinCodeTimeOutDuration = PinCodeRequiredDuration.tenMinutes;
|
||||
static const defaultAutoGenerateSubaddressStatus = AutoGenerateSubaddressStatus.initialized;
|
||||
static final walletPasswordDirectInput = Platform.isLinux;
|
||||
static const defaultSeedPhraseLength = SeedPhraseLength.twelveWords;
|
||||
|
||||
@@ -21,9 +21,9 @@ class ExceptionHandler {
|
||||
static File? _file;
|
||||
|
||||
static void _saveException(String? error, StackTrace? stackTrace, {String? library}) async {
|
||||
if (_file == null) {
|
||||
final appDocDir = await getAppDir();
|
||||
final appDocDir = await getAppDir();
|
||||
|
||||
if (_file == null) {
|
||||
_file = File('${appDocDir.path}/error.txt');
|
||||
}
|
||||
|
||||
|
||||
@@ -692,6 +692,9 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
if (error is TransactionCommitFailedBIP68Final) {
|
||||
return S.current.tx_rejected_bip68_final;
|
||||
}
|
||||
if (error is TransactionCommitFailedLessThanMin) {
|
||||
return S.current.fee_less_than_min;
|
||||
}
|
||||
if (error is TransactionNoDustOnChangeException) {
|
||||
return S.current.tx_commit_exception_no_dust_on_change(error.min, error.max);
|
||||
}
|
||||
|
||||
@@ -14,14 +14,16 @@ abstract class SupportViewModelBase with Store {
|
||||
: items = [
|
||||
LinkListItem(
|
||||
title: 'Email',
|
||||
icon: 'assets/images/support_icon.png',
|
||||
linkTitle: 'support@cakewallet.com',
|
||||
link: 'mailto:support@cakewallet.com'),
|
||||
if (!isMoneroOnly)
|
||||
LinkListItem(
|
||||
title: 'Website',
|
||||
icon: 'assets/images/global.png',
|
||||
linkTitle: 'cakewallet.com',
|
||||
link: 'https://cakewallet.com'),
|
||||
if (!isMoneroOnly)
|
||||
if (!isMoneroOnly)
|
||||
LinkListItem(
|
||||
title: 'GitHub',
|
||||
icon: 'assets/images/github.png',
|
||||
@@ -29,7 +31,12 @@ abstract class SupportViewModelBase with Store {
|
||||
linkTitle: S.current.apk_update,
|
||||
link: 'https://github.com/cake-tech/cake_wallet/releases'),
|
||||
LinkListItem(
|
||||
title: 'Telegram',
|
||||
title: 'Telegram Community',
|
||||
icon: 'assets/images/Telegram.png',
|
||||
linkTitle: 't.me/cakewallet',
|
||||
link: 'https://t.me/cakewallet'),
|
||||
LinkListItem(
|
||||
title: 'Telegram Support Bot',
|
||||
icon: 'assets/images/Telegram.png',
|
||||
linkTitle: '@cakewallet_bot',
|
||||
link: 'https://t.me/cakewallet_bot'),
|
||||
|
||||
Reference in New Issue
Block a user