Merge branch 'main' into CAKE-345-batch-sending

# Conflicts:
#	lib/bitcoin/electrum_wallet.dart
This commit is contained in:
OleksandrSobol 2021-08-04 17:43:03 +03:00
commit 3abb78febf
24 changed files with 172 additions and 48 deletions

6
.gitignore vendored
View file

@ -100,4 +100,8 @@ ios/Flutter/.last_build_id
/**/#**#
**/google-services.json
**/GoogleService-Info.plist
**/GoogleService-Info.plist
\#*\#
.\#*

View file

@ -366,7 +366,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 51;
CURRENT_PROJECT_VERSION = 53;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -510,7 +510,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 51;
CURRENT_PROJECT_VERSION = 53;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -546,7 +546,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 51;
CURRENT_PROJECT_VERSION = 53;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";

View file

@ -1,4 +1,4 @@
class BitcoinTransactionNoInputsException implements Exception {
@override
String toString() => 'No inputs for the transaction.';
}
String toString() => 'Not enough inputs available';
}

View file

@ -188,6 +188,7 @@ class ExchangePage extends BasePage {
exchangeViewModel.isDepositAddressEnabled,
isAmountEstimated: false,
hasRefundAddress: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: CryptoCurrency.all,
onCurrencySelected: (currency) {
// FIXME: need to move it into view model
@ -260,6 +261,7 @@ class ExchangePage extends BasePage {
exchangeViewModel
.isReceiveAddressEnabled,
isAmountEstimated: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies:
exchangeViewModel.receiveCurrencies,
onCurrencySelected: (currency) =>

View file

@ -136,6 +136,7 @@ class ExchangeTemplatePage extends BasePage {
.isDepositAddressEnabled,
isAmountEstimated: false,
hasRefundAddress: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: CryptoCurrency.all,
onCurrencySelected: (currency) =>
exchangeViewModel.changeDepositCurrency(
@ -175,6 +176,7 @@ class ExchangeTemplatePage extends BasePage {
initialIsAddressEditable:
exchangeViewModel.isReceiveAddressEnabled,
isAmountEstimated: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: exchangeViewModel.receiveCurrencies,
onCurrencySelected: (currency) =>
exchangeViewModel.changeReceiveCurrency(

View file

@ -1,3 +1,5 @@
import 'package:cake_wallet/entities/contact_base.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/services.dart';
@ -19,6 +21,7 @@ class ExchangeCard extends StatefulWidget {
this.initialIsAddressEditable,
this.isAmountEstimated,
this.hasRefundAddress = false,
this.isMoneroWallet = false,
this.currencies,
this.onCurrencySelected,
this.imageArrow,
@ -44,6 +47,7 @@ class ExchangeCard extends StatefulWidget {
final bool initialIsAddressEditable;
final bool isAmountEstimated;
final bool hasRefundAddress;
final bool isMoneroWallet;
final Image imageArrow;
final Color currencyButtonColor;
final Color addressButtonsColor;
@ -72,6 +76,7 @@ class ExchangeCardState extends State<ExchangeCard> {
bool _isAmountEditable;
bool _isAddressEditable;
bool _isAmountEstimated;
bool _isMoneroWallet;
@override
void initState() {
@ -81,6 +86,7 @@ class ExchangeCardState extends State<ExchangeCard> {
_walletName = widget.initialWalletName;
_selectedCurrency = widget.initialCurrency;
_isAmountEstimated = widget.isAmountEstimated;
_isMoneroWallet = widget.isMoneroWallet;
addressController.text = widget.initialAddress;
super.initState();
}
@ -322,34 +328,93 @@ class ExchangeCardState extends State<ExchangeCard> {
: Padding(
padding: EdgeInsets.only(top: 10),
child: Builder(
builder: (context) => GestureDetector(
onTap: () {
Clipboard.setData(
ClipboardData(text: addressController.text));
showBar<void>(
context, S.of(context).copied_to_clipboard);
},
child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Text(
addressController.text,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white),
),
),
Padding(
padding: EdgeInsets.only(left: 16),
child: copyImage,
builder: (context) => Stack(
children: <Widget> [
BaseTextFormField(
controller: addressController,
readOnly: true,
borderColor: Colors.transparent,
suffixIcon: SizedBox(
width: _isMoneroWallet ? 80 : 36
),
textStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white),
validator: widget.addressTextFieldValidator
),
Positioned(
top: 2,
right: 0,
child: SizedBox(
width: _isMoneroWallet ? 80 : 36,
child: Row(
children: <Widget>[
if (_isMoneroWallet) Padding(
padding: EdgeInsets.only(left: 10),
child: Container(
width: 34,
height: 34,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async {
final contact = await Navigator
.of(context, rootNavigator: true)
.pushNamed(
Routes.pickerAddressBook);
if (contact is ContactBase &&
contact.address != null) {
setState(() =>
addressController.text =
contact.address);
}
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: widget
.addressButtonsColor,
borderRadius: BorderRadius
.all(Radius.circular(6))),
child: Image.asset(
'assets/images/open_book.png',
color: Theme.of(context)
.primaryTextTheme
.display1
.decorationColor,
)),
)),
),
Padding(
padding: EdgeInsets.only(left: 2),
child: Container(
width: 34,
height: 34,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () {
Clipboard.setData(
ClipboardData(
text: addressController.text));
showBar<void>(
context, S.of(context)
.copied_to_clipboard);
},
child: Container(
padding: EdgeInsets
.fromLTRB(8, 8, 0, 8),
color: Colors.transparent,
child: copyImage),
))
)
]
)
],
),
)),
)
)
]
)
),
),
]),
);

View file

@ -86,9 +86,11 @@ class UnspentCoinsListFormState extends State<UnspentCoinsListForm> {
.pushNamed(Routes.unspentCoinsDetails,
arguments: [item, unspentCoinsListViewModel]),
child: UnspentCoinsListItem(
address: item.address,
note: item.note,
amount: item.amount,
address: item.address,
isSending: item.isSending,
isFrozen: item.isFrozen,
onCheckBoxTap: item.isFrozen
? null
: () async {

View file

@ -2,12 +2,15 @@ import 'package:auto_size_text/auto_size_text.dart';
import 'package:cake_wallet/palette.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart';
class UnspentCoinsListItem extends StatelessWidget {
UnspentCoinsListItem({
@required this.address,
@required this.note,
@required this.amount,
@required this.address,
@required this.isSending,
@required this.isFrozen,
@required this.onCheckBoxTap,
});
@ -16,14 +19,17 @@ class UnspentCoinsListItem extends StatelessWidget {
static const selectedItemColor = Palette.paleCornflowerBlue;
static const unselectedItemColor = Palette.moderateLavender;
final String address;
final String note;
final String amount;
final String address;
final bool isSending;
final bool isFrozen;
final Function() onCheckBoxTap;
@override
Widget build(BuildContext context) {
final itemColor = isSending? selectedItemColor : unselectedItemColor;
final _note = (note?.isNotEmpty ?? false) ? note : address;
return Container(
height: 62,
@ -51,7 +57,7 @@ class UnspentCoinsListItem extends StatelessWidget {
width: 1.0),
borderRadius: BorderRadius.all(
Radius.circular(8.0)),
color: Theme.of(context).backgroundColor),
color: itemColor),
child: isSending
? Icon(
Icons.check,
@ -67,22 +73,48 @@ class UnspentCoinsListItem extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AutoSizeText(
amount,
style: TextStyle(
color: amountColor,
fontSize: 16,
fontWeight: FontWeight.w600
),
maxLines: 1,
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: AutoSizeText(
amount,
style: TextStyle(
color: amountColor,
fontSize: 16,
fontWeight: FontWeight.w600
),
maxLines: 1,
),
),
if (isFrozen) Container(
height: 17,
padding: EdgeInsets.only(left: 6, right: 6),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.5)),
color: Colors.white),
alignment: Alignment.center,
child: Text(
S.of(context).frozen,
style: TextStyle(
color: amountColor,
fontSize: 7,
fontWeight: FontWeight.w600
),
)
)
],
),
AutoSizeText(
address,
Text(
_note,
style: TextStyle(
color: addressColor,
fontSize: 12,
),
maxLines: 1,
overflow: TextOverflow.ellipsis
)
]
)

View file

@ -9,6 +9,7 @@ import 'package:cake_wallet/exchange/exchange_provider.dart';
import 'package:cake_wallet/exchange/limits.dart';
import 'package:cake_wallet/exchange/trade.dart';
import 'package:cake_wallet/exchange/limits_state.dart';
import 'package:cake_wallet/monero/monero_wallet.dart';
import 'package:cake_wallet/store/dashboard/trades_store.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:intl/intl.dart';
@ -125,6 +126,8 @@ abstract class ExchangeViewModelBase with Store {
bool get hasAllAmount =>
wallet.type == WalletType.bitcoin && depositCurrency == wallet.currency;
bool get isMoneroWallet => wallet is MoneroWallet;
List<CryptoCurrency> receiveCurrencies;
Limits limits;

View file

@ -11,7 +11,7 @@ description: Cake Wallet.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 4.2.3+53
version: 4.2.4+57
environment:
sdk: ">=2.7.0 <3.0.0"

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Nicht ausgegebene Münzen",
"unspent_coins_details_title" : "Details zu nicht ausgegebenen Münzen",
"freeze" : "Einfrieren",
"frozen" : "Gefroren",
"coin_control" : "Münzkontrolle (optional)",
"address_detected" : "Adresse erkannt",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Unspent coins",
"unspent_coins_details_title" : "Unspent coins details",
"freeze" : "Freeze",
"frozen" : "Frozen",
"coin_control" : "Coin control (optional)",
"address_detected" : "Address detected",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Monedas no gastadas",
"unspent_coins_details_title" : "Detalles de monedas no gastadas",
"freeze" : "Congelar",
"frozen" : "Congelada",
"coin_control" : "Control de monedas (opcional)",
"address_detected" : "Dirección detectada",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "खर्च न किए गए सिक्के",
"unspent_coins_details_title" : "अव्ययित सिक्कों का विवरण",
"freeze" : "फ्रीज",
"frozen" : "जमा हुआ",
"coin_control" : "सिक्का नियंत्रण (वैकल्पिक)",
"address_detected" : "पता लग गया",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Nepotrošeni novčići",
"unspent_coins_details_title" : "Nepotrošeni detalji o novčićima",
"freeze" : "Zamrznuti",
"frozen" : "Smrznuto",
"coin_control" : "Kontrola novca (nije obavezno)",
"address_detected" : "Adresa je otkrivena",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Monete non spese",
"unspent_coins_details_title" : "Dettagli sulle monete non spese",
"freeze" : "Congelare",
"frozen" : "Congelato",
"coin_control" : "Controllo monete (opzionale)",
"address_detected" : "Indirizzo rilevato",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "未使用のコイン",
"unspent_coins_details_title" : "未使用のコインの詳細",
"freeze" : "氷結",
"frozen" : "凍った",
"coin_control" : "コインコントロール(オプション)",
"address_detected" : "アドレスが検出されました",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "사용하지 않은 동전",
"unspent_coins_details_title" : "사용하지 않은 동전 세부 정보",
"freeze" : "얼다",
"frozen" : "겨울 왕국",
"coin_control" : "코인 제어 (옵션)",
"address_detected" : "주소 감지",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Ongebruikte munten",
"unspent_coins_details_title" : "Details van niet-uitgegeven munten",
"freeze" : "Bevriezen",
"frozen" : "Bevroren",
"coin_control" : "Muntcontrole (optioneel)",
"address_detected" : "Adres gedetecteerd",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Niewydane monety",
"unspent_coins_details_title" : "Szczegóły niewydanych monet",
"freeze" : "Zamrażać",
"frozen" : "Mrożony",
"coin_control" : "Kontrola monet (opcjonalnie)",
"address_detected" : "Wykryto adres",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Moedas não gastas",
"unspent_coins_details_title" : "Detalhes de moedas não gastas",
"freeze" : "Congelar",
"frozen" : "Congeladas",
"coin_control" : "Controle de moedas (opcional)",
"address_detected" : "Endereço detectado",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Неизрасходованные монеты",
"unspent_coins_details_title" : "Сведения о неизрасходованных монетах",
"freeze" : "Заморозить",
"frozen" : "Заморожено",
"coin_control" : "Контроль монет (необязательно)",
"address_detected" : "Обнаружен адрес",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "Невитрачені монети",
"unspent_coins_details_title" : "Відомості про невитрачені монети",
"freeze" : "Заморозити",
"frozen" : "Заморожено",
"coin_control" : "Контроль монет (необов’язково)",
"address_detected" : "Виявлено адресу",

View file

@ -488,6 +488,7 @@
"unspent_coins_title" : "未使用的硬幣",
"unspent_coins_details_title" : "未使用代幣詳情",
"freeze" : "凍結",
"frozen" : "凍結的",
"coin_control" : "硬幣控制(可選)",
"address_detected" : "檢測到地址",