diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart index 09ed16610..c349eeb9d 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart @@ -578,6 +578,11 @@ class _DesktopSendState extends ConsumerState { content = content.substring(0, content.indexOf("\n")); } + if (coin == Coin.epicCash) { + // strip http:// and https:// if content contains @ + content = httpXOREpicBox(content); + } + sendToController.text = content; _address = content; @@ -742,6 +747,22 @@ class _DesktopSendState extends ConsumerState { final String locale = ref.watch( localeServiceChangeNotifierProvider.select((value) => value.locale)); + // add listener for epic cash to strip http:// and https:// prefixes if the address also ocntains an @ symbol (indicating an epicbox address) + if (coin == Coin.epicCash) { + sendToController.addListener(() { + _address = sendToController.text; + + if (_address != null && _address!.isNotEmpty) { + _address = _address!.trim(); + if (_address!.contains("\n")) { + _address = _address!.substring(0, _address!.indexOf("\n")); + } + + sendToController.text = httpXOREpicBox(_address!); + } + }); + } + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1323,3 +1344,14 @@ class _DesktopSendState extends ConsumerState { ); } } + +// strip http:// and https:// if epicAddress contains @ +String httpXOREpicBox(String epicAddress) { + if ((epicAddress.startsWith("http://") || + epicAddress.startsWith("https://")) && + epicAddress.contains("@")) { + epicAddress = epicAddress.replaceAll("http://", ""); + epicAddress = epicAddress.replaceAll("https://", ""); + } + return epicAddress; +}