mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Use names also for main contact
This commit is contained in:
parent
cd7f631221
commit
12734127a7
@ -29,7 +29,7 @@ public final class Constants {
|
||||
|
||||
public static final boolean DEBUG = BuildConfig.DEBUG;
|
||||
public static final boolean DEBUG_LOG_DB_QUERIES = false;
|
||||
public static final boolean DEBUG_SYNC_REMOVE_CONTACTS = false;
|
||||
public static final boolean DEBUG_SYNC_REMOVE_CONTACTS = true;
|
||||
|
||||
public static final String TAG = "Keychain";
|
||||
|
||||
|
@ -519,20 +519,20 @@ public class ContactHelper {
|
||||
long masterKeyId = cursor.getLong(INDEX_MASTER_KEY_ID);
|
||||
boolean isExpired = cursor.getInt(INDEX_IS_EXPIRED) != 0;
|
||||
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
|
||||
String[] userIdSplit = KeyRing.splitUserId(cursor.getString(INDEX_USER_ID));
|
||||
|
||||
if (!isExpired && !isRevoked) {
|
||||
if (!isExpired && !isRevoked && userIdSplit[0] != null) {
|
||||
// if expired or revoked will not be removed from keysToDelete or inserted
|
||||
// into main profile ("me" contact)
|
||||
boolean existsInMainProfile = keysToDelete.remove(masterKeyId);
|
||||
if (!existsInMainProfile) {
|
||||
long rawContactId = -1;//new raw contact
|
||||
|
||||
String keyIdShort = KeyFormattingUtils.convertKeyIdToHexShort(masterKeyId);
|
||||
Log.d(Constants.TAG, "masterKeyId with secret " + masterKeyId);
|
||||
|
||||
ArrayList<ContentProviderOperation> ops = new ArrayList<>();
|
||||
insertMainProfileRawContact(ops, masterKeyId);
|
||||
writeContactKey(ops, context, rawContactId, masterKeyId, keyIdShort);
|
||||
writeContactKey(ops, context, rawContactId, masterKeyId, userIdSplit[0]);
|
||||
|
||||
try {
|
||||
resolver.applyBatch(ContactsContract.AUTHORITY, ops);
|
||||
|
Loading…
Reference in New Issue
Block a user