mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 08:08:02 +01:00
Add low and high detail svgs to badges
This commit is contained in:
@@ -110,6 +110,8 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter {
|
||||
configuration.getXhdpi(),
|
||||
configuration.getXxhdpi(),
|
||||
configuration.getXxxhdpi(),
|
||||
configuration.getLowDetailSvg(),
|
||||
configuration.getHighDetailSvg(),
|
||||
accountBadge.getExpiration(),
|
||||
accountBadge.isVisible());
|
||||
})
|
||||
@@ -128,6 +130,8 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter {
|
||||
configuration.getXhdpi(),
|
||||
configuration.getXxhdpi(),
|
||||
configuration.getXxxhdpi(),
|
||||
configuration.getLowDetailSvg(),
|
||||
configuration.getHighDetailSvg(),
|
||||
now.plus(Duration.ofDays(1)),
|
||||
true);
|
||||
}).collect(Collectors.toList()));
|
||||
@@ -146,12 +150,14 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter {
|
||||
final String xhdpi,
|
||||
final String xxhdpi,
|
||||
final String xxxhdpi,
|
||||
final String lsvg,
|
||||
final String hsvg,
|
||||
final Instant expiration,
|
||||
final boolean visible) {
|
||||
if (isSelf) {
|
||||
return new SelfBadge(id, category, name, description, ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi, expiration, visible);
|
||||
return new SelfBadge(id, category, name, description, ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi, lsvg, hsvg, expiration, visible);
|
||||
} else {
|
||||
return new Badge(id, category, name, description, ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi);
|
||||
return new Badge(id, category, name, description, ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi, lsvg, hsvg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ public class BadgeConfiguration {
|
||||
private final String xhdpi;
|
||||
private final String xxhdpi;
|
||||
private final String xxxhdpi;
|
||||
private final String lowDetailSvg;
|
||||
private final String highDetailSvg;
|
||||
|
||||
@JsonCreator
|
||||
public BadgeConfiguration(
|
||||
@@ -30,7 +32,9 @@ public class BadgeConfiguration {
|
||||
@JsonProperty("hdpi") final String hdpi,
|
||||
@JsonProperty("xhdpi") final String xhdpi,
|
||||
@JsonProperty("xxhdpi") final String xxhdpi,
|
||||
@JsonProperty("xxxhdpi") final String xxxhdpi) {
|
||||
@JsonProperty("xxxhdpi") final String xxxhdpi,
|
||||
@JsonProperty("lowDetailSvg") final String lowDetailSvg,
|
||||
@JsonProperty("highDetailSvg") final String highDetailSvg) {
|
||||
this.id = id;
|
||||
this.category = category;
|
||||
this.ldpi = ldpi;
|
||||
@@ -39,6 +43,8 @@ public class BadgeConfiguration {
|
||||
this.xhdpi = xhdpi;
|
||||
this.xxhdpi = xxhdpi;
|
||||
this.xxxhdpi = xxxhdpi;
|
||||
this.lowDetailSvg = lowDetailSvg;
|
||||
this.highDetailSvg = highDetailSvg;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
@@ -51,30 +57,46 @@ public class BadgeConfiguration {
|
||||
return category;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getLdpi() {
|
||||
return ldpi;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getMdpi() {
|
||||
return mdpi;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getHdpi() {
|
||||
return hdpi;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getXhdpi() {
|
||||
return xhdpi;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getXxhdpi() {
|
||||
return xxhdpi;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getXxxhdpi() {
|
||||
return xxxhdpi;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getLowDetailSvg() {
|
||||
return lowDetailSvg;
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
public String getHighDetailSvg() {
|
||||
return highDetailSvg;
|
||||
}
|
||||
|
||||
public boolean isTestBadge() {
|
||||
return CATEGORY_TESTING.equals(category);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ public class Badge {
|
||||
private final String xhdpi;
|
||||
private final String xxhdpi;
|
||||
private final String xxxhdpi;
|
||||
private final String lsvg;
|
||||
private final String hsvg;
|
||||
|
||||
@JsonCreator
|
||||
public Badge(
|
||||
@@ -32,7 +34,9 @@ public class Badge {
|
||||
@JsonProperty("hdpi") final String hdpi,
|
||||
@JsonProperty("xhdpi") final String xhdpi,
|
||||
@JsonProperty("xxhdpi") final String xxhdpi,
|
||||
@JsonProperty("xxxhdpi") final String xxxhdpi) {
|
||||
@JsonProperty("xxxhdpi") final String xxxhdpi,
|
||||
@JsonProperty("lsvg") final String lsvg,
|
||||
@JsonProperty("hsvg") final String hsvg) {
|
||||
this.id = id;
|
||||
this.category = category;
|
||||
this.name = name;
|
||||
@@ -43,6 +47,8 @@ public class Badge {
|
||||
this.xhdpi = xhdpi;
|
||||
this.xxhdpi = xxhdpi;
|
||||
this.xxxhdpi = xxxhdpi;
|
||||
this.lsvg = lsvg;
|
||||
this.hsvg = hsvg;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
@@ -85,6 +91,14 @@ public class Badge {
|
||||
return xxxhdpi;
|
||||
}
|
||||
|
||||
public String getLsvg() {
|
||||
return lsvg;
|
||||
}
|
||||
|
||||
public String getHsvg() {
|
||||
return hsvg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) {
|
||||
@@ -94,16 +108,34 @@ public class Badge {
|
||||
return false;
|
||||
}
|
||||
Badge badge = (Badge) o;
|
||||
return Objects.equals(id, badge.id) && Objects.equals(category,
|
||||
badge.category) && Objects.equals(name, badge.name) && Objects.equals(
|
||||
description, badge.description) && Objects.equals(ldpi, badge.ldpi)
|
||||
&& Objects.equals(mdpi, badge.mdpi) && Objects.equals(hdpi, badge.hdpi)
|
||||
&& Objects.equals(xhdpi, badge.xhdpi) && Objects.equals(xxhdpi,
|
||||
badge.xxhdpi) && Objects.equals(xxxhdpi, badge.xxxhdpi);
|
||||
return Objects.equals(id, badge.id)
|
||||
&& Objects.equals(category, badge.category)
|
||||
&& Objects.equals(name, badge.name)
|
||||
&& Objects.equals(description, badge.description)
|
||||
&& Objects.equals(ldpi, badge.ldpi)
|
||||
&& Objects.equals(mdpi, badge.mdpi)
|
||||
&& Objects.equals(hdpi, badge.hdpi)
|
||||
&& Objects.equals(xhdpi, badge.xhdpi)
|
||||
&& Objects.equals(xxhdpi, badge.xxhdpi)
|
||||
&& Objects.equals(xxxhdpi, badge.xxxhdpi)
|
||||
&& Objects.equals(lsvg, badge.lsvg)
|
||||
&& Objects.equals(hsvg, badge.hsvg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, category, name, description, ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi);
|
||||
return Objects.hash(
|
||||
id,
|
||||
category,
|
||||
name,
|
||||
description,
|
||||
ldpi,
|
||||
mdpi,
|
||||
hdpi,
|
||||
xhdpi,
|
||||
xxhdpi,
|
||||
xxxhdpi,
|
||||
lsvg,
|
||||
hsvg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,11 @@ public class SelfBadge extends Badge {
|
||||
@JsonProperty("xhdpi") final String xhdpi,
|
||||
@JsonProperty("xxhdpi") final String xxhdpi,
|
||||
@JsonProperty("xxxhdpi") final String xxxhdpi,
|
||||
@JsonProperty("lsvg") final String lsvg,
|
||||
@JsonProperty("hsvg") final String hsvg,
|
||||
final Instant expiration,
|
||||
final boolean visible) {
|
||||
super(id, category, name, description, ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi);
|
||||
super(id, category, name, description, ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi, lsvg, hsvg);
|
||||
this.expiration = expiration;
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user