mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 02:12:25 +00:00
Merge remote-tracking branch 'origin/master' into ab/names-lookup-api
This commit is contained in:
commit
75b59f4dec
238 files changed
+6294
-4002
No files matched your search
@@ -2205,12 +2205,7 @@ func redeemErrorText(_ error: Error) -> String {
|
||||
case .invalidCode: return NSLocalizedString("This code is not valid.", comment: "alert message")
|
||||
case .serviceNotConfigured: return NSLocalizedString("This app version cannot redeem badge codes.", comment: "alert message")
|
||||
case .badgeActive: return NSLocalizedString("This profile already has a badge. Redeem the code on another profile, or once this badge ends.", comment: "alert message")
|
||||
case .serviceError(.codeInvalid): return NSLocalizedString("This code was not recognised.", comment: "alert message")
|
||||
case .serviceError(.codeUsed): return NSLocalizedString("This code has already been used.", comment: "alert message")
|
||||
case .serviceError(.codeExpired): return NSLocalizedString("This code has expired.", comment: "alert message")
|
||||
case .serviceError(.rateLimited): return NSLocalizedString("Too many attempts. Please try again later.", comment: "alert message")
|
||||
case .serviceError(.unsupportedVersion): return NSLocalizedString("This app version is too old for the badge service. Please update the app.", comment: "alert message")
|
||||
case .serviceError: break
|
||||
case let .serviceError(code): if let text = badgeServiceErrorText(code) { return text }
|
||||
case let .invalidResponse(message):
|
||||
return String.localizedStringWithFormat(NSLocalizedString("The badge service sent an unexpected response: %@", comment: "alert message"), message)
|
||||
case .unknownKeyIndex, .credentialNotVerified: return NSLocalizedString("This app version cannot verify this badge. Please update the app.", comment: "alert message")
|
||||
@@ -2231,6 +2226,12 @@ func apiGetBadgeStateSync(_ userId: Int64) throws -> BadgeState? {
|
||||
throw r.unexpected
|
||||
}
|
||||
|
||||
func apiGetBadgeLedger(_ userId: Int64, _ badgePurchaseId: Int64) async throws -> [StatementEntry] {
|
||||
let r: ChatResponse2 = try await chatSendCmd(.apiGetBadgeLedger(userId: userId, badgePurchaseId: badgePurchaseId))
|
||||
if case let .badgeLedger(_, badgeLedger) = r { return badgeLedger }
|
||||
throw r.unexpected
|
||||
}
|
||||
|
||||
func apiAckBadgeAlert(_ userId: Int64, _ badgePurchaseId: Int64, _ alertKind: BadgeAlertKind, snooze: Bool, episode: String) async throws -> BadgeState? {
|
||||
let r: ChatResponse2 = try await chatSendCmd(.apiAckBadgeAlert(userId: userId, badgePurchaseId: badgePurchaseId, alertKind: alertKind, snooze: snooze, episode: episode))
|
||||
if case let .badgeState(_, badgeState) = r { return badgeState }
|
||||
|
||||
Reference in new issue
Block a user