Do not set color before profile name is known.

This commit is contained in:
Alan Evans
2020-09-22 14:09:48 -03:00
committed by Greyson Parrelli
parent 74e94f3a97
commit a05f74d302
3 changed files with 15 additions and 1 deletions

View File

@@ -999,7 +999,7 @@ public class RecipientDatabase extends Database {
values.put(STORAGE_SERVICE_ID, Base64.encodeBytes(contact.getId().getRaw()));
values.put(DIRTY, DirtyState.CLEAN.getId());
if (contact.isProfileSharingEnabled() && isInsert) {
if (contact.isProfileSharingEnabled() && isInsert && !profileName.isEmpty()) {
values.put(COLOR, ContactColors.generateFor(profileName.toString()).serialize());
}

View File

@@ -99,6 +99,10 @@ public final class ProfileName implements Parcelable {
givenName = StringUtil.trimToFit(givenName.trim(), ProfileName.MAX_PART_LENGTH);
familyName = StringUtil.trimToFit(familyName.trim(), ProfileName.MAX_PART_LENGTH);
if (givenName.isEmpty() && familyName.isEmpty()) {
return EMPTY;
}
return new ProfileName(givenName, familyName);
}