diff --git a/assets/translations/en.json b/assets/translations/en.json index 3bcaf34b57c18ea3bb454d5f661049e01e38bcd8..0680d9210152a57e7e21d71776f0f3f30d7989d9 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -191,5 +191,10 @@ "payment_waiting_internet_title": "No Internet", "payment_waiting_internet_desc": "We'll retry your payment when internet is back", "payment_waiting_internet_desc_beta": "Retry your payment when internet is back", - "your_name_here": "Name this card" + "your_name_here": "Name this card", + "copied_to_clipboard": "Copied to clipboard", + "share_export_title": "Share your wallet", + "share_export_desc": "Your wallet has been exported locally. Would you like to additionally share it with yourself via email/chat/etc. for safekeeping", + "share_export_subject": "My Äž1nkgo Wallet", + "share_export_button": "SHARE" } diff --git a/assets/translations/es.json b/assets/translations/es.json index 1b27cb327bdcfb0e2d4276f6ad6d1985acf26506..9b6fc210b2724e13dc13c38104fd273a9e200610 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -193,5 +193,10 @@ "payment_waiting_internet_title": "Sin Internet", "payment_waiting_internet_desc": "Reintentaremos el pago cuando vuelvas a tener conexión", "payment_waiting_internet_desc_beta": "Reintenta el pago cuando vuelvas a tener conexión", - "your_name_here": "Da un nombre a esta tarjeta" + "your_name_here": "Da un nombre a esta tarjeta", + "copied_to_clipboard": "Copiado al portapapeles", + "share_export_title": "Comporte tu monedero", + "share_export_desc": "Tu monedero ha sido exportado localmente. ¿Te gustarÃa compartirlo adicionalmente contigo mismo vÃa email/chat/etc. para su resguardo?", + "share_export_subject": "Mi monedero Äž1nkgo", + "share_export_button": "COMPARTIR" } diff --git a/lib/ui/widgets/fifth_screen/export_dialog.dart b/lib/ui/widgets/fifth_screen/export_dialog.dart index ecf83905531c173d1091f696f6aceb0bc42a137b..fd55b553c305b26cc96425a11926ab3094c7efa7 100644 --- a/lib/ui/widgets/fifth_screen/export_dialog.dart +++ b/lib/ui/widgets/fifth_screen/export_dialog.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; import 'package:path/path.dart'; import 'package:pattern_lock/pattern_lock.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; +import 'package:share_plus/share_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:universal_html/html.dart' as html; @@ -121,6 +122,41 @@ class _ExportDialogState extends State<ExportDialog> { style: const TextStyle(color: Colors.red), ), ); + confirmAndShare(context, fileJson); + } + + void confirmAndShare(BuildContext context, String fileJson) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text(tr('share_export_title')), + content: Text(tr('share_export_desc')), + actions: <Widget>[ + TextButton( + child: Text(tr('cancel')), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: Text(tr('share_export_button')), + onPressed: () { + if (kIsWeb) { + /* final String url = + 'mailto:?subject=${Uri.encodeComponent('My wallet')}&body=${Uri.encodeComponent(fileJson)}'; + html.window.open(url, '_blank'); */ + Share.share(fileJson, subject: tr('share_export_subject')); + } else { + Share.share(fileJson, subject: tr('share_export_subject')); + } + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); } void webDownload(List<int> bytes) {