mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 06:18:06 +01:00
Convert UserCapabilities to a record
This commit is contained in:
committed by
Jon Chambers
parent
d138fa45df
commit
a60450d931
@@ -8,7 +8,14 @@ package org.whispersystems.textsecuregcm.entities;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.whispersystems.textsecuregcm.storage.Account;
|
||||
|
||||
public class UserCapabilities {
|
||||
public record UserCapabilities(
|
||||
@JsonProperty("gv1-migration") boolean gv1Migration,
|
||||
boolean senderKey,
|
||||
boolean announcementGroup,
|
||||
boolean changeNumber,
|
||||
boolean stories,
|
||||
boolean giftBadges,
|
||||
boolean paymentActivation) {
|
||||
|
||||
public static UserCapabilities createForAccount(Account account) {
|
||||
return new UserCapabilities(
|
||||
@@ -20,72 +27,4 @@ public class UserCapabilities {
|
||||
account.isGiftBadgesSupported(),
|
||||
false); // Hardcode to false until all clients support the flow
|
||||
}
|
||||
|
||||
@JsonProperty("gv1-migration")
|
||||
private boolean gv1Migration;
|
||||
|
||||
@JsonProperty
|
||||
private boolean senderKey;
|
||||
|
||||
@JsonProperty
|
||||
private boolean announcementGroup;
|
||||
|
||||
@JsonProperty
|
||||
private boolean changeNumber;
|
||||
|
||||
@JsonProperty
|
||||
private boolean stories;
|
||||
|
||||
@JsonProperty
|
||||
private boolean giftBadges;
|
||||
|
||||
@JsonProperty
|
||||
private boolean paymentActivation;
|
||||
|
||||
public UserCapabilities() {
|
||||
}
|
||||
|
||||
public UserCapabilities(
|
||||
boolean gv1Migration,
|
||||
final boolean senderKey,
|
||||
final boolean announcementGroup,
|
||||
final boolean changeNumber,
|
||||
final boolean stories,
|
||||
final boolean giftBadges,
|
||||
final boolean paymentActivation) {
|
||||
|
||||
this.gv1Migration = gv1Migration;
|
||||
this.senderKey = senderKey;
|
||||
this.announcementGroup = announcementGroup;
|
||||
this.changeNumber = changeNumber;
|
||||
this.stories = stories;
|
||||
this.giftBadges = giftBadges;
|
||||
this.paymentActivation = paymentActivation;
|
||||
}
|
||||
|
||||
public boolean isGv1Migration() {
|
||||
return gv1Migration;
|
||||
}
|
||||
|
||||
public boolean isSenderKey() {
|
||||
return senderKey;
|
||||
}
|
||||
|
||||
public boolean isAnnouncementGroup() {
|
||||
return announcementGroup;
|
||||
}
|
||||
|
||||
public boolean isChangeNumber() {
|
||||
return changeNumber;
|
||||
}
|
||||
|
||||
public boolean isStories() {
|
||||
return stories;
|
||||
}
|
||||
|
||||
public boolean isGiftBadges() {
|
||||
return giftBadges;
|
||||
}
|
||||
|
||||
public boolean isPaymentActivation() { return paymentActivation; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user