Add emojis/"about" text to profiles

This commit is contained in:
Jon Chambers
2021-01-20 15:42:47 -05:00
committed by GitHub
parent 6b850b9894
commit 225932b4c9
10 changed files with 163 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ 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 org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.NotEmpty;
import org.signal.zkgroup.profiles.ProfileKeyCommitment;
import org.whispersystems.textsecuregcm.util.ExactlySize;
@@ -27,6 +28,14 @@ public class CreateProfileRequest {
@JsonProperty
private boolean avatar;
@JsonProperty
@ExactlySize({0, 80})
private String aboutEmoji;
@JsonProperty
@ExactlySize({0, 208, 376, 720})
private String about;
@JsonProperty
@NotNull
@JsonDeserialize(using = ProfileKeyCommitmentAdapter.Deserializing.class)
@@ -35,10 +44,12 @@ public class CreateProfileRequest {
public CreateProfileRequest() {}
public CreateProfileRequest(ProfileKeyCommitment commitment, String version, String name, boolean wantsAvatar) {
public CreateProfileRequest(ProfileKeyCommitment commitment, String version, String name, String aboutEmoji, String about, boolean wantsAvatar) {
this.commitment = commitment;
this.version = version;
this.name = name;
this.aboutEmoji = aboutEmoji;
this.about = about;
this.avatar = wantsAvatar;
}
@@ -57,4 +68,12 @@ public class CreateProfileRequest {
public boolean isAvatar() {
return avatar;
}
public String getAboutEmoji() {
return StringUtils.stripToNull(aboutEmoji);
}
public String getAbout() {
return StringUtils.stripToNull(about);
}
}

View File

@@ -24,6 +24,12 @@ public class Profile {
@JsonProperty
private String name;
@JsonProperty
private String about;
@JsonProperty
private String aboutEmoji;
@JsonProperty
private String avatar;
@@ -52,13 +58,15 @@ public class Profile {
public Profile() {}
public Profile(String name, String avatar, String identityKey,
public Profile(String name, String about, String aboutEmoji, String avatar, String identityKey,
String unidentifiedAccess, boolean unrestrictedUnidentifiedAccess,
UserCapabilities capabilities, String username, UUID uuid,
ProfileKeyCredentialResponse credential,
List<PaymentAddress> payments)
{
this.name = name;
this.about = about;
this.aboutEmoji = aboutEmoji;
this.avatar = avatar;
this.identityKey = identityKey;
this.unidentifiedAccess = unidentifiedAccess;
@@ -80,6 +88,14 @@ public class Profile {
return name;
}
public String getAbout() {
return about;
}
public String getAboutEmoji() {
return aboutEmoji;
}
@VisibleForTesting
public String getAvatar() {
return avatar;