Add badges to CreateProfileRequest

This will permit users to set the order and visibility of badges on
their profile.
This commit is contained in:
Ehren Kret
2021-09-15 23:20:45 -05:00
parent 09519ae942
commit 537d61d5bd
2 changed files with 23 additions and 11 deletions

View File

@@ -8,6 +8,8 @@ package org.whispersystems.textsecuregcm.entities;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.StringUtils;
@@ -39,17 +41,22 @@ public class CreateProfileRequest {
@ExactlySize({0, 776})
private String paymentAddress;
@JsonProperty
@NotNull
private List<String> badgeIds = new ArrayList<>();
@JsonProperty
@NotNull
@JsonDeserialize(using = ProfileKeyCommitmentAdapter.Deserializing.class)
@JsonSerialize(using = ProfileKeyCommitmentAdapter.Serializing.class)
private ProfileKeyCommitment commitment;
public CreateProfileRequest() {}
public CreateProfileRequest() {
}
public CreateProfileRequest(
ProfileKeyCommitment commitment, String version, String name, String aboutEmoji, String about,
String paymentAddress, boolean wantsAvatar) {
String paymentAddress, boolean wantsAvatar, List<String> badgeIds) {
this.commitment = commitment;
this.version = version;
this.name = name;
@@ -57,6 +64,7 @@ public class CreateProfileRequest {
this.about = about;
this.paymentAddress = paymentAddress;
this.avatar = wantsAvatar;
this.badgeIds = badgeIds;
}
public ProfileKeyCommitment getCommitment() {
@@ -86,4 +94,8 @@ public class CreateProfileRequest {
public String getPaymentAddress() {
return StringUtils.stripToNull(paymentAddress);
}
public List<String> getBadges() {
return badgeIds;
}
}