Cw 588 show popup for adding to address book (#1326)

* popup for adding to address book

* update localization files
This commit is contained in:
Serhii 2024-03-20 00:44:00 +02:00 committed by GitHub
parent 58b2dfb26c
commit a0c0ede099
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 103 additions and 18 deletions

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/entities/contact_record.dart';
import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cake_wallet/entities/template.dart';
import 'package:cake_wallet/reactions/wallet_connect.dart';
@ -48,6 +49,7 @@ class SendPage extends BasePage {
final PaymentRequest? initialPaymentRequest;
bool _effectsInstalled = false;
ContactRecord? newContactAddress;
@override
String get title => S.current.send;
@ -443,22 +445,50 @@ class SendPage extends BasePage {
}
if (state is TransactionCommitted) {
String alertContent;
if (sendViewModel.walletType == WalletType.solana) {
alertContent =
'${S.of(_dialogContext).send_success(sendViewModel.selectedCryptoCurrency.toString())}. ${S.of(_dialogContext).waitFewSecondForTxUpdate}';
newContactAddress =
newContactAddress ?? sendViewModel.newContactAddress();
final successMessage = S.of(_dialogContext).send_success(
sendViewModel.selectedCryptoCurrency.toString());
final waitMessage = sendViewModel.walletType == WalletType.solana
? '. ${S.of(_dialogContext).waitFewSecondForTxUpdate}' : '';
final newContactMessage = newContactAddress != null
? '\n${S.of(context).add_contact_to_address_book}' : '';
final alertContent =
"$successMessage$waitMessage$newContactMessage";
if (newContactAddress != null) {
return AlertWithTwoActions(
alertTitle: '',
alertContent: alertContent,
rightButtonText: S.of(_dialogContext).add_contact,
leftButtonText: S.of(_dialogContext).ignor,
actionRightButton: () {
Navigator.of(_dialogContext).pop();
RequestReviewHandler.requestReview();
Navigator.of(context).pushNamed(
Routes.addressBookAddContact,
arguments: newContactAddress);
newContactAddress = null;
},
actionLeftButton: () {
Navigator.of(_dialogContext).pop();
RequestReviewHandler.requestReview();
newContactAddress = null;
});
} else {
alertContent = S.of(_dialogContext).send_success(
sendViewModel.selectedCryptoCurrency.toString());
return AlertWithOneAction(
alertTitle: '',
alertContent: alertContent,
buttonText: S.of(_dialogContext).ok,
buttonAction: () {
Navigator.of(_dialogContext).pop();
RequestReviewHandler.requestReview();
});
}
return AlertWithOneAction(
alertTitle: '',
alertContent: alertContent,
buttonText: S.of(_dialogContext).ok,
buttonAction: () {
Navigator.of(_dialogContext).pop();
RequestReviewHandler.requestReview();
});
}
return Offstage();

View file

@ -48,11 +48,11 @@ abstract class ContactViewModelBase with Store {
currency = null;
}
Future save() async {
Future<void> save() async {
try {
state = IsExecutingState();
if (_contact != null) {
if (_contact != null && _contact!.original.isInBox) {
_contact?.name = name;
_contact?.address = address;
_contact?.type = currency!;

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/entities/contact.dart';
import 'package:cake_wallet/entities/priority_for_wallet_type.dart';
import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/ethereum/ethereum.dart';
@ -420,6 +421,34 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
}
}
ContactRecord? newContactAddress () {
final Set<String> contactAddresses =
Set.from(contactListViewModel.contacts.map((contact) => contact.address))
..addAll(contactListViewModel.walletContacts.map((contact) => contact.address));
for (var output in outputs) {
String address;
if (output.isParsedAddress) {
address = output.parsedAddress.addresses.first;
} else {
address = output.address;
}
if (address.isNotEmpty && !contactAddresses.contains(address)) {
return ContactRecord(
contactListViewModel.contactSource,
Contact(
name: '',
address: address,
type: selectedCryptoCurrency,
));
}
}
return null;
}
String translateErrorMessage(
String error,
WalletType walletType,

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "ﺎﻨﻫ ﺔﻄﺸﻨﻟﺍ ﺕﻻﺎﺼﺗﻻﺍ ﺮﻬﻈﺘﺳ",
"add": "إضافة",
"add_contact": "ﻝﺎﺼﺗﺍ ﺔﻬﺟ ﺔﻓﺎﺿﺇ",
"add_contact_to_address_book": "هل ترغب في إضافة جهة الاتصال هذه إلى دفتر العناوين الخاص بك؟",
"add_custom_node": "إضافة عقدة مخصصة جديدة",
"add_custom_redemption": "إضافة استرداد مخصص",
"add_fund_to_card": "أضف أموالاً مدفوعة مسبقًا إلى البطاقات (حتى ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Тук ще се появят активни връзки",
"add": "Добави",
"add_contact": "Добави контакт",
"add_contact_to_address_book": "Искате ли да добавите този контакт към вашата адресна книга?",
"add_custom_node": "Добавяне на нов персонализиран Node",
"add_custom_redemption": "Добавете персонализиран Redemption",
"add_fund_to_card": "Добавете предплатени средства в картите (до ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Zde se zobrazí aktivní připojení",
"add": "Přidat",
"add_contact": "Přidat kontakt",
"add_contact_to_address_book": "Chcete přidat tento kontakt do svého adresáře?",
"add_custom_node": "Přidat vlastní uzel",
"add_custom_redemption": "Přidat vlastní uplatnění",
"add_fund_to_card": "Všechny předplacené prostředky na kartě (až ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Hier werden aktive Verbindungen angezeigt",
"add": "Hinzufügen",
"add_contact": "Kontakt hinzufügen",
"add_contact_to_address_book": "Möchten Sie diesen Kontakt zu Ihrem Adressbuch hinzufügen?",
"add_custom_node": "Neuen benutzerdefinierten Knoten hinzufügen",
"add_custom_redemption": "Benutzerdefinierte Einlösung hinzufügen",
"add_fund_to_card": "Prepaid-Guthaben zu den Karten hinzufügen (bis zu ${value})",
@ -410,8 +411,8 @@
"placeholder_transactions": "Ihre Transaktionen werden hier angezeigt",
"please_fill_totp": "Bitte geben Sie den 8-stelligen Code ein, der auf Ihrem anderen Gerät vorhanden ist",
"please_make_selection": "Bitte treffen Sie unten eine Auswahl zum Erstellen oder Wiederherstellen Ihrer Wallet.",
"please_reference_document": "Bitte verweisen Sie auf die folgenden Dokumente, um weitere Informationen zu erhalten.",
"Please_reference_document": "Weitere Informationen finden Sie in den Dokumenten unten.",
"please_reference_document": "Bitte verweisen Sie auf die folgenden Dokumente, um weitere Informationen zu erhalten.",
"please_select": "Bitte auswählen:",
"please_select_backup_file": "Bitte wählen Sie die Sicherungsdatei und geben Sie das Sicherungskennwort ein.",
"please_try_to_connect_to_another_node": "Bitte versuchen Sie, sich mit einem anderen Knoten zu verbinden",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Active connections will appear here",
"add": "Add",
"add_contact": "Add contact",
"add_contact_to_address_book": "Would you like to add this contact to your address book?",
"add_custom_node": "Add New Custom Node",
"add_custom_redemption": "Add Custom Redemption",
"add_fund_to_card": "Add prepaid funds to the cards (up to ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Las conexiones activas aparecerán aquí",
"add": "Añadir",
"add_contact": "Agregar contacto",
"add_contact_to_address_book": "¿Le gustaría agregar este contacto a su libreta de direcciones?",
"add_custom_node": "Agregar nuevo nodo personalizado",
"add_custom_redemption": "Agregar redención personalizada",
"add_fund_to_card": "Agregar fondos prepagos a las tarjetas (hasta ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Les connexions actives apparaîtront ici",
"add": "Ajouter",
"add_contact": "Ajouter le contact",
"add_contact_to_address_book": "Souhaitez-vous ajouter ce contact à votre carnet d'adresses?",
"add_custom_node": "Ajouter un nouveau nœud personnalisé",
"add_custom_redemption": "Ajouter un remboursement personnalisé",
"add_fund_to_card": "Ajouter des fonds prépayés aux cartes (jusqu'à ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Haɗin kai mai aiki zai bayyana a nan",
"add": "Ƙara",
"add_contact": "Ƙara lamba",
"add_contact_to_address_book": "Kuna so ku ƙara wannan lamba zuwa littafin adireshinku?",
"add_custom_node": "Ƙara Sabon Kulli na Custom",
"add_custom_redemption": "Ƙara Ceto na Musamman",
"add_fund_to_card": "Ƙara kuɗin da aka riga aka biya a katunan (har zuwa ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "सक्रिय कनेक्शन यहां दिखाई देंगे",
"add": "जोड़ना",
"add_contact": "संपर्क जोड़ें",
"add_contact_to_address_book": "क्या आप इस संपर्क को अपनी एड्रेस बुक में जोड़ना चाहेंगे?",
"add_custom_node": "नया कस्टम नोड जोड़ें",
"add_custom_redemption": "कस्टम रिडेम्पशन जोड़ें",
"add_fund_to_card": "कार्ड में प्रीपेड धनराशि जोड़ें (${value} तक)",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Ovdje će se pojaviti aktivne veze",
"add": "Dodaj",
"add_contact": "Dodaj kontakt",
"add_contact_to_address_book": "Želite li dodati ovaj kontakt u svoj adresar?",
"add_custom_node": "Dodaj novi prilagođeni čvor",
"add_custom_redemption": "Dodaj prilagođeni otkup",
"add_fund_to_card": "Dodajte unaprijed uplaćena sredstva na kartice (do ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Koneksi aktif akan muncul di sini",
"add": "Menambahkan",
"add_contact": "Tambah kontak",
"add_contact_to_address_book": "Apakah Anda ingin menambahkan kontak ini ke buku alamat Anda?",
"add_custom_node": "Tambahkan Node Kustom Baru",
"add_custom_redemption": "Tambahkan Tukar Kustom",
"add_fund_to_card": "Tambahkan dana pra-bayar ke kartu (hingga ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Le connessioni attive verranno visualizzate qui",
"add": "Aggiungi",
"add_contact": "Aggiungi contatto",
"add_contact_to_address_book": "Vorresti aggiungere questo contatto alla tua rubrica?",
"add_custom_node": "Aggiungi nuovo nodo personalizzato",
"add_custom_redemption": "Aggiungi riscatto personalizzato",
"add_fund_to_card": "Aggiungi fondi prepagati alle carte (fino a ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "アクティブな接続がここに表示されます",
"add": "加える",
"add_contact": "連絡先を追加",
"add_contact_to_address_book": "この連絡先をアドレス帳に追加しますか?",
"add_custom_node": "新しいカスタム ノードを追加",
"add_custom_redemption": "カスタム引き換えを追加",
"add_fund_to_card": "プリペイド資金をカードに追加します(最大 ${value}",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "활성 연결이 여기에 표시됩니다",
"add": "더하다",
"add_contact": "주소록에 추가",
"add_contact_to_address_book": "이 연락처를 주소록에 추가 하시겠습니까?",
"add_custom_node": "새 사용자 정의 노드 추가",
"add_custom_redemption": "사용자 지정 상환 추가",
"add_fund_to_card": "카드에 선불 금액 추가(최대 ${value})",
@ -410,8 +411,8 @@
"placeholder_transactions": "거래가 여기에 표시됩니다",
"please_fill_totp": "다른 기기에 있는 8자리 코드를 입력하세요.",
"please_make_selection": "아래에서 선택하십시오 지갑 만들기 또는 복구.",
"please_reference_document": "자세한 내용은 아래 문서를 참조하십시오.",
"Please_reference_document": "자세한 내용은 아래 문서를 참조하십시오.",
"please_reference_document": "자세한 내용은 아래 문서를 참조하십시오.",
"please_select": "선택 해주세요:",
"please_select_backup_file": "백업 파일을 선택하고 백업 암호를 입력하십시오.",
"please_try_to_connect_to_another_node": "다른 노드에 연결을 시도하십시오",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "လက်ရှိချိတ်ဆက်မှုများ ဤနေရာတွင် ပေါ်လာပါမည်။",
"add": "ထည့်ပါ။",
"add_contact": "အဆက်အသွယ်ထည့်ပါ။",
"add_contact_to_address_book": "ဒီအဆက်အသွယ်ကိုမင်းရဲ့လိပ်စာစာအုပ်နဲ့ထပ်ထည့်ချင်ပါသလား။",
"add_custom_node": "စိတ်ကြိုက် Node အသစ်ကို ထည့်ပါ။",
"add_custom_redemption": "စိတ်ကြိုက်ရွေးယူမှုကို ထည့်ပါ။",
"add_fund_to_card": "ကတ်များသို့ ကြိုတင်ငွေပေးငွေများ ထည့်ပါ (${value} အထိ)",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Actieve verbindingen worden hier weergegeven",
"add": "Toevoegen",
"add_contact": "Contactpersoon toevoegen",
"add_contact_to_address_book": "Wilt u dit contact toevoegen aan uw adresboek?",
"add_custom_node": "Voeg een nieuw aangepast knooppunt toe",
"add_custom_redemption": "Voeg aangepaste inwisseling toe",
"add_fund_to_card": "Voeg prepaid tegoed toe aan de kaarten (tot ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Tutaj pojawią się aktywne połączenia",
"add": "Dodaj",
"add_contact": "Dodaj kontakt",
"add_contact_to_address_book": "Czy chciałbyś dodać ten kontakt do swojej książki adresowej?",
"add_custom_node": "Dodaj nowy węzeł niestandardowy",
"add_custom_redemption": "Dodaj niestandardowe wykorzystanie",
"add_fund_to_card": "Dodaj przedpłacone środki do kart (do ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Conexões ativas aparecerão aqui",
"add": "Adicionar",
"add_contact": "Adicionar contato",
"add_contact_to_address_book": "Você gostaria de adicionar esse contato ao seu catálogo de endereços?",
"add_custom_node": "Adicionar novo nó personalizado",
"add_custom_redemption": "Adicionar resgate personalizado",
"add_fund_to_card": "Adicionar fundos pré-pagos aos cartões (até ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Здесь появятся активные подключения",
"add": "Добавить",
"add_contact": "Добавить контакт",
"add_contact_to_address_book": "Хотели бы вы добавить этот контакт в свою адресную книгу?",
"add_custom_node": "Добавить новый пользовательский узел",
"add_custom_redemption": "Добавить пользовательское погашение",
"add_fund_to_card": "Добавить предоплаченные средства на карты (до ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "การเชื่อมต่อที่ใช้งานอยู่จะปรากฏที่นี่",
"add": "เพิ่ม",
"add_contact": "เพิ่มผู้ติดต่อ",
"add_contact_to_address_book": "คุณต้องการเพิ่มผู้ติดต่อนี้ในสมุดที่อยู่ของคุณหรือไม่?",
"add_custom_node": "เพิ่มจุดโหนดแบบกำหนดเอง",
"add_custom_redemption": "เพิ่มการรับคืนที่กำหนดเอง",
"add_fund_to_card": "เพิ่มเงินสำรองไว้บนบัตร (ถึง ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Lalabas dito ang mga aktibong koneksyon",
"add": "Idagdag",
"add_contact": "Magdagdag ng contact",
"add_contact_to_address_book": "Nais mo bang idagdag ang contact na ito sa iyong address book?",
"add_custom_node": "Magdagdag ng bagong pasadyang node",
"add_custom_redemption": "Magdagdag ng pasadyang pagtubos",
"add_fund_to_card": "Magdagdag ng prepaid na pondo sa mga kard (hanggang sa ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Aktif bağlantılar burada görünecek",
"add": "Ekle",
"add_contact": "Kişi ekle",
"add_contact_to_address_book": "Bu kişiyi adres defterinize eklemek ister misiniz?",
"add_custom_node": "Yeni Özel Düğüm Ekleme",
"add_custom_redemption": "Özel Bozdurma Ekle",
"add_fund_to_card": "Ön ödemeli kartlara para ekle (En fazla yüklenebilir tutar: ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Тут з’являться активні підключення",
"add": "Добавити",
"add_contact": "Додати контакт",
"add_contact_to_address_book": "Хотіли б ви додати цей контакт до своєї адресної книги?",
"add_custom_node": "Додати новий спеціальний вузол",
"add_custom_redemption": "Додати спеціальне погашення",
"add_fund_to_card": "Додайте передплачені кошти на картки (до ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "۔ﮯﮔ ﮞﻮﮨ ﺮﮨﺎﻇ ﮞﺎﮩﯾ ﺰﻨﺸﮑﻨﮐ ﻝﺎﻌﻓ",
"add": "شامل کریں۔",
"add_contact": "۔ﮟﯾﺮﮐ ﻞﻣﺎﺷ ﮧﻄﺑﺍﺭ",
"add_contact_to_address_book": "کیا آپ اس رابطہ کو اپنی ایڈریس بک میں شامل کرنا چاہیں گے؟",
"add_custom_node": "نیا کسٹم نوڈ شامل کریں۔",
"add_custom_redemption": "حسب ضرورت چھٹکارا شامل کریں۔",
"add_fund_to_card": "کارڈز میں پری پیڈ فنڈز شامل کریں (${value} تک)",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "Awọn asopọ ti nṣiṣe lọwọ yoo han nibi",
"add": "Fikún",
"add_contact": "Fi olubasọrọ kun",
"add_contact_to_address_book": "Ṣe o fẹ lati ṣafikun olubasọrọ yii si iwe adirẹsi rẹ?",
"add_custom_node": "Fikún apẹka títun t'ẹ́ pààrọ̀",
"add_custom_redemption": "Tẹ̀ iye owó t'ẹ́ fẹ́ ná",
"add_fund_to_card": "Ẹ fikún owó sí àwọn káàdì (kò tóbi ju ${value})",

View file

@ -9,6 +9,7 @@
"activeConnectionsPrompt": "活动连接将出现在这里",
"add": "添加",
"add_contact": "增加联系人",
"add_contact_to_address_book": "您想将此联系人添加到您的通讯录中吗?",
"add_custom_node": "添加新的自定义节点",
"add_custom_redemption": "添加自定义兑换",
"add_fund_to_card": "向卡中添加预付资金(最多 ${value}",