Messaging: Don't show numbers of contacts multiple times

* Somehow there are multiple entries per some numbers, sometimes stored
  with, sometimes without spaces and/or invisible characters
* This leads to the same number being shown multiple times
* Don't add those entries by comparing number and type of all
  already added entries with the staging one

Change-Id: Ic815393d3d4f4ba56107f42c9d8940309564554c
This commit is contained in:
Michael W
2024-09-09 05:46:59 +03:00
committed by Michael Bestas
parent 1970f9ea99
commit c416c287eb
2 changed files with 31 additions and 6 deletions
@@ -96,7 +96,6 @@ public class ContactPickerData extends BindableData implements
if (isBound(cursorLoader.getBindingId())) {
switch (loader.getId()) {
case ALL_CONTACTS_LOADER:
mListener.onAllContactsCursorUpdated(data);
mFrequentContactsCursorBuilder.setAllContacts(data);
break;
case FREQUENT_CONTACTS_LOADER:
@@ -115,10 +114,14 @@ public class ContactPickerData extends BindableData implements
// all contacts and frequent contacts loader, and we don't know which will finish
// first. Therefore, try to build the cursor and notify the listener if it's
// successfully built.
final Cursor frequentContactsCursor = mFrequentContactsCursorBuilder.build();
final Cursor frequentContactsCursor = mFrequentContactsCursorBuilder.build(false);
if (frequentContactsCursor != null) {
mListener.onFrequentContactsCursorUpdated(frequentContactsCursor);
final Cursor allContactsCursor = mFrequentContactsCursorBuilder.build(true);
mListener.onAllContactsCursorUpdated(allContactsCursor);
}
}
} else {
LogUtil.w(LogUtil.BUGLE_TAG, "Loader finished after unbinding the contacts list");