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
29 changed files with 103 additions and 18 deletions
@@ -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!;
+29
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,