Skip to content

Handle duplicated contacts in favorite List#983

Merged
AlaaElattar merged 5 commits intodevelopmentfrom
development_duplicated_fav
Apr 24, 2025
Merged

Handle duplicated contacts in favorite List#983
AlaaElattar merged 5 commits intodevelopmentfrom
development_duplicated_fav

Conversation

@AlaaElattar
Copy link
Contributor

@AlaaElattar AlaaElattar commented Apr 2, 2025

Changes

  • Added check that the added contacts in ui won't be duplicated in case of any lag.
  • Also made sure the retrieved PKidWallets won't be duplicated.

Related Issues

Tested Scenarios

  • Tested adding existing wallet.
  • Tested with already duplicated wallets and one only appeared.

Comment on lines 40 to 57
_loadFavouriteContacts() async {
myPkidContacts = await getPkidContacts();
myPkidContacts =
myPkidContacts.where((c) => c.type == widget.chainType).toList();
final allContacts = await getPkidContacts();

final seen = <String>{};
final filtered = <PkidContact>[];

for (final c in allContacts) {
if (c.type != widget.chainType) continue;

final key = '${c.address}_${c.type}';
if (seen.add(key)) {
filtered.add(c);
}
}

myPkidContacts = filtered;
setState(() {});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary. Should be filtered once this is merged.

Copy link
Contributor

@AhmedHanafy725 AhmedHanafy725 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current solution doesn't fix the issue

@AlaaElattar AlaaElattar marked this pull request as draft April 15, 2025 07:15
@AlaaElattar AlaaElattar marked this pull request as ready for review April 15, 2025 13:12
@AlaaElattar
Copy link
Contributor Author

The current solution doesn't fix the issue

  • Fixed the issue.

Copy link
Contributor

@AhmedHanafy725 AhmedHanafy725 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still not working, I can add the same address twice

@AlaaElattar AlaaElattar marked this pull request as draft April 16, 2025 14:30
@AlaaElattar
Copy link
Contributor Author

still not working, I can add the same address twice

2025-04-16.21.15.29.mp4

@AlaaElattar AlaaElattar marked this pull request as ready for review April 16, 2025 19:16

final isDuplicate = allContacts.any((c) => c.address == contactAddress);

if (isDuplicate) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we are in the edit flow, and the address is not changed? it will be misleading

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fixed.

@AlaaElattar AlaaElattar merged commit a7fe9fb into development Apr 24, 2025
2 checks passed
@AlaaElattar AlaaElattar deleted the development_duplicated_fav branch April 24, 2025 07:47
AlaaElattar added a commit that referenced this pull request Apr 28, 2025
* handle duplicated contacts

* undo latest solution

* fix adding duplicated wallet in fav list

* Fixed the duplicated contacts issue

* update condition when editing address
AlaaElattar added a commit that referenced this pull request Apr 30, 2025
* WIP: adding notifications pgk

* fix ios issue and show notification with offline nodes

* remove unused import && undo changes in podfile.lock

* WIP: adding permissions for android

* WIP: downgrade background_fetch

* WIP: downgrade background_fetch

* clear cached background_fetch

* specify ndk version

* undo nkd version setup

* WIP: add debug logs

* WIP: debug background_fetch version

* update pubspec.lock

* update build.gradle

* WIP: remove gradle cache

* fix command

* WIP: Update build.gradle

* WIP: fix space

* undo latest commit

* add maven url in build.gradle

* Add close button for confirmation dialog (#976)

* add close button for confirmation dialog

* add cancel btn in bridge also

* Handle non-loading for delete wallet (#973)

* add timeout 1 min for deleting wallet

* update error messages

* Prevent PIN Entry Attempts During 30 Second Lockout Period  (#989)

* keep user locked after the many attempts

* update pin screen to include live counter

* Fix transactions paginations (#992)

* Fix transactions pagination, use pagingToken instead of offset

* Edit listTransactions to return stream instead of list

* Update stellar client ref

* handle duplicated daily (#986)

* Update the packages version for background_fetch & flutter_local_notifications

* Request to enable the notification service on android

* Revert the changes in the wrong manifest file

* Update the gradle repos

* Update build gradle dependencies

* Update the manifest permissions

* only show notifications for nodes down last 2 days && group notifications

* remove unused import

* update checking nodes for last 7 days

* Update app/lib/services/background_service.dart

Co-authored-by: AhmedHanafy725 <41957921+AhmedHanafy725@users.noreply.github.com>

* apply pr comments && apply the exponential notification

* handle notification grouping

* handled tapping on notification

* Hide show phrase (#995)

* Handle duplicated contacts in favorite List (#983)

* handle duplicated contacts

* undo latest solution

* fix adding duplicated wallet in fav list

* Fixed the duplicated contacts issue

* update condition when editing address

* Fix auth timeout routing (#1000)

* Creating app lifecycle observer and use it in main.dart w navigator key, Replace Navigator routes w  navigator key

* Remove unused code

* Revert navigator key changes from screens

* Revert main screen changes

* fix ios issue and show notification with offline nodes

* update pubspec.lock

* fix workflow

* fix equation && workflow

* undo the equation

* fixed time conversion

---------

Co-authored-by: Zainab Elgohary <40770501+zaelgohary@users.noreply.github.com>
Co-authored-by: AhmedHanafy725 <hanafya@incubaid.com>
Co-authored-by: AhmedHanafy725 <41957921+AhmedHanafy725@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants