Show contact profile photo instead of system contact.

This commit is contained in:
Alex Hart
2021-01-13 11:36:39 -04:00
committed by Greyson Parrelli
parent cee2702fdf
commit 2d20ceea01
10 changed files with 80 additions and 26 deletions

View File

@@ -34,12 +34,14 @@ import org.thoughtcrime.securesms.database.RecipientDatabase.UnidentifiedAccessM
import org.thoughtcrime.securesms.database.RecipientDatabase.VibrateState;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.groups.GroupId;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.notifications.NotificationChannels;
import org.thoughtcrime.securesms.phonenumbers.NumberUtil;
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter;
import org.thoughtcrime.securesms.profiles.ProfileName;
import org.thoughtcrime.securesms.util.FeatureFlags;
import org.thoughtcrime.securesms.util.StringUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.libsignal.util.guava.Preconditions;
@@ -729,11 +731,12 @@ public class Recipient {
}
public @Nullable ContactPhoto getContactPhoto() {
if (isSelf) return null;
else if (isGroupInternal() && groupAvatarId.isPresent()) return new GroupRecordContactPhoto(groupId, groupAvatarId.get());
else if (systemContactPhoto != null) return new SystemContactPhoto(id, systemContactPhoto, 0);
else if (profileAvatar != null && hasProfileImage) return new ProfileContactPhoto(this, profileAvatar);
else return null;
if (isSelf) return null;
else if (isGroupInternal() && groupAvatarId.isPresent()) return new GroupRecordContactPhoto(groupId, groupAvatarId.get());
else if (systemContactPhoto != null && SignalStore.settings().isPreferSystemContactPhotos()) return new SystemContactPhoto(id, systemContactPhoto, 0);
else if (profileAvatar != null && hasProfileImage) return new ProfileContactPhoto(this, profileAvatar);
else if (systemContactPhoto != null) return new SystemContactPhoto(id, systemContactPhoto, 0);
else return null;
}
public @Nullable Uri getMessageRingtone() {