mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-02 01:50:52 +00:00
Fully differentiate Signal vs non-Signal contacts
// FREEBIE
This commit is contained in:
parent
493bd9be6b
commit
ff123943cb
@ -157,11 +157,20 @@ public class ContactsDatabase {
|
|||||||
put(LABEL_COLUMN, ContactsContract.CommonDataKinds.Phone.LABEL);
|
put(LABEL_COLUMN, ContactsContract.CommonDataKinds.Phone.LABEL);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
Cursor cursor = context.getContentResolver().query(uri, projection,
|
String excludeSelection = ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " NOT IN (" +
|
||||||
ContactsContract.Data.SYNC2 + " IS NULL OR " +
|
"SELECT data.contact_id FROM raw_contacts, view_data data WHERE raw_contacts._id = data.raw_contact_id AND " +
|
||||||
ContactsContract.Data.SYNC2 + " != ?",
|
"data.mimetype = '" + CONTACT_MIMETYPE + "')";
|
||||||
new String[] {SYNC},
|
|
||||||
sort);
|
String fallbackSelection = ContactsContract.Data.SYNC2 + " IS NULL OR " + ContactsContract.Data.SYNC2 + " != '" + SYNC + "'";
|
||||||
|
|
||||||
|
Cursor cursor;
|
||||||
|
|
||||||
|
try {
|
||||||
|
cursor = context.getContentResolver().query(uri, projection, excludeSelection, null, sort);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, e);
|
||||||
|
cursor = context.getContentResolver().query(uri, projection, fallbackSelection, null, sort);
|
||||||
|
}
|
||||||
|
|
||||||
return new ProjectionMappingCursor(cursor, projectionMap,
|
return new ProjectionMappingCursor(cursor, projectionMap,
|
||||||
new Pair<String, Object>(CONTACT_TYPE_COLUMN, NORMAL_TYPE));
|
new Pair<String, Object>(CONTACT_TYPE_COLUMN, NORMAL_TYPE));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user