CAKE-345 | merged release-4.2.4 branch into current and resolved problems

This commit is contained in:
OleksandrSobol
2021-07-22 19:48:26 +03:00
parent 2a047e1f51
commit c14d021f07
8 changed files with 98 additions and 96 deletions
+1 -16
View File
@@ -784,22 +784,7 @@ class ExchangePage extends BasePage {
BuildContext context, String domain, String ticker) async {
final parsedAddress = await parseAddressFromDomain(domain, ticker);
switch (parsedAddress.parseFrom) {
case ParseFrom.unstoppableDomains:
showAddressAlert(
context,
S.of(context).address_detected,
S.of(context).address_from_domain(parsedAddress.name));
break;
case ParseFrom.openAlias:
showAddressAlert(
context,
S.of(context).openalias_alert_title,
S.of(context).openalias_alert_content(parsedAddress.name));
break;
case ParseFrom.notParsed:
break;
}
showAddressAlert(context, parsedAddress);
return parsedAddress.address;
}
+4 -15
View File
@@ -1,8 +1,4 @@
import 'dart:ui';
import 'package:cake_wallet/entities/parsed_address.dart';
import 'package:cake_wallet/entities/transaction_priority.dart';
import 'package:cake_wallet/entities/parse_address_from_domain.dart';
import 'package:cake_wallet/src/screens/send/widgets/parse_address_from_domain_alert.dart';
import 'package:cake_wallet/src/screens/send/widgets/parse_address_from_domain_alert.dart';
import 'package:cake_wallet/src/screens/send/widgets/send_card.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
@@ -83,7 +79,7 @@ class SendPage extends BasePage {
content: Column(
children: <Widget>[
Container(
height: 445,
height: 470,
child: Observer(
builder: (_) {
return PageView.builder(
@@ -219,16 +215,9 @@ class SendPage extends BasePage {
item.address =
template.address;
item.setCryptoAmount(template.amount);
final record =
await item.getOpenaliasRecord();
if (record != null) {
showAddressAlert(
context,
S.current.openalias_alert_title,
S.current
.openalias_alert_content(record.name));
}
final parsedAddress = await item
.applyOpenaliasOrUnstoppableDomains();
showAddressAlert(context, parsedAddress);
},
onRemove: () {
showPopUp<void>(
@@ -146,7 +146,6 @@ class SendTemplatePage extends BasePage {
.primaryTextTheme
.headline
.decorationColor),
validator: sendTemplateViewModel.addressValidator,
),
),
Padding(
@@ -1,9 +1,26 @@
import 'package:cake_wallet/entities/parsed_address.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart';
void showAddressAlert(BuildContext context, String title, String content) async {
void showAddressAlert(BuildContext context, ParsedAddress parsedAddress) async {
var title = '';
var content = '';
switch (parsedAddress.parseFrom) {
case ParseFrom.unstoppableDomains:
title = S.of(context).address_detected;
content = S.of(context).address_from_domain(parsedAddress.name);
break;
case ParseFrom.openAlias:
title = S.of(context).openalias_alert_title;
content = S.of(context).openalias_alert_content(parsedAddress.name);
break;
case ParseFrom.notParsed:
return;
}
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
+37 -10
View File
@@ -1,5 +1,6 @@
import 'dart:ui';
import 'package:cake_wallet/entities/transaction_priority.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/send/widgets/parse_address_from_domain_alert.dart';
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
import 'package:cake_wallet/src/widgets/picker.dart';
@@ -79,7 +80,7 @@ class SendCardState extends State<SendCard>
)
]),
child: Container(
height: 445,
height: 470,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24),
@@ -140,6 +141,11 @@ class SendCardState extends State<SendCard>
.primaryTextTheme
.headline
.decorationColor),
onPushPasteButton: (context) async {
final parsedAddress =
await item.applyOpenaliasOrUnstoppableDomains();
showAddressAlert(context, parsedAddress);
},
validator: sendViewModel.addressValidator,
),
Observer(
@@ -393,7 +399,34 @@ class SendCardState extends State<SendCard>
],
),
),
))
)),
if (sendViewModel.isElectrumWallet) Padding(
padding: EdgeInsets.only(top: 6),
child: GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.unspentCoinsList),
child: Container(
color: Colors.transparent,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
S.of(context).coin_control,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white)),
Icon(
Icons.arrow_forward_ios,
size: 12,
color: Colors.white,
)
],
)
)
)
)
],
)
),
@@ -485,14 +518,8 @@ class SendCardState extends State<SendCard>
addressFocusNode.addListener(() async {
if (!addressFocusNode.hasFocus && addressController.text.isNotEmpty) {
final record = await item.getOpenaliasRecord();
if (record != null) {
showAddressAlert(
context,
S.current.openalias_alert_title,
S.current.openalias_alert_content(record.name));
}
final parsedAddress = await item.applyOpenaliasOrUnstoppableDomains();
showAddressAlert(context, parsedAddress);
}
});