mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Implement ability to view badges and modify whether they appear.
Note: this is available in staging only.
This commit is contained in:
@@ -722,7 +722,8 @@ public class SignalServiceAccountManager {
|
||||
String about,
|
||||
String aboutEmoji,
|
||||
Optional<SignalServiceProtos.PaymentAddress> paymentsAddress,
|
||||
StreamDetails avatar)
|
||||
StreamDetails avatar,
|
||||
List<String> visibleBadgeIds)
|
||||
throws IOException
|
||||
{
|
||||
if (name == null) name = "";
|
||||
@@ -748,7 +749,8 @@ public class SignalServiceAccountManager {
|
||||
ciphertextEmoji,
|
||||
ciphertextMobileCoinAddress,
|
||||
hasAvatar,
|
||||
profileKey.getCommitment(uuid).serialize()),
|
||||
profileKey.getCommitment(uuid).serialize(),
|
||||
visibleBadgeIds),
|
||||
profileAvatarData);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.whispersystems.signalservice.api.profiles;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
@@ -12,6 +13,8 @@ import org.signal.zkgroup.profiles.ProfileKeyCredentialResponse;
|
||||
import org.whispersystems.libsignal.logging.Log;
|
||||
import org.whispersystems.signalservice.internal.util.JsonUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SignalServiceProfile {
|
||||
@@ -58,6 +61,9 @@ public class SignalServiceProfile {
|
||||
@JsonProperty
|
||||
private byte[] credential;
|
||||
|
||||
@JsonProperty
|
||||
private List<Badge> badges;
|
||||
|
||||
@JsonIgnore
|
||||
private RequestType requestType;
|
||||
|
||||
@@ -99,6 +105,10 @@ public class SignalServiceProfile {
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
public List<Badge> getBadges() {
|
||||
return badges;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
@@ -111,6 +121,57 @@ public class SignalServiceProfile {
|
||||
this.requestType = requestType;
|
||||
}
|
||||
|
||||
public static class Badge {
|
||||
@JsonProperty
|
||||
private String id;
|
||||
|
||||
@JsonProperty
|
||||
private String category;
|
||||
|
||||
@JsonProperty
|
||||
private String imageUrl;
|
||||
|
||||
@JsonProperty
|
||||
private String name;
|
||||
|
||||
@JsonProperty
|
||||
private String description;
|
||||
|
||||
@JsonProperty
|
||||
private BigDecimal expiration;
|
||||
|
||||
@JsonProperty
|
||||
private boolean visible;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public BigDecimal getExpiration() {
|
||||
return expiration;
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Capabilities {
|
||||
@JsonProperty
|
||||
private boolean gv2;
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.whispersystems.signalservice.api.profiles;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SignalServiceProfileWrite {
|
||||
|
||||
@JsonProperty
|
||||
@@ -26,11 +28,14 @@ public class SignalServiceProfileWrite {
|
||||
@JsonProperty
|
||||
private byte[] commitment;
|
||||
|
||||
@JsonProperty
|
||||
private List<String> badgeIds;
|
||||
|
||||
@JsonCreator
|
||||
public SignalServiceProfileWrite(){
|
||||
}
|
||||
|
||||
public SignalServiceProfileWrite(String version, byte[] name, byte[] about, byte[] aboutEmoji, byte[] paymentAddress, boolean avatar, byte[] commitment) {
|
||||
public SignalServiceProfileWrite(String version, byte[] name, byte[] about, byte[] aboutEmoji, byte[] paymentAddress, boolean avatar, byte[] commitment, List<String> badgeIds) {
|
||||
this.version = version;
|
||||
this.name = name;
|
||||
this.about = about;
|
||||
@@ -38,6 +43,7 @@ public class SignalServiceProfileWrite {
|
||||
this.paymentAddress = paymentAddress;
|
||||
this.avatar = avatar;
|
||||
this.commitment = commitment;
|
||||
this.badgeIds = badgeIds;
|
||||
}
|
||||
|
||||
public boolean hasAvatar() {
|
||||
|
||||
Reference in New Issue
Block a user