mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 00:03:54 +00:00
Only lookup contact address by number if address is a phone number
// FREEBIE
This commit is contained in:
parent
4229c21bdc
commit
5f9a3b7930
@ -133,9 +133,10 @@ class RecipientProvider {
|
||||
private @NonNull RecipientDetails getIndividualRecipientDetails(Context context, @NonNull Address address) {
|
||||
Optional<RecipientsPreferences> preferences = DatabaseFactory.getRecipientPreferenceDatabase(context).getRecipientsPreferences(new Address[]{address});
|
||||
MaterialColor color = preferences.isPresent() ? preferences.get().getColor() : null;
|
||||
|
||||
if (address.isPhone()) {
|
||||
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(address.toPhoneString()));
|
||||
Cursor cursor = context.getContentResolver().query(uri, CALLER_ID_PROJECTION,
|
||||
null, null, null);
|
||||
Cursor cursor = context.getContentResolver().query(uri, CALLER_ID_PROJECTION, null, null, null);
|
||||
|
||||
try {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
@ -156,8 +157,9 @@ class RecipientProvider {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (STATIC_DETAILS.containsKey(address.toPhoneString())) return STATIC_DETAILS.get(address.toPhoneString());
|
||||
if (STATIC_DETAILS.containsKey(address.serialize())) return STATIC_DETAILS.get(address.serialize());
|
||||
else return new RecipientDetails(null, null, null, ContactPhotoFactory.getDefaultContactPhoto(null), color);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user