diff --git a/lib/src/domain/common/openalias.dart b/lib/src/domain/common/openalias.dart index 73afb6a3d..641c2a4bc 100644 --- a/lib/src/domain/common/openalias.dart +++ b/lib/src/domain/common/openalias.dart @@ -13,34 +13,38 @@ String formatDomainName(String name) { Future> fetchXmrAddressAndRecipientName(String name) async { final map = {"recipient_address" : name, "recipient_name" : name}; - await DnsUtils.lookupRecord(name, RRecordType.TXT, dnssec: true).then((txtRecord) { - if (txtRecord != null) { - String record; + try { + await DnsUtils.lookupRecord(name, RRecordType.TXT, dnssec: true).then((txtRecord) { + if (txtRecord != null) { + String record; - for (int i = 0; i < txtRecord.length; i++) { - record = txtRecord[i].data; + for (int i = 0; i < txtRecord.length; i++) { + record = txtRecord[i].data; - if (record.contains("oa1:xmr") && record.contains("recipient_address")) { - record = record.replaceAll('\"', ""); + if (record.contains("oa1:xmr") && record.contains("recipient_address")) { + record = record.replaceAll('\"', ""); - final dataList = record.split(";"); + final dataList = record.split(";"); - map["recipient_address"] = dataList.where((item) => (item.contains("recipient_address"))) - .toString().replaceAll("oa1:xmr recipient_address=", "") - .replaceAll("(", "").replaceAll(")", "").trim(); - - final recipientName = dataList.where((item) => (item.contains("recipient_name"))).toString(); - - if (recipientName.isNotEmpty) { - map["recipient_name"] = recipientName.replaceAll("recipient_name=", "") + map["recipient_address"] = dataList.where((item) => (item.contains("recipient_address"))) + .toString().replaceAll("oa1:xmr recipient_address=", "") .replaceAll("(", "").replaceAll(")", "").trim(); - } - break; + final recipientName = dataList.where((item) => (item.contains("recipient_name"))).toString(); + + if (recipientName.isNotEmpty) { + map["recipient_name"] = recipientName.replaceAll("recipient_name=", "") + .replaceAll("(", "").replaceAll(")", "").trim(); + } + + break; + } } } - } - }); + }); + } catch (e) { + print("${e.toString()}"); + } return map; } \ No newline at end of file diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 33f2eb254..f0a2b97ca 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -58,7 +58,7 @@ class SendFormState extends State { @override void initState() { _focusNode.addListener(() async { - if (_addressController.text.isNotEmpty) { + if (!_focusNode.hasFocus &&_addressController.text.isNotEmpty) { await fetchXmrAddressAndRecipientName(formatDomainName(_addressController.text)).then((map) async { if (_addressController.text != map["recipient_address"]) {