Update UI and strings for the duplicate name review screen.

This commit is contained in:
Greyson Parrelli
2024-02-15 16:57:01 -05:00
committed by Cody Henthorne
parent e7c018283a
commit bdb34e16c6
9 changed files with 33 additions and 61 deletions

View File

@@ -69,9 +69,9 @@ public class ReviewBannerView extends FrameLayout {
binding.bannerAvatarStroke.setVisibility(GONE);
}
public void setBannerRecipient(@NonNull Recipient recipient) {
binding.bannerTopLeftAvatar.setAvatar(recipient);
binding.bannerBottomRightAvatar.setAvatar(recipient);
public void setBannerRecipients(@NonNull Recipient target, @NonNull Recipient dupe) {
binding.bannerTopLeftAvatar.setAvatar(target);
binding.bannerBottomRightAvatar.setAvatar(dupe);
binding.bannerIcon.setVisibility(GONE);
binding.bannerTopLeftAvatar.setVisibility(VISIBLE);

View File

@@ -83,13 +83,6 @@ class ReviewCardViewHolder extends RecyclerView.ViewHolder {
binding.cardName.setText(name);
int titleTextResId = getTitleResId(reviewCard.getCardType());
if (titleTextResId > 0) {
binding.cardTitle.setText(getTitleResId(reviewCard.getCardType()));
} else {
binding.cardTitle.setVisibility(View.GONE);
}
List<ReviewTextRow> rows = switch (reviewCard.getCardType()) {
case MEMBER, REQUEST -> getNonContactSublines(reviewCard);
case YOUR_CONTACT -> getContactSublines(reviewCard);
@@ -253,14 +246,6 @@ class ReviewCardViewHolder extends RecyclerView.ViewHolder {
void onSignalConnectionClicked();
}
private static @StringRes int getTitleResId(@NonNull ReviewCard.CardType cardType) {
return switch (cardType) {
case MEMBER -> -1;
case REQUEST -> R.string.ReviewCard__request;
case YOUR_CONTACT -> R.string.ReviewCard__your_contact;
};
}
private static @StringRes int getActionLabelResId(@NonNull ReviewCard.Action action) {
return switch (action) {
case UPDATE_CONTACT -> R.string.ReviewCard__update_contact;

View File

@@ -39,15 +39,17 @@ public final class ReviewUtil {
* @return Whether or not multiple recipients share this profile name.
*/
@WorkerThread
public static boolean isRecipientReviewSuggested(@NonNull RecipientId recipientId)
public static List<RecipientId> getRecipientsToPromptForReview(@NonNull RecipientId recipientId)
{
Recipient recipient = Recipient.resolved(recipientId);
if (recipient.isGroup() || recipient.isSystemContact()) {
return false;
return Collections.emptyList();
}
return SignalDatabase.recipients().getSimilarRecipientIds(recipient).size() > 1;
return Stream.of(SignalDatabase.recipients().getSimilarRecipientIds(recipient))
.filter(id -> !id.equals(recipientId))
.toList();
}
@WorkerThread