disable openalias

This commit is contained in:
julian 2023-06-07 07:36:54 -06:00
parent 68083a4129
commit 05832287e7
2 changed files with 169 additions and 160 deletions

View file

@ -978,21 +978,27 @@ class _SendViewState extends ConsumerState<SendView> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
isPaynymSend ? "Send to PayNym address" : "Send to", isPaynymSend
? "Send to PayNym address"
: "Send to",
style: STextStyles.smallMed12(context), style: STextStyles.smallMed12(context),
textAlign: TextAlign.left, textAlign: TextAlign.left,
), ),
if (coin == Coin.monero) // if (coin == Coin.monero)
CustomTextButton( // CustomTextButton(
text: "Use OpenAlias", // text: "Use OpenAlias",
onTap: () async { // onTap: () async {
await showModalBottomSheet(context: context, builder: (context) => OpenAliasBottomSheet( // await showModalBottomSheet(
onSelected: (address) { // context: context,
sendToController.text = address; // builder: (context) =>
}, // OpenAliasBottomSheet(
)); // onSelected: (address) {
}, // sendToController.text = address;
) // },
// ),
// );
// },
// ),
], ],
), ),
const SizedBox( const SizedBox(

View file

@ -1,148 +1,151 @@
/* // /*
* This file is part of Stack Wallet. // * This file is part of Stack Wallet.
* // *
* Copyright (c) 2023 Cypher Stack // * Copyright (c) 2023 Cypher Stack
* All Rights Reserved. // * All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details. // * The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26 // * Generated by Cypher Stack on 2023-05-26
* // *
*/ // */
//
import 'package:flutter/cupertino.dart'; // import 'package:basic_utils/basic_utils.dart';
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; // import 'package:flutter_riverpod/flutter_riverpod.dart';
// import 'package:stackwallet/themes/stack_colors.dart';
import '../../../themes/stack_colors.dart'; // import 'package:stackwallet/utilities/constants.dart';
import '../../../utilities/constants.dart'; // import 'package:stackwallet/utilities/text_styles.dart';
import '../../../utilities/text_styles.dart'; //
// class OpenAliasBottomSheet extends ConsumerStatefulWidget {
import 'package:basic_utils/basic_utils.dart'; // const OpenAliasBottomSheet({
// Key? key,
class OpenAliasBottomSheet extends ConsumerStatefulWidget { // required this.onSelected,
const OpenAliasBottomSheet({ // }) : super(key: key);
Key? key, //
required this.onSelected, // final Null Function(String) onSelected;
}) : super(key: key); //
// @override
final Null Function(String) onSelected; // ConsumerState<OpenAliasBottomSheet> createState() =>
// _OpenAliasBottomSheetState();
@override // }
ConsumerState<OpenAliasBottomSheet> createState() => //
_OpenAliasBottomSheetState(); // class _OpenAliasBottomSheetState extends ConsumerState<OpenAliasBottomSheet> {
} // late TextEditingController textEditingController;
//
class _OpenAliasBottomSheetState extends ConsumerState<OpenAliasBottomSheet> { // @override
late TextEditingController textEditingController; // void initState() {
// super.initState();
@override // textEditingController = TextEditingController();
void initState() { // }
super.initState(); //
textEditingController = TextEditingController(); // @override
} // Widget build(BuildContext context) {
// return SingleChildScrollView(
@override // child: Padding(
Widget build(BuildContext context) { // padding:
return SingleChildScrollView( // EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Padding( // child: Container(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), // decoration: BoxDecoration(
child: Container( // color: Theme.of(context).extension<StackColors>()!.popupBG,
decoration: BoxDecoration( // borderRadius: const BorderRadius.vertical(
color: Theme.of(context).extension<StackColors>()!.popupBG, // top: Radius.circular(20),
borderRadius: const BorderRadius.vertical( // ),
top: Radius.circular(20), // ),
), // child: Padding(
), // padding: const EdgeInsets.only(
child: Padding( // top: 20,
padding: const EdgeInsets.only( // left: 20,
top: 20, // right: 20,
left: 20, // bottom: 20,
right: 20, // ),
bottom: 20, // child: Column(
), // mainAxisSize: MainAxisSize.min,
child: Column( // crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, // children: [
crossAxisAlignment: CrossAxisAlignment.start, // Center(
children: [ // child: Container(
Center( // decoration: BoxDecoration(
child: Container( // color: Theme.of(context)
decoration: BoxDecoration( // .extension<StackColors>()!
color: Theme.of(context) // .textFieldDefaultBG,
.extension<StackColors>()! // borderRadius: BorderRadius.circular(
.textFieldDefaultBG, // Constants.size.circularBorderRadius,
borderRadius: BorderRadius.circular( // ),
Constants.size.circularBorderRadius, // ),
), // width: 60,
), // height: 4,
width: 60, // ),
height: 4, // ),
), // const SizedBox(
), // height: 36,
const SizedBox( // ),
height: 36, // Text(
), // 'OpenAlias Address',
Text( // style: STextStyles.smallMed12(context),
'OpenAlias Address', // textAlign: TextAlign.left,
style: STextStyles.smallMed12(context), // ),
textAlign: TextAlign.left, // const SizedBox(
), // height: 8,
const SizedBox( // ),
height: 8, // TextField(
), // controller: textEditingController,
TextField( // decoration: const InputDecoration(
controller: textEditingController, // border: OutlineInputBorder(),
decoration: const InputDecoration( // ),
border: OutlineInputBorder(), // ),
), // const SizedBox(
), // height: 16,
const SizedBox( // ),
height: 16, // Align(
), // alignment: Alignment.bottomCenter,
Align( // child: ConstrainedBox(
alignment: Alignment.bottomCenter, // constraints: const BoxConstraints(
child: ConstrainedBox( // minWidth: 480,
constraints: const BoxConstraints( // minHeight: 70,
minWidth: 480, // ),
minHeight: 70, // child: TextButton(
), // style: Theme.of(context)
child: TextButton( // .extension<StackColors>()!
style: Theme.of(context) // .getPrimaryEnabledButtonStyle(context),
.extension<StackColors>()! // onPressed: () async {
.getPrimaryEnabledButtonStyle(context), // String text = textEditingController.text
onPressed: () async { // .trim()
String text = textEditingController.text.trim().replaceAll("@", "."); // .replaceAll("@", ".");
List<RRecord>? result = await DnsUtils.lookupRecord(text, RRecordType.TXT); // List<RRecord>? result =
String address = ""; // await DnsUtils.lookupRecord(text, RRecordType.TXT);
if (result != null && result.isNotEmpty) { // String address = "";
for (RRecord record in result) { // if (result != null && result.isNotEmpty) {
if (record.data.startsWith("oa1:xmr")) { // for (RRecord record in result) {
List<String> datas = record.data.split(" "); // if (record.data.startsWith("oa1:xmr")) {
for (String data in datas) { // List<String> datas = record.data.split(" ");
if (data.startsWith("recipient_address=")) { // for (String data in datas) {
address = data.substring("recipient_address=".length).replaceAll(";", ""); // if (data.startsWith("recipient_address=")) {
break; // address = data
} // .substring("recipient_address=".length)
} // .replaceAll(";", "");
break; // break;
} // }
} // }
} // break;
widget.onSelected(address!); // }
Navigator.of(context).pop(); // }
}, // }
child: Text( // widget.onSelected(address);
"Enter", // if (mounted) {
style: STextStyles.button(context), // Navigator.of(context).pop();
), // }
), // },
), // child: Text(
) // "Enter",
], // style: STextStyles.button(context),
), // ),
), // ),
), // ),
), // )
); // ],
} // ),
} // ),
// ),
// ),
// );
// }
// }