mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Convert SignalService, Database, Group, Payment, and other remaining protos to wire.
This commit is contained in:
committed by
Alex Hart
parent
a6b7d0bcc5
commit
efbd5cab85
@@ -8,7 +8,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
||||
/**
|
||||
* Represents a card showing user details for a recipient under review.
|
||||
*
|
||||
* <p>
|
||||
* See {@link ReviewCardViewHolder} for usage.
|
||||
*/
|
||||
class ReviewCard {
|
||||
@@ -25,11 +25,11 @@ class ReviewCard {
|
||||
@Nullable Action primaryAction,
|
||||
@Nullable Action secondaryAction)
|
||||
{
|
||||
this.reviewRecipient = reviewRecipient;
|
||||
this.inCommonGroupsCount = inCommonGroupsCount;
|
||||
this.cardType = cardType;
|
||||
this.primaryAction = primaryAction;
|
||||
this.secondaryAction = secondaryAction;
|
||||
this.reviewRecipient = reviewRecipient;
|
||||
this.inCommonGroupsCount = inCommonGroupsCount;
|
||||
this.cardType = cardType;
|
||||
this.primaryAction = primaryAction;
|
||||
this.secondaryAction = secondaryAction;
|
||||
}
|
||||
|
||||
@NonNull Recipient getReviewRecipient() {
|
||||
@@ -45,10 +45,10 @@ class ReviewCard {
|
||||
}
|
||||
|
||||
@Nullable ProfileChangeDetails.StringChange getNameChange() {
|
||||
if (reviewRecipient.getProfileChangeDetails() == null || !reviewRecipient.getProfileChangeDetails().hasProfileNameChange()) {
|
||||
if (reviewRecipient.getProfileChangeDetails() == null || reviewRecipient.getProfileChangeDetails().profileNameChange == null) {
|
||||
return null;
|
||||
} else {
|
||||
return reviewRecipient.getProfileChangeDetails().getProfileNameChange();
|
||||
return reviewRecipient.getProfileChangeDetails().profileNameChange;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ class ReviewCardViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
if (reviewCard.getNameChange() != null) {
|
||||
subtextLine2.setText(SpanUtil.italic(context.getString(R.string.ReviewCard__recently_changed,
|
||||
reviewCard.getNameChange().getPrevious(),
|
||||
reviewCard.getNameChange().getNew())));
|
||||
reviewCard.getNameChange().previous,
|
||||
reviewCard.getNameChange().newValue)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@ public class ReviewRecipient {
|
||||
int weight1 = recipient1.getRecipient().getId().equals(alwaysFirstId) ? -100 : 0;
|
||||
int weight2 = recipient2.getRecipient().getId().equals(alwaysFirstId) ? -100 : 0;
|
||||
|
||||
if (recipient1.getProfileChangeDetails() != null && recipient1.getProfileChangeDetails().hasProfileNameChange()) {
|
||||
if (recipient1.getProfileChangeDetails() != null && recipient1.getProfileChangeDetails().profileNameChange != null) {
|
||||
weight1--;
|
||||
}
|
||||
|
||||
if (recipient2.getProfileChangeDetails() != null && recipient2.getProfileChangeDetails().hasProfileNameChange()) {
|
||||
if (recipient2.getProfileChangeDetails() != null && recipient2.getProfileChangeDetails().profileNameChange != null) {
|
||||
weight2--;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public final class ReviewUtil {
|
||||
|
||||
private static @NonNull ProfileChangeDetails getProfileChangeDetails(@NonNull MessageRecord messageRecord) {
|
||||
try {
|
||||
return ProfileChangeDetails.parseFrom(Base64.decode(messageRecord.getBody()));
|
||||
return ProfileChangeDetails.ADAPTER.decode(Base64.decode(messageRecord.getBody()));
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user