core, badge-service, ios, android: change badge tier in the store, and restore a subscription on another device (#7795)

This commit is contained in:
spaced4ndy authored and GitHub committed 2026-10-21 16:53:15 +00:00
1 parent f8f64a3047
commit 1bbbad99cb
39 files changed
+1937 -320

No files matched your search

+2 -3
View File
@@ -2209,9 +2209,8 @@ enum BadgePurchaseResult {
}
// log: false because a store receipt is a bearer secret, like a badge code - it is in the command.
// listed: found in the store's list rather than bought or restored here, so core records it only into a record it has.
func apiPurchaseBadge(_ userId: Int64, _ echoedInvoiceId: String?, listed: Bool, _ payment: ServicePayment) async throws -> BadgePurchaseResult {
let r: ChatResponse2 = try await chatSendCmd(.apiPurchaseBadge(userId: userId, echoedInvoiceId: echoedInvoiceId, listed: listed, payment: payment), log: false)
func apiPurchaseBadge(_ userId: Int64, _ echoedInvoiceId: String?, origin: StoreReceiptOrigin, _ payment: ServicePayment) async throws -> BadgePurchaseResult {
let r: ChatResponse2 = try await chatSendCmd(.apiPurchaseBadge(userId: userId, echoedInvoiceId: echoedInvoiceId, origin: origin, payment: payment), log: false)
switch r {
case let .badgeState(user, badgeState, storePurchases): return .held(user: user, badgeState: badgeState, storePurchases: storePurchases ?? [])
case let .badgeRedeemed(user, _, _, badgeState): return .credited(user: user, badgeState: badgeState)