Commit a7e8a713 authored by Jose Blaya's avatar Jose Blaya
Browse files

update the api contract

parent cd1e845f
...@@ -242,15 +242,12 @@ class PIAWebServices: WebServices, ConfigurationAccess { ...@@ -242,15 +242,12 @@ class PIAWebServices: WebServices, ConfigurationAccess {
callback?(nil, error) callback?(nil, error)
return return
} }
guard let receipt = json["receipt"] as? [String: Any] else { let trialsEnabled = json["trial_enabled"] as? Bool ?? false
callback?(nil, error) let receipt = json["receipt"] as? [String: Any] ?? [:]
return
}
let isIntroOffer = receipt["is_in_intro_offer_period"] as? Bool ?? false let isIntroOffer = receipt["is_in_intro_offer_period"] as? Bool ?? false
let isTrialPeriod = receipt["is_trial_period"] as? Bool ?? false let isTrialPeriod = receipt["is_trial_period"] as? Bool ?? false
let trialsEnabled = json["trials_enabled"] as? Bool ?? false
let info = AppStoreInformation(products: products, let info = AppStoreInformation(products: products,
isInIntroOfferPeriod: isIntroOffer, isInIntroOfferPeriod: isIntroOffer,
...@@ -263,8 +260,8 @@ class PIAWebServices: WebServices, ConfigurationAccess { ...@@ -263,8 +260,8 @@ class PIAWebServices: WebServices, ConfigurationAccess {
Client.configuration.eligibleForTrial = true Client.configuration.eligibleForTrial = true
} }
//Backend can disable the trials //Backend can disable the trials and override the previous value
Client.configuration.eligibleForTrial = trialsEnabled Client.configuration.eligibleForTrial = info.trialsEnabled
callback?(info, nil) callback?(info, nil)
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment