mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 10:51:27 +01:00
Revamp group name color generation.
This commit is contained in:
@@ -220,10 +220,10 @@ public final class LiveRecipient {
|
||||
avatarId = Optional.of(groupRecord.get().getAvatarId());
|
||||
}
|
||||
|
||||
return new RecipientDetails(title, null, avatarId, false, false, record.getRegistered(), record, members, false, groupRecord.get().isActive(), null);
|
||||
return new RecipientDetails(title, null, avatarId, false, false, record.getRegistered(), record, members, false, groupRecord.get().isActive(), null, groupRecord);
|
||||
}
|
||||
|
||||
return new RecipientDetails(null, null, Optional.empty(), false, false, record.getRegistered(), record, null, false, false, null);
|
||||
return new RecipientDetails(null, null, Optional.empty(), false, false, record.getRegistered(), record, null, false, false, null, Optional.empty());
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.thoughtcrime.securesms.database.RecipientTable.UnidentifiedAccessMode
|
||||
import org.thoughtcrime.securesms.database.RecipientTable.VibrateState;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.DistributionListId;
|
||||
import org.thoughtcrime.securesms.database.model.GroupRecord;
|
||||
import org.thoughtcrime.securesms.database.model.ProfileAvatarFileDetails;
|
||||
import org.thoughtcrime.securesms.database.model.RecipientRecord;
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.RecipientExtras;
|
||||
@@ -137,6 +138,7 @@ public class Recipient {
|
||||
private final boolean isReleaseNotesRecipient;
|
||||
private final boolean needsPniSignature;
|
||||
private final CallLinkRoomId callLinkRoomId;
|
||||
private final Optional<GroupRecord> groupRecord;
|
||||
|
||||
/**
|
||||
* Returns a {@link LiveRecipient}, which contains a {@link Recipient} that may or may not be
|
||||
@@ -425,6 +427,7 @@ public class Recipient {
|
||||
this.needsPniSignature = false;
|
||||
this.isActiveGroup = false;
|
||||
this.callLinkRoomId = null;
|
||||
this.groupRecord = Optional.empty();
|
||||
}
|
||||
|
||||
public Recipient(@NonNull RecipientId id, @NonNull RecipientDetails details, boolean resolved) {
|
||||
@@ -482,6 +485,7 @@ public class Recipient {
|
||||
this.needsPniSignature = details.needsPniSignature;
|
||||
this.isActiveGroup = details.isActiveGroup;
|
||||
this.callLinkRoomId = details.callLinkRoomId;
|
||||
this.groupRecord = details.groupRecord;
|
||||
}
|
||||
|
||||
public @NonNull RecipientId getId() {
|
||||
@@ -902,6 +906,11 @@ public class Recipient {
|
||||
return new ArrayList<>(participantIds);
|
||||
}
|
||||
|
||||
public @NonNull List<ServiceId> getParticipantAcis() {
|
||||
Preconditions.checkState(groupRecord.isPresent());
|
||||
return groupRecord.get().requireV2GroupProperties().getMemberServiceIds();
|
||||
}
|
||||
|
||||
public @NonNull Drawable getFallbackContactPhotoDrawable(Context context, boolean inverted) {
|
||||
return getFallbackContactPhotoDrawable(context, inverted, DEFAULT_FALLBACK_PHOTO_PROVIDER, AvatarUtil.UNDEFINED_SIZE);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.database.RecipientTable.RegisteredState;
|
||||
import org.thoughtcrime.securesms.database.RecipientTable.UnidentifiedAccessMode;
|
||||
import org.thoughtcrime.securesms.database.RecipientTable.VibrateState;
|
||||
import org.thoughtcrime.securesms.database.model.DistributionListId;
|
||||
import org.thoughtcrime.securesms.database.model.GroupRecord;
|
||||
import org.thoughtcrime.securesms.database.model.ProfileAvatarFileDetails;
|
||||
import org.thoughtcrime.securesms.database.model.RecipientRecord;
|
||||
import org.thoughtcrime.securesms.groups.GroupId;
|
||||
@@ -88,6 +89,7 @@ public class RecipientDetails {
|
||||
final boolean isReleaseChannel;
|
||||
final boolean needsPniSignature;
|
||||
final CallLinkRoomId callLinkRoomId;
|
||||
final Optional<GroupRecord> groupRecord;
|
||||
|
||||
public RecipientDetails(@Nullable String groupName,
|
||||
@Nullable String systemContactName,
|
||||
@@ -99,7 +101,8 @@ public class RecipientDetails {
|
||||
@Nullable List<RecipientId> participantIds,
|
||||
boolean isReleaseChannel,
|
||||
boolean isActiveGroup,
|
||||
@Nullable AvatarColor avatarColor)
|
||||
@Nullable AvatarColor avatarColor,
|
||||
Optional<GroupRecord> groupRecord)
|
||||
{
|
||||
this.groupAvatarId = groupAvatarId;
|
||||
this.systemContactPhoto = Util.uri(record.getSystemContactPhotoUri());
|
||||
@@ -154,6 +157,7 @@ public class RecipientDetails {
|
||||
this.isReleaseChannel = isReleaseChannel;
|
||||
this.needsPniSignature = record.needsPniSignature();
|
||||
this.callLinkRoomId = record.getCallLinkRoomId();
|
||||
this.groupRecord = groupRecord;
|
||||
}
|
||||
|
||||
private RecipientDetails() {
|
||||
@@ -210,6 +214,7 @@ public class RecipientDetails {
|
||||
this.needsPniSignature = false;
|
||||
this.isActiveGroup = false;
|
||||
this.callLinkRoomId = null;
|
||||
this.groupRecord = Optional.empty();
|
||||
}
|
||||
|
||||
public static @NonNull RecipientDetails forIndividual(@NonNull Context context, @NonNull RecipientRecord settings) {
|
||||
@@ -228,15 +233,15 @@ public class RecipientDetails {
|
||||
}
|
||||
}
|
||||
|
||||
return new RecipientDetails(null, settings.getSystemDisplayName(), Optional.empty(), systemContact, isSelf, registeredState, settings, null, isReleaseChannel, false, null);
|
||||
return new RecipientDetails(null, settings.getSystemDisplayName(), Optional.empty(), systemContact, isSelf, registeredState, settings, null, isReleaseChannel, false, null, Optional.empty());
|
||||
}
|
||||
|
||||
public static @NonNull RecipientDetails forDistributionList(String title, @Nullable List<RecipientId> members, @NonNull RecipientRecord record) {
|
||||
return new RecipientDetails(title, null, Optional.empty(), false, false, record.getRegistered(), record, members, false, false, null);
|
||||
return new RecipientDetails(title, null, Optional.empty(), false, false, record.getRegistered(), record, members, false, false, null, Optional.empty());
|
||||
}
|
||||
|
||||
public static @NonNull RecipientDetails forCallLink(String name, @NonNull RecipientRecord record, @NonNull AvatarColor avatarColor) {
|
||||
return new RecipientDetails(name, null, Optional.empty(), false, false, record.getRegistered(), record, Collections.emptyList(), false, false, avatarColor);
|
||||
return new RecipientDetails(name, null, Optional.empty(), false, false, record.getRegistered(), record, Collections.emptyList(), false, false, avatarColor, Optional.empty());
|
||||
}
|
||||
|
||||
public static @NonNull RecipientDetails forUnknown() {
|
||||
|
||||
Reference in New Issue
Block a user