mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Cw 588 show popup for adding to address book (#1326)
* popup for adding to address book * update localization files
This commit is contained in:
@@ -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!;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user