File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,13 +39,11 @@ class _ContactsScreenState extends State<ContactsScreen> {
3939
4040 _loadFavouriteContacts () async {
4141 myPkidContacts = await getPkidContacts ();
42- myPkidContacts =
43- myPkidContacts.where ((c) => c.type == widget.chainType).toList ();
4442 setState (() {});
4543 }
4644
4745 _onAddContact (PkidContact contact) async {
48- final exists = myPkidContacts.any ((c) => c.name == contact.name && c. address == contact.address);
46+ final exists = myPkidContacts.any ((c) => c.address == contact.address);
4947 if (! exists) {
5048 myPkidContacts.add (contact);
5149 setState (() {});
@@ -150,7 +148,9 @@ class _ContactsScreenState extends State<ContactsScreen> {
150148 .toList (),
151149 onSelectToAddress: widget.onSelectToAddress),
152150 ContactsWidget (
153- contacts: myPkidContacts,
151+ contacts: myPkidContacts
152+ .where ((c) => c.type == widget.chainType)
153+ .toList (),
154154 onSelectToAddress: widget.onSelectToAddress,
155155 onDeleteContact: _onDeleteContact,
156156 onEditContact: _openEditContactOverlay,
Original file line number Diff line number Diff line change @@ -86,15 +86,11 @@ class _AddEditContactState extends State<AddEditContact> {
8686 addressError = "Address can't be empty" ;
8787 return false ;
8888 }
89+ // Check for duplicates across all chain types
8990 final contacts = widget.contacts.where ((c) => c.address == contactAddress);
90- if (edit && contactAddress != widget.address && contacts.isNotEmpty) {
91+ if (contacts.isNotEmpty) {
9192 addressError = 'Address is used in another contact' ;
9293 return false ;
93- } else if (! edit && contacts.isNotEmpty) {
94- addressError =
95- 'Address exists in another ${contacts .first .type .name } contact' ;
96-
97- return false ;
9894 }
9995 if (_selectedChainType == ChainType .TFChain &&
10096 contactAddress.length != 48 ) {
You can’t perform that action at this time.
0 commit comments