feat(ads): send ad unit id to backend during reward polling (#7872)

* feat(ads): send ad unit id to backend during reward polling

* refactor: built in url encoding

* refactor: change ad unit position
This commit is contained in:
Peter Porfy authored and GitHub committed 2026-10-01 15:53:46 +02:00
1 parent 8e6b8aa348
commit a2733a1bc8
9 files changed
+202 -47

No files matched your search

@@ -188,7 +188,7 @@ extension HTTPRequest {
case postExternalPurchaseToken
case postCreateTicket
case isPurchaseAllowedByRestoreBehavior(appUserID: String)
case rewardVerificationStatus(appUserID: String, clientTransactionID: String)
case rewardVerificationStatus(appUserID: String, clientTransactionID: String, adUnitID: String?)
case remoteConfig(domain: String)
case tokenLogin
@@ -483,8 +483,15 @@ extension HTTPRequest.Path: HTTPRequestPath {
case let .isPurchaseAllowedByRestoreBehavior(appUserID):
return "subscribers/\(Self.escape(appUserID))/restore/eligibility"
case let .rewardVerificationStatus(appUserID, clientTransactionID):
return "subscribers/\(Self.escape(appUserID))/ads/reward_verifications/\(Self.escape(clientTransactionID))"
case let .rewardVerificationStatus(appUserID, clientTransactionID, adUnitID):
let path = "subscribers/\(Self.escape(appUserID))/ads/reward_verifications/"
+ Self.escape(clientTransactionID)
guard let adUnitID = adUnitID?.notEmptyOrWhitespaces,
let encodedAdUnitID = adUnitID.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
else {
return path
}
return "\(path)?ad_unit_id=\(encodedAdUnitID)"
case let .remoteConfig(domain):
return "config/\(Self.escape(domain))"