Satisfy linter

The linter complained that the line with the URL parameters was too
long. I transformed the parameters into a dictionary. This has the
additional value of differences in parameters between installing and
purchasing can be spotted more easily.
This commit is contained in:
Maximilian Blochberger 2020-03-21 11:45:41 +01:00
parent 50b438011a
commit 3364a34784
No known key found for this signature in database
GPG key ID: A2A8F3CC6591A5FA

View file

@ -16,14 +16,27 @@ extension SSPurchase {
convenience init(adamId: UInt64, account: ISStoreAccount, isPurchase: Bool) {
self.init()
var parameters: [String: Any] = [
"productType": "C",
"price": 0,
"salableAdamId": adamId,
"pg": "default",
"appExtVrsId": 0
]
if isPurchase {
buyParameters =
"productType=C&price=0&salableAdamId=\(adamId)&pricingParameters=STDQ&pg=default&appExtVrsId=0&macappinstalledconfirmed=1"
parameters["macappinstalledconfirmed"] = 1
parameters["pricingParameters"] = "STDQ"
} else {
// is redownload, use existing functionality
buyParameters =
"productType=C&price=0&salableAdamId=\(adamId)&pricingParameters=STDRDL&pg=default&appExtVrsId=0"
parameters["pricingParameters"] = "STDRDL"
}
buyParameters = parameters.map { key, value in
return "\(key)=\(value)"
}.joined(separator: "&")
itemIdentifier = adamId
accountIdentifier = account.dsID
appleID = account.identifier