mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 01:40:13 +01:00
Add duration to boost badges
Lets clients know how long the badge will last for after purchase.
This commit is contained in:
@@ -81,6 +81,7 @@ import org.whispersystems.textsecuregcm.configuration.SubscriptionConfiguration;
|
||||
import org.whispersystems.textsecuregcm.configuration.SubscriptionLevelConfiguration;
|
||||
import org.whispersystems.textsecuregcm.configuration.SubscriptionPriceConfiguration;
|
||||
import org.whispersystems.textsecuregcm.entities.Badge;
|
||||
import org.whispersystems.textsecuregcm.entities.PurchasableBadge;
|
||||
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
|
||||
import org.whispersystems.textsecuregcm.storage.IssuedReceiptsManager;
|
||||
import org.whispersystems.textsecuregcm.storage.SubscriptionManager;
|
||||
@@ -428,15 +429,15 @@ public class SubscriptionController {
|
||||
|
||||
public static class GetBoostBadgesResponse {
|
||||
public static class Level {
|
||||
private final Badge badge;
|
||||
private final PurchasableBadge badge;
|
||||
|
||||
@JsonCreator
|
||||
public Level(
|
||||
@JsonProperty("badge") Badge badge) {
|
||||
@JsonProperty("badge") PurchasableBadge badge) {
|
||||
this.badge = badge;
|
||||
}
|
||||
|
||||
public Badge getBadge() {
|
||||
public PurchasableBadge getBadge() {
|
||||
return badge;
|
||||
}
|
||||
}
|
||||
@@ -466,8 +467,8 @@ public class SubscriptionController {
|
||||
String giftBadge = giftConfiguration.badge();
|
||||
List<Locale> acceptableLanguages = getAcceptableLanguagesForRequest(containerRequestContext);
|
||||
GetBoostBadgesResponse getBoostBadgesResponse = new GetBoostBadgesResponse(Map.of(
|
||||
boostLevel, new GetBoostBadgesResponse.Level(badgeTranslator.translate(acceptableLanguages, boostBadge)),
|
||||
giftLevel, new GetBoostBadgesResponse.Level(badgeTranslator.translate(acceptableLanguages, giftBadge))));
|
||||
boostLevel, new GetBoostBadgesResponse.Level(new PurchasableBadge(badgeTranslator.translate(acceptableLanguages, boostBadge), boostConfiguration.getExpiration())),
|
||||
giftLevel, new GetBoostBadgesResponse.Level(new PurchasableBadge(badgeTranslator.translate(acceptableLanguages, giftBadge), giftConfiguration.expiration()))));
|
||||
return Response.ok(getBoostBadgesResponse).build();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user